• 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

Question - Run Away Emote Assistance

Shankyas12

Member
Joined
Jan 2, 2017
RedCents
110¢
Hi Guys,

I am just starting to script and write in Lua. I have been basically trying different ones you all have posted and then changing the script to meet my custom needs. I have really enjoyed all of them and learning how to do this. I am currently attempting to make a run away emote through Lua and honestly im stumped on how to do it properly. Basically what i would want is the character to react to an emote that happens then run to 4 different locations. I honestly do not know how to start the command off because what i currently am doing wont even keep the script up it keeps failing immediately. I am sure it's something super obvious but i am just missing some information. This is what i have so far that defiantly is not working. I pulled this from one of the Lua scripts i saw then input some information for the event that i want to do. Any assistance would be helpful. If you could just point me on a path that would also be great. Thank you all in advanced.

Lua:
local mq = require("mq")


if ##Insects begin to swarm. They seem to be drawn to #1###
do

    if not mq.TLO.Zone.ShortName() == 'Zelnithak_Raid' then return end

    local my_class = mq.TLO.Me.Class.ShortName()
    local i_am_ma = mq.TLO.Group.Member(0).MainAssist()
    local my_name = mq.TLO.Me.CleanName()
    local ma_name = mq.TLO.Group.MainAssist.CleanName()

    -- Run away if I am the target and I am not the MA, or if the MA is the target and I am not the MA
    if not i_am_ma and (target == my_name or target == ma_name) then
        mq.cmdf('/%s mode 0', my_class) -- pause CWTN and other sorts of automation
        if my_class == 'BER' and mq.TLO.Me.ActiveDisc.Name() == mq.TLO.Spell('Frenzied Resolve Discipline').RankName() then
            mq.cmd('/stopdisc') -- Stop BER disc that roots you in place so you can run if you are a BER
        end
        mq.cmd('/nav locyxz -717, -589, -31')
        mq.delay(100)
        mq.cmd('/nav locyxz -581, -354, -48')
        mq.delay(100)
        mq.cmd('/nav locyxz -581, -136, -51')
        mq.delay(100)
    mq.cmd('/nav locyxz -777, -143, -16')
        mq.delay(100)
        mq.cmd('/nav locyxz -892, -407, -32')
    mq.delay(100)
    mq.cmd('/nav locyxz -871, -604, -34')
    mq.delay(100)
        mq.cmd('/mqp off')
        mq.cmd('/twist on')
    end
end
-Shankyas
 
Last edited by a moderator:
Do like:

Code:
mq.cmd('/nav locyxz -717, -589, -31')
while mq.TLO.Navigation.Active() do
       mq.delay(100)
end

Repeat above for each location :)

You might concider to use mq.event()
Code:
mq.event('RunAwayOrSomething', '#*#Insects begin to swarm around you#*#', RunSafeSpots)
local function RunSafeSpots()
    mq.cmd('/nav locyxz -717, -589, -31')
    while mq.TLO.Navigation.Active() do
       mq.delay(100)
    end
end

while true do
  mq.doevents()
  mq.delay(200)
end
 
Last edited:
If you check out LEM it provides a lot of the generic event registration, looping and stuff for you so that you can just write the commands to execute for the event. https://www.redguides.com/community/resources/mighty-lua-event-manager.2539/

so you would only have to fill in this part pretty much:
Lua:
    local my_class = mq.TLO.Me.Class.ShortName()
    local i_am_ma = mq.TLO.Group.Member(0).MainAssist()
    local my_name = mq.TLO.Me.CleanName()
    local ma_name = mq.TLO.Group.MainAssist.CleanName()

    -- Run away if I am the target and I am not the MA, or if the MA is the target and I am not the MA
    if not i_am_ma and (target == my_name or target == ma_name) then
        mq.cmdf('/%s mode 0', my_class) -- pause CWTN and other sorts of automation
        if my_class == 'BER' and mq.TLO.Me.ActiveDisc.Name() == mq.TLO.Spell('Frenzied Resolve Discipline').RankName() then
            mq.cmd('/stopdisc') -- Stop BER disc that roots you in place so you can run if you are a BER
        end
        mq.cmd('/nav locyxz -717, -589, -31')
        mq.delay(100)
        mq.cmd('/nav locyxz -581, -354, -48')
        mq.delay(100)
        mq.cmd('/nav locyxz -581, -136, -51')
        mq.delay(100)
    mq.cmd('/nav locyxz -777, -143, -16')
        mq.delay(100)
        mq.cmd('/nav locyxz -892, -407, -32')
    mq.delay(100)
    mq.cmd('/nav locyxz -871, -604, -34')
    mq.delay(100)
        mq.cmd('/mqp off')
        mq.cmd('/twist on')
    end

But also,

if ##Insects begin to swarm. They seem to be drawn to #1###

Isn't any sort of valid Lua. You would need to register an event, and loop and call doevents.

Edit: Unlike blasty i didn't read any of the series of commands you have inside the event handling. Agree with what was said, use a loop on navigating or something instead of a series of separate nav commands like that.
 
Lua:
local function event_handler(line, name)

end

mq.event('myevent', '#*#Insects begin to swarm. They seem to be drawn to #1##*#', event_handler)

while true do
  mq.doevents()
  mq.delay(1000)
end

The pieces you're missing for your standalone Lua would be something along the lines of this
 
Thank you both very much. This is what i changed the Lua too. However i am getting a different error. It says "attempt to index global 'mq' (a nil value). Am i missing something simple or do i have to write something else in there?

local function event_handler(line, name)

end

mq.event('myevent', '##Insects begin to swarm. They seem to be drawn to #1###', event_handler)

while true do
mq.doevents()
mq.delay(1000)
end

local my_class = mq.TLO.Me.Class.ShortName()
local i_am_ma = mq.TLO.Group.Member(0).MainAssist()
local my_name = mq.TLO.Me.CleanName()
local ma_name = mq.TLO.Group.MainAssist.CleanName()

-- Run away if I am the target and I am not the MA, or if the MA is the target and I am not the MA
if not i_am_ma and (target == my_name or target == ma_name) then
mq.cmdf('/%s mode 0', my_class) -- pause CWTN and other sorts of automation
if my_class == 'BER' and mq.TLO.Me.ActiveDisc.Name() == mq.TLO.Spell('Frenzied Resolve Discipline').RankName() then
mq.cmd('/stopdisc') -- Stop BER disc that roots you in place so you can run if you are a BER
end
mq.cmd('/mqp on')
mq.cmd('/nav locyxz -717, -589, -31')
mq.delay(100)
mq.cmd('/nav locyxz -581, -354, -48')
mq.delay(100)
mq.cmd('/nav locyxz -581, -136, -51')
mq.delay(100)
mq.cmd('/nav locyxz -777, -143, -16')
mq.delay(100)
mq.cmd('/nav locyxz -892, -407, -32')
mq.delay(100)
mq.cmd('/nav locyxz -871, -604, -34')
mq.delay(100)
mq.cmd('/mqp off')
mq.cmd('/twist on')
end


-Shankyas
 
local mq = require("mq")
Do you still have this line in the Lua?

Also:

mq.cmd('/mqp on')
mq.cmd('/nav locyxz -717, -589, -31')
mq.delay(100)
mq.cmd('/nav locyxz -581, -354, -48')
mq.delay(100)
mq.cmd('/nav locyxz -581, -136, -51')
mq.delay(100)
mq.cmd('/nav locyxz -777, -143, -16')
mq.delay(100)
mq.cmd('/nav locyxz -892, -407, -32')
mq.delay(100)
mq.cmd('/nav locyxz -871, -604, -34')
mq.delay(100)

I think you need to re-read what blasty and aquietone have said.

If you follow this code what it will do is
1. Pause your currently running macro (Consider using mq2boxr and using the better command /boxr pause)
2. It issues the command for your toon to Start Running to the nav point
3. A Delay of just 100 ms (Your toon has only moved about 5 steps at this stage)
4. It issues the command for your toon to Start Running to the next nav point. Your toon will change direction immediately and take another 5 steps
5. And repeat. Never really moving very far at all

What you will end up with is "The Jitterbug" type of movement.
This why Blasty wrote his piece of code.

Start running... and while Navigation Active then delay 100 ms (ie do nothing for 100 ms while still running)

Code:
mq.cmd('/nav locyxz -717, -589, -31')
while mq.TLO.Navigation.Active() do
       mq.delay(100)
end
 
Last edited:
For my luas I created 2 Functions for pause and resume:

[CODE title="Function pause and resume"]local function StopDPS()
mq.cmd('/squelch /mqp on')
mq.delay(10)
if mq.TLO.Me.Class.ShortName() == 'BRD' then
mq.cmd('/squelch /twist off')
mq.delay(10)
mq.cmd('/squelch /stopsong')
mq.delay(10)
end
mq.cmd('/attack off')
mq.delay(10)
mq.cmd('/squelch /boxr pause')
mq.delay(10)
while mq.TLO.Me.Casting.ID() do
mq.delay(200)
end
end
local function ResumeDPS()
mq.cmd('/squelch /mqp off')
mq.delay(10)
if mq.TLO.Me.Class.ShortName() == 'BRD' then
mq.cmd('/squelch /twist on')
mq.delay(10)
end
mq.cmd('/squelch /boxr unpause')
mq.delay(10)
end[/CODE]

Which I call whenever I want someone to do something in mid fight.
Those call the pause and resume for kissassist as well as mq2boxr, so cover serveral automation tools.
The bard, if char is a bard, get's special treatment.
Those do well for my needs.
 
Those call the pause and resume for kissassist as well as mq2boxr, so cover serveral automation tools.
The bard, if char is a bard, get's special treatment.

I think Boxr should allow these functions to be briefer.

/boxr pause will pause kissassist for you, so you should not need to do both /mqp on and /boxr pause (and same thing with /mqp off and /boxr unpause).

/boxr pause will also do /twist off if the character is a bard, and the automation is a macro that uses MQ2Twist. In turn, MQ2Twist will do /stopsong when twisting is stopped. I will point out that /boxr unpause does not turn twisting on again, but rather leaves that up to the macro.

Also, consider moving the /attack off to after the /boxr pause command, or there is a risk that the automation has already turned it on again before the pause happens.

I think something like this should do the job:

Lua:
local function StopDPS()
    mq.cmd('/squelch /boxr pause')
    mq.cmd('/attack off')
    while mq.TLO.Me.Casting.ID() do
       mq.delay(200)
    end
end

local function ResumeDPS()
   mq.cmd('/squelch /boxr unpause')
end
 
I think Boxr should allow these functions to be briefer.

/boxr pause will pause kissassist for you, so you should not need to do both /mqp on and /boxr pause (and same thing with /mqp off and /boxr unpause).

/boxr pause will also do /twist off if the character is a bard, and the automation is a macro that uses MQ2Twist. In turn, MQ2Twist will do /stopsong when twisting is stopped. I will point out that /boxr unpause does not turn twisting on again, but rather leaves that up to the macro.

Also, consider moving the /attack off to after the /boxr pause command, or there is a risk that the automation has already turned it on again before the pause happens.

I think something like this should do the job:

Lua:
local function StopDPS()
    mq.cmd('/squelch /boxr pause')
    mq.cmd('/attack off')
    while mq.TLO.Me.Casting.ID() do
       mq.delay(200)
    end
end

local function ResumeDPS()
   mq.cmd('/squelch /boxr unpause')
end

(I do wish there was a way to turn on/off auto squelch for mq.cmd)

The only changes I would make to your adjustment is (ResumeDPS is elided for brevity)

Lua:
local function StopDPS()
    mq.cmd('/squelch /boxr pause')
    if (mq.TLO.Me.Combat()) then
        mq.cmd('/squelch /attack off')
    end
    while mq.TLO.Me.Casting.ID() do
       mq.delay(200)
    end
end
 
Question - Run Away Emote Assistance

Users who are viewing this thread

Back
Top
Cart