• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver
(Mighty) Lua Event Manager

Release (Mighty) Lua Event Manager 12/13/2024

No permission to download
I downloaded this and was looking at it, and I couldn't find any events in there. Do I need to import events into it? Is there a video on this explaining how to use it?

Thank you.
Hiya Matt,

Make sure not to download and install this manually. Go to the overview tab of this thread and click watch on the right. That tab also explains the Lua and how it all works. - https://www.redguides.com/community/resources/mighty-lua-event-manager.2539/

1703430732297.png
1703430743130.png

Then go to your launchers and click install

1703430804408.png

The files to import and instrucitons can be found here - https://www.redguides.com/community/resources/lua-event-manager-lem-event-library.2600/
 
Some comments

Why is there 2 different activations? a event is something happening doesn't really matter to end-user if its text/condition, having the ability to share names between the 2 is going to lead to confusion (IMO)
/Lua event
/Lua cond

EQ crashed to desktop if I remove an event from condition events

Besides this, awesome work.
 
Can this be made to sort names by columns?

EX: If I clicked on Event Named, the events would be in Alpha Order.

Unlike this list which is in total chaos.

1706543365162.png
 
I may be dumb... I've copied Heroes are Forged LEM. I try to /lua run hafmission and get this text: Cannot find hafmission in the file system.

Could someone point me in the right direction please.
 
I may be dumb... I've copied Heroes are Forged LEM. I try to /lua run hafmission and get this text: Cannot find hafmission in the file system.

Could someone point me in the right direction please.
a Lua script is different them a lem share. lem is a Lua script, so you would want to do /Lua run lem, and in that, it should have the event for HAF.
 
When I do /lua run lem, it says lua script lem is already running, not starting another instance.
The HaF mission script is two things:
1. A standalone Lua script which you should install (by clicking watch on the overview tab of the HaF mission resource) and run on your driver, and
2. An event which you import into LEM and enable on all your toons
 
is there a place where people upload their events that can be downloaded by others? im not good at making things like this and would like to search others events to see if any would be helpful to me.
 
Sorry guys, I cannot get this to work. As a first step, I just want the script to Mediate when I am under 90% mana. However, when the conditions apply, the script chain-spams the meditating action whereas I only want him to trigger it once.

Can anyone tell me how to modify the system so an event is only triggered once, as opposed to chain-triggering it until conditions dont apply anymore?

Code:
local mq = require('mq')
local DA1 = 'Quivering Veil of Xarn'
local DA2 = 'Harmshield'
local FD = 'Death Peace'
local LifetapNuke = 'Touch of Mujaki'
local LifetapDoT = 'Saryrn\'s  Kiss'

---@return boolean @Returns true if the action should trigger, otherwise false.
local function condition()
    local MainAssist = 'MainCharacter'
    local Class = mq.TLO.Me.Class.ShortName()
    local PctHPs = mq.TLO.Me.PctHPs()
    local PctMana = mq.TLO.Me.PctMana()
    local Casting = mq.TLO.Me.Casting()
    local Invis = mq.TLO.Me.Invis()
    local Feigning = mq.TLO.Me.Feigning()
    local Moving = mq.TLO.Me.Moving()
    local SpellReady = mq.TLO.Me.SpellReady()
    local CombatMobs = mq.TLO.Me.XTarget()
    local Aggro = mq.TLO.Me.PctAggro()
    local Invulnerable = mq.TLO.Me.Invulnerable()
    if Class == 'NEC' and PctMana < 90 and CombatMobs == 0 then
        mq.cmd('/book')
        print('Meditating...')
    elseif Class == 'NEC' and PctMana < 90 and CombatMobs > 0 and Aggro < 60 then
        mq.cmd('/book')
        print('Meditating...')
    end
    mq.delay(10)
end

local function action()
end

return {condfunc=condition, actionfunc=action}
 
Last edited:
Since you're using /book you can check if the Spellbook is open and that will stop it spamming.

Lua:
if Class == 'NEC' and PctMana < 90 and CombatMobs == 0 and not mq.TLO.Window('SpellBookWnd').Open() then
    mq.cmd('/book')
    print('Meditating...')
elseif Class == 'NEC' and PctMana < 90 and CombatMobs > 0 and Aggro < 60 and not mq.TLO.Window('SpellBookWnd').Open() then
    mq.cmd('/book')
    print('Meditating...')
end
 
Since you're using /book you can check if the Spellbook is open and that will stop it spamming.

Lua:
if Class == 'NEC' and PctMana < 90 and CombatMobs == 0 and not mq.TLO.Window('SpellBookWnd').Open() then
    mq.cmd('/book')
    print('Meditating...')
elseif Class == 'NEC' and PctMana < 90 and CombatMobs > 0 and Aggro < 60 and not mq.TLO.Window('SpellBookWnd').Open() then
    mq.cmd('/book')
    print('Meditating...')
end

Thanks so much!
 
I am still getting an error in line 29, which is pasted below. See also screenshot attached for the exact error message.

Code:
if Class == 'NEC' and CombatMobs > 0 and PctHPs < 100 and Aggro == 100 and not Feigning and not Invulnerable and not Casting and not Invisible and mq.TLO.Me.SpellReady(Quivering Veil of Xarn) then

What is the problem with my SpellReady instruction?
 

Attachments

  • Screenshot 2024-03-25 220024.png
    Screenshot 2024-03-25 220024.png
    27.4 KB · Views: 0
I am still getting an error in line 29, which is pasted below. See also screenshot attached for the exact error message.

Code:
if Class == 'NEC' and CombatMobs > 0 and PctHPs < 100 and Aggro == 100 and not Feigning and not Invulnerable and not Casting and not Invisible and mq.TLO.Me.SpellReady(Quivering Veil of Xarn) then

What is the problem with my SpellReady instruction?

You need to put quotes around your spell name. You also already defined that spell as a variable, so you can use DA1 instead of the name. If you remove the parentheses at the end of your SpellReady variable you could then do SpellReady(DA1).
 
You need to put quotes around your spell name. You also already defined that spell as a variable, so you can use DA1 instead of the name. If you remove the parentheses at the end of your SpellReady variable you could then do SpellReady(DA1).

That made the trick, thank you!!!

Perhaps you could also help me with yet another problem I am encountering please? :)

Check my code below: the idea is that if I get hit, I cast DA1 (Quivering Veil of Xarn). Else if DA1 is not ready, then cast DA2 (Harmshield). Else if neither of those are ready, then cast FD (Death Peace). Unfortunately, the code loops infinitely spamming the first IF, never moving onto the first ELSEIF even if DA1 is not ready. Any idea why?

Code:
 if Class == 'NEC' and CombatMobs > 0 and PctHPs < 100 and Aggro == 100 and not Feigning and not Invulnerable and not Casting and not Invisible and mq.TLO.Me.SpellReady(DA1) then
        ---mq.cmd('/afollow')
        ---mq.cmd("/stopcast")
        mq.cmdf('/cast 7')
        mq.cmd('/g DAMAGE ->', DA1)
    elseif Class == 'NEC' and CombatMobs > 0 and PctHPs < 100 and Aggro == 100 and not Feigning and not Invulnerable and not Casting and not Invisible and not mq.TLO.Me.SpellReady(DA1) and mq.TLO.Me.SpellReady(DA2) then
        ---mq.cmd('/afollow')
       ---mq.cmd("/stopcast")
       mq.cmdf('/cast 6')
       mq.cmd('/g DAMAGE ->', DA2)
    elseif Class == 'NEC' and CombatMobs > 0 and PctHPs < 100 and Aggro == 100 and not Feigning and not Invulnerable and not Casting and not Invisible and not mq.TLO.Me.SpellReady(DA1) and not mq.TLO.Me.SpellReady(DA2) and mq.TLO.Me.SpellReady(FD) then
        ---mq.cmd('/afollow')
        ---mq.cmd("/stopcast")
        mq.cmdf('/cast 8')
       mq.cmd('/g DAMAGE ->', FD)
    end

In general, I have problems with the coditions inside the IFs being chain-spammed many times. Is there any way to instruct the code to only execute a particular instruction ONCE?
 
I believe you need to put an extra set of parentheses at the end of SpellReady - so mq.TLO.Me.SpellReady(DA1)(). Try that for all of your ifs and see if it starts working.
 
I believe you need to put an extra set of parentheses at the end of SpellReady - so mq.TLO.Me.SpellReady(DA1)(). Try that for all of your ifs and see if it starts working.

Holy cow man, you have no idea how much time I have spent today trying to figure that out!!! THANK YOU!!!

Just so I understand for the future: why do I need to add that second set of "( )" if I had already added the first set defining the spell "(DA1)"? What is the purpose of the second set of parenthesis? Thank you in advance :)
 
Very useful stuff, that will help tremendously.

If I may, I have another question please: in the code below, any idea what the script never triggers first IF when its conditions do apply, yet it does execute the ELSEIF when its conditions apply? Is it perhaps the " ' " in the spell's name "Saryrn's Kiss'? I dont get any syntax error, the code just ignores the IF altogether until the conditions for the ELSEIF apply (and then executes correctly the ELSEIF actions).

Code:
local mq = require('mq')
local MainAssist = 'My_Main_Character'
local LifetapNuke = 'Touch of Mujaki'
local LifetapDoT = 'Saryrn\'s  Kiss'

---@return boolean @Returns true if the action should trigger, otherwise false.

local function cast(spell)
    mq.cmdf('/cast %s', spell)
    mq.delay(100)
end
local function use_aa(aa)
    mq.cmdf('/alt activate %s', aa.ID())
    mq.delay(100)
end
local function stand()
    mq.cmdf('/stand')
    mq.delay(100)
end

local function condition()
    local Class = mq.TLO.Me.Class.ShortName()
    local PctHPs = mq.TLO.Me.PctHPs()
    local PctMana = mq.TLO.Me.PctMana()
    local Casting = mq.TLO.Me.Casting.ID()
    local Invisible = mq.TLO.Me.Invis()
    local Feigning = mq.TLO.Me.Feigning()
    local Moving = mq.TLO.Me.Moving()
    local SpellReady = mq.TLO.Me.SpellReady
    local CombatMobs = mq.TLO.Me.XTarget()
    local Aggro = mq.TLO.Me.PctAggro()
    local Invulnerable = mq.TLO.Me.Invulnerable()
    local Sitting = mq.TLO.Me.Sitting()
    if Class == 'NEC' and CombatMobs > 0 and PctHPs < 100 and PctHPs > 70 and PctMana > 30 and not Feigning and not Invulnerable and not Casting and not Invisible and mq.TLO.Me.SpellReady(LifetapDoT)() then
        mq.cmd('/g Recovering HPs ->', LifetapDoT)
        stand()
        mq.delay(50)
        mq.cmd('/assist ', MainAssist)
        mq.delay(50)
        cast(LifetapDoT)
        mq.delay(1000)
    elseif Class == 'NEC' and CombatMobs > 0 and PctHPs <= 70  and PctMana > 30 and not Feigning and not Invulnerable and not Casting and not Invisible and mq.TLO.Me.SpellReady(LifetapNuke)() then
        mq.cmd('/g Recovering HPs ->', LifetapNuke)
        stand()
        mq.delay(50)
        mq.cmd('/assist ', MainAssist)
        mq.delay(50)
        cast(LifetapNuke)
        mq.delay(1000)
    end
    mq.delay(1000)
end

return {condfunc=condition, actionfunc=action}
 
i always hated escaping when i didn't need to
try using "" so you don't have to escape the single quote.
local LifetapDoT = "Saryrn's Kiss"
 
I have a question regarding checking the success of a certain action. More particularly, I have coded an instruction so, if my necro climbs to the top of the aggro ladder and takes damage, he automatically casts Feign Death.

Unfortunately, as we all know, FD sometimes fails randomly, and I would like to code a parachute instruction so if it fails, the necro stands up and casts again:
Code:
local mq = require('mq')
local FD = "Feign Death"

local function cast(spell)
    mq.cmdf('/cast %s', spell)
    mq.delay(100)
end
local function stand()
    mq.cmdf('/stand')
    mq.delay(100)
end

local function condition()
    local Class = mq.TLO.Me.Class.ShortName()
    local Feigning = mq.TLO.Me.Feigning()
    local SpellReady = mq.TLO.Me.SpellReady
    local CombatMobs = mq.TLO.Me.XTarget()
    local PctHPs = mq.TLO.Me.PctHPs()
    local Aggro = mq.TLO.Me.PctAggro()
    if Class == 'NEC' and CombatMobs > 0 and PctHPs < 100 and Aggro == 100 and not Feigning and mq.TLO.Me.SpellReady(FD)() then
        cast(FD)
        mq.cmd('/g Casting ', FD)
        mq.delay(3000)
        ---CHECK IF FEIGN DEATH HAS FAILED
        if not Feigning then
            stand()
            cast(FD)
            mq.cmd('/g Casting again ', FD)
            mq.delay(1000)
        end
        mq.delay(1000)
    end
end

So, as you can see, I add a second IF inside the main IF to check if the necro is indeed Feigning after having cast FD. However, that is not really an elegant solution because 1) I need to wait out the delay(3000) due to casting time before I can check the Feigning status (which delays the re-casting in case of a fizzle), and 2) If FD fails a second time I am screwed :)

Any better way to better express that FD status check? THANKS!
 
I have a question regarding checking the success of a certain action. More particularly, I have coded an instruction so, if my necro climbs to the top of the aggro ladder and takes damage, he automatically casts Feign Death.

Unfortunately, as we all know, FD sometimes fails randomly, and I would like to code a parachute instruction so if it fails, the necro stands up and casts again:
Code:
local mq = require('mq')
local FD = "Feign Death"

local function cast(spell)
    mq.cmdf('/cast %s', spell)
    mq.delay(100)
end
local function stand()
    mq.cmdf('/stand')
    mq.delay(100)
end

local function condition()
    local Class = mq.TLO.Me.Class.ShortName()
    local Feigning = mq.TLO.Me.Feigning()
    local SpellReady = mq.TLO.Me.SpellReady
    local CombatMobs = mq.TLO.Me.XTarget()
    local PctHPs = mq.TLO.Me.PctHPs()
    local Aggro = mq.TLO.Me.PctAggro()
    if Class == 'NEC' and CombatMobs > 0 and PctHPs < 100 and Aggro == 100 and not Feigning and mq.TLO.Me.SpellReady(FD)() then
        cast(FD)
        mq.cmd('/g Casting ', FD)
        mq.delay(3000)
        ---CHECK IF FEIGN DEATH HAS FAILED
        if Class == 'NEC' and not Feigning then
            stand()
            cast(FD)
            mq.cmd('/g Casting again ', FD)
            mq.delay(1000)
        end
        mq.delay(1000)
    end
end

So, as you can see, I add a second IF inside the main IF to check if the necro is indeed Feigning after having cast FD. However, that is not really an elegant solution because 1) I need to delay(3000) to check the Feigning status (while I might be taking a beating from the mob), and 2) If FD fails a second time, then I am screwed :)

Any other way to better express that FD status check? THANKS!
you could setup a separate event on the FD failed message to stand back up. if FD failed and you're still high agro this condition would just fire again.

but also you seem to be doing the action stuff inside the condition function which .. i guess nothing prevents that but its kinda odd. do you just have an empty action function?
 
You seem to be doing the action stuff inside the condition function which .. i guess nothing prevents that but its kinda odd. do you just have an empty action function?

Yeah I have an empty Action function, but the truth is that I actually dont know any better: I am not a coder and I just started learning this thing. Am I doing it wrong? if so, what would be the correct version of the code above?
 
Last edited:
Not sure if anyone has already mentioned this but if I have LEM running and then I camp onto another toon then the Conditions / Events remain unchanged. It's not a major issue as restarting LEM reloads the correct settings for the toon I have just logged into.
 
you could setup a separate event on the FD failed message to stand back up. if FD failed and you're still high agro this condition would just fire again.

Great idea!

So the chat message being prompted when FD fails is: Your_Name has fallen to the ground.

The problem is that I have multiple necros in my team, so I cannot hardcode the character's name in the "Event Pattern" field. I have tried the following triggers:
#*#${Me.Name} has fallen to the ground#*#
#*#|${Me.Name}| has fallen to the ground#*#

Unfortunately, none is triggering the event. Any idea how to properly inject your character's name into the "Event Pattern" field?

Thanks!
 
Great idea!

So the chat message being prompted when FD fails is: Your_Name has fallen to the ground.

The problem is that I have multiple necros in my team, so I cannot hardcode the character's name in the "Event Pattern" field. I have tried the following triggers:
#*#${Me.Name} has fallen to the ground#*#
#*#|${Me.Name}| has fallen to the ground#*#

Unfortunately, none is triggering the event. Any idea how to properly inject your character's name into the "Event Pattern" field?

Thanks!
Great idea!

So the chat message being prompted when FD fails is: Your_Name has fallen to the ground.

The problem is that I have multiple necros in my team, so I cannot hardcode the character's name in the "Event Pattern" field. I have tried the following triggers:
#*#${Me.Name} has fallen to the ground#*#
#*#|${Me.Name}| has fallen to the ground#*#

Unfortunately, none is triggering the event. Any idea how to properly inject your character's name into the "Event Pattern" field?

Thanks!
Can you capture the chat message, then see if the toon's name is in the message? Sort of like below, a segment from an event lem, where the line variable represents the chat message:

local my_name = mq.TLO.Me.CleanName()

if string.find(line, my_name) then
 
Can you capture the chat message, then see if the toon's name is in the message? Sort of like below, a segment from an event lem, where the line variable represents the chat message:

local my_name = mq.TLO.Me.CleanName()

if string.find(line, my_name) then

Ok I understand, good idea.

However, that only solves the handler function part of the code. I also need to know what message exactly to use as the actual trigger text. The message prompted by EverQuest in the chat box is "Character_Name has fallen to the ground". For example: if your character is named Frodo, the game chat box prompts "Frodo has fallen to the ground". So, I was thinking that typing #*#${Me.Name} has fallen to the ground#*# would have done the trick, but no luck :(
 
I am not sure I follow.

What I am struggling with is what to put in the "Event Pattern" input field at the LEM's UI. The message prompted by EverQuest in the chat box is "Character_Name has fallen to the ground". For example: if your character is named Frodo, the message in the chat box reads "Frodo has fallen to the ground". So, I was thinking that typing #*#${Me.Name} has fallen to the ground#*# would have done the trick, but no luck :(
#1# has fallen to the ground

Lua:
local function event_handler(line, name)
    if name == mq.TLO.Me.CleanName() then

    end
end

if for some reason it picks up some extra letters or something you can also do if name and name.find(mq.TLO.Me.CleanName()) then
 
Quick question: Can LEM pass a global variable between 2 events?

I have created 2 separate Text Events in LEM:
  1. You begin casting #1#. which saves #1# (the spell name) in a global variable.
  2. Your spell fizzles! which is supposed to grab the global variable from the previous event, and re-cast the spell.
Unfortunately, the global variable always prints as "nil" for the second event.

So, my question is: Can LEM actually pass global variables between 2 separate events? if so, how?
 
have the first events handler store that spell value as a variable something like LastSpellCast = arg[1]
and the 2nd event can use that value for the /cast command

this way every time you cast you have the last spell cast's name stored and if you fail you can use that to recast.
 
maybe s
Quick question: Can LEM pass a global variable between 2 events?

I have created 2 separate Text Events in LEM:
  1. You begin casting #1#. which saves #1# (the spell name) in a global variable.
  2. Your spell fizzles! which is supposed to grab the global variable from the previous event, and re-cast the spell.
Unfortunately, the global variable always prints as "nil" for the second event.

So, my question is: Can LEM actually pass global variables between 2 separate events? if so, how?
maybe something like this.

Lua:
local LastSpellCast = nil

mq.event('cast_spell', '#*#You begin casting #1##*#, EventCast)
mq.event('cast_spell_fail', '#*#Your spell fizzles!#*#, EventReCast)

function EventCast(line, spell)
    LastSpellCast = spell
end
function EventReCast(line)
    mq.cmdf("/cast '%s'", LastSpellCast)
end
 
Release (Mighty) Lua Event Manager

Users who are viewing this thread

Back
Top
Cart