• 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 - LUA Help #1

Joined
Mar 27, 2018
RedCents
94¢
Hey all,

I'm trying to troubleshoot this little Lua helper I'm trying to write and need a set of fresh eyes to double-check me, if anyone would be so kind:

Code:
local mq = require('mq')

local XClear = function() --naming the function to be called later.
    for i = 1, mq.TLO.Me.XTargetSlots() do --finding how many loops to iterate through
        if mq.TLO.Me.XTarget(i)() ~= nil then --if something is on xtarget, clears it.
            mq.cmdf('/xtar set %d autohater', i) --passes value of i into the command "/xtar set # autohater"
            mq.delay(10) -- waits 1s
            if mq.TLO.Me.XTarget(i)() == nil then break end --this should break out of the loop and wait 10 more seconds?
        end
    end
end   

while true do --while true... what would cause this to be false?
    mq.delay(100) -- delays 10s then...
    XClear() -- ...calls XClear function
end
 
Code:
-- change this 
local XClear = function() 
  -- body
end

-- to this
local function xclear()
  -- body
end

-- mq.delay(10) is 10ms, use mq.delay(1000) or mq.delay('1s')
-- mq.delay(100) is 100ms, use mq.delay('10s')

Other than that, what are the issues?
 
It was ending immediately, but I think I had a mistake in the section if mq.TLO.Me.XTarget(i)() == nil then break end . I'm just below novice in this language so thank you for checking for me.
 
Question - LUA Help #1

Users who are viewing this thread

Back
Top
Cart