• Hail, we're RedGuides. We want you to play six (yes, 6!) EverQuest characters at once. We have scripts and a friendly community to help, please join our playstyle and say hello! 👋
  • We've added LLM sections to our Terms & Rules and Resource Rules, for everyone's sanity & in-game safety.
    Read more
    a. Do not replace your voice with an LLM. This goes for your posts and your scripts. Drafting and editing with a tool is fine, but don't take you out of what you share.
    b. Do not replace your EQ character's voice with an LLM. We don't want scripts that speak over /ooc, /shout or other public channels. This has been an unwritten rule that's kept casino scripts off the site for decades, but we're now compelled to make it clear: keep automated communication private.

    Why Does RG Review Scripts?
    Nearly every LLM-written Lua script we see is making your character do impossible things, and rarely in a way that's beneficial to you. We've seen heavy server hammering, /target over impossible distances when /nav spawn would passively accomplish the same thing, a spawn search that fires 20+ times per second, and other pointless actions that are likely annoying GMs.

    You are welcome to use LLMs as a tool to structure, draft, and edit your work, but please read critically before hitting /lua run

Question - Understanding delay with conditions

I've got a script (see attached) that I'm attempting to use to make sure I have a good understanding of how I should be using a delay with a condition triggered by an event. Call it a sanity check. As a setup, I have a Cleric character in the tutorial running NextCleric casting Yaulp every time it drops. The issue I'm seeing is the script is stopping as if the condition is met, but the output clearly indicates it isn't met. Where am I going wrong in my thought process here?

eventtest_output.png
yaulp_casting.png
 

Attachments

Assumption is you want the script to break and end when you cast. Removing the mq.delay call inside the delay callback broke out and ended the script as I started casting a spell.

Lua:
local mq = require('mq')

local stop = false

local print_ts = function(msg)
    print('\aw['..mq.TLO.Time()..'] '..msg)
end

local BeginCast = function ()
    print_ts('casting started')
    stop = true
end

mq.event('BeginCasting', "#*#You begin casting#*#", BeginCast)

print_ts('start script')
print_ts(string.format('stop: %s', stop))

local function delay_callback()
    mq.doevents()
    -- mq.delay(50)
    print_ts(string.format('stop (in delay): %s', stop))
    return stop
end

mq.delay(30000, delay_callback)

print_ts(string.format('stop: %s', stop))
print_ts('end script')
 
I'll start with that my initial script didn't have a delay included. That was added to stop zerging the CPU. But without the delay, it still didn't work. You've also moved the code to a declared function rather than an anonymous one. This could be the ultimate culprit, but not one I'm willing to give up.
 
Alright. I'm not sure what I did wrong in the first place (i.e., I distinctly remember putting the delay in there after things didn't work as expected), but yes. Removing the mq.delay gives me the expected behavior. That said, I think I'll keep the Delay library for my own usage. It affords me two benefits. 1) calls mq.doevents on each pulse, and 2) I can control the pulse delay. Is it perfect? Nope. But I don't need perfect.

Thanks for clearing it up for me.
 
Question - Understanding delay with conditions

Users who are viewing this thread

Back
Top
Cart