Great! It cleaned up a bunch of my logic, plus showed me how to do some other things also.
this one is my load rgmercs button, if its a raid it will assign the tanks to Outside Assist in order you wish them to tank as a fallover when one dies.
click will stop if its running or start for all staggered by some time each.
the label changes if script is running or not.
[CODE title="btn label"]return (mq.TLO.
Lua.Script('rgmercs').Status.Equal('RUNNING')() and 2835 or 3485), 'Item'[/CODE]
[CODE title="load rgmercs"]
--
Lua
local ChatCmd = '/dex' -- default is /dex for dannet
local ChatChan = '/dgt' -- chat channel to use default is /dgt for dannet
local ScriptName = 'rgmercs'
local command = string.format("/
Lua parse return mq.TLO.
Lua.Script('%s').Status.Equal('RUNNING')() == false and", ScriptName)
command = string.format("%s mq.cmd('/multiline ; /
Lua run %s')", command, ScriptName)
local raidSize = mq.TLO.Raid.Members() or 0
local raidTabk = mq.TLO.Me.Name()
local IsRunning = mq.TLO.
Lua.Script(ScriptName).Status() == 'RUNNING'
if raidSize == 0 then
if IsRunning then
mq.cmdf('/dgr /lstop %s', ScriptName)
mq.cmdf('/lstop %s', ScriptName)
else
for i = 1, mq.TLO.Me.GroupSize() - 1 do
mq.cmdf('/timed %s /dex %s /lrun %s mini', (i * 10), mq.TLO.Group.Member(i).DisplayName(), ScriptName)
end
mq.cmdf('/lrun %s mini', ScriptName)
end
else
if IsRunning then
mq.cmdf('/dgr /lstop %s', ScriptName)
mq.cmdf('/lstop %s', ScriptName)
else
for i = 1, raidSize do
if mq.TLO.Raid.Member(i).CleanName() ~= mq.TLO.Me.CleanName() then
mq.cmdf('/timed %s /dex %s /lrun %s mini', (i * 10), mq.TLO.Raid.Member(i).CleanName(), ScriptName)
else
-- if it's me then just run the script immediately
mq.cmdf('/lrun %s mini', ScriptName)
end
end
-- local dly = raidSize * 15
--
-- mq.cmdf("/timed %s /dgr /multiline ; /rgl setma %s; /timed %s /rgl chaseoff; /timed %s /rgl chaseon", dly, raidTabk, 10, 15)
-- mq.cmdf("/timed %s /rgl clearoa", dly + 10)
-- RAID SETUP
local myName = mq.TLO.Me.CleanName():lower()
local delay = raidSize * 15
-- enter tanks in order you wish them to be in first slot will always default to the caller of the script (lowercase names as thats what RGMercs uses)
local tankList = {
[1] = { Name = 'maintank', Enabled = true, },
[2] = { Name = '2ndtank', Enabled = true, },
[3] = { Name = '3rdtank', Enabled = true, },
}
local cmd = string.format("/timed %s /dgr /multiline ; /rgl clearoa; /timed %s /rgl setma %s", delay, delay + 5, myName)
delay = delay + 10 -- set to at least 5 more than the last delay before the table iterations
cmd = string.format("%s; /timed %s /rgl chaseoff; /timed %s /rgl chaseon; /timed %s /rgl addoa %s", cmd, delay, delay + 3, delay + 5, myName)
delay = delay + 10 -- set to at least 5 more than the last delay before the table iterations
for _, data in ipairs(tankList or {}) do
if data.Enabled then
cmd = string.format("%s; /timed %d /rgl addoa %s", cmd, delay, data.Name)
delay = delay + 5
end
end
mq.cmd(cmd)
end
end[/CODE]