I cant see anything, it just seems to be sending 2 steps at once? or something bizarre like that.
here is the script.
sendQueueTable = sendQueueTable or {}
function sendQueue(...)
local id
if arg.n == 1 and type(arg[1]) == "table" then --Create a new queue
echo("Setting up a new queue.\n")
id = #sendQueueTable + 1
sendQueueTable[id] = {q=arg[1]}
elseif arg.n == 2 and sendQueueTable[arg[1]] then
id = arg[1]
if arg[2] == "abort" then
echo("Aborting this queue.\n")
table.remove(sendQueueTable, id)
return id
elseif arg[2] == "pause" then
echo("Pausing this queue.\n")
sendQueueTable[id].paused = true
return id
elseif arg[2] == "continue" then
echo("Continuing this queue.\n")
sendQueueTable[id].paused = false
elseif arg[2] == "next" then
if sendQueueTable[id].paused then
echo("Paused. Doing nothing.\n")
return false
else
echo("Executing next queue item.\n")
end
else
return false
end
elseif type(arg[1]) == "string" then --check if this event matches any current queues
for i,v in ipairs(sendQueueTable) do
if v.waitingfor == arg[1] then
sendQueue(i, "next")
end
end
else
return false
end
if sendQueueTable[id].trigger then killTrigger(sendQueueTable[id].trigger) end
if sendQueueTable[id].timer then killTimer(sendQueueTable[id].timer) end
if #sendQueueTable[id].q > 0 then --still have things in the queue
expandAlias(sendQueueTable[id].q[1]) --execute the current action
table.remove(sendQueueTable[id].q, 1) --remove the action from the queue
if #sendQueueTable[id].q > 0 then --if I still have more things to do
if type(sendQueueTable[id].q[1]) == "number" then --next condition is a timeout
if sendQueueTable[id].q[1]>0 then
echo("Waiting "..sendQueueTable[id].q[1].." seconds.\n")
sendQueueTable[id].timer = tempTimer(sendQueueTable[id].q[1], [[sendQueue(]]..id..[[, "next")]])
table.remove(sendQueueTable[id].q, 1)
else
table.remove(sendQueueTable[id].q, 1)
sendQueue(id, "next")
end
elseif type(sendQueueTable[id].q[1]) == "table" then --next condition is a trigger
echo("Waiting for regex pattern: "..sendQueueTable[id].q[1][1].."\n")
sendQueueTable[id].trigger = tempRegexTrigger(sendQueueTable[id].q[1][1], [[sendQueue(]]..id..[[, "next")]])
table.remove(sendQueueTable[id].q, 1)
elseif type(sendQueueTable[id].q[1]) == "string" then --next condition is an event
echo("Waiting for event: "..sendQueueTable[id].q[1]..".\n")
sendQueueTable[id].waitingfor = sendQueueTable[id].q[1]
table.remove(sendQueueTable[id].q, 1)
else
echo("Unknown condition: Executing next action immediately.\n")
table.remove(sendQueueTable[id].q, 1)
sendQueue(id, "next")
end
else
echo("Queue completed.\n")
table.remove(sendQueueTable, id)
end
end
return id
end
it works perfectly fine on my windows machine.. and no double up on folder/files
any help would be great!
Regards.