Try subtituting this funcion in wait.lua instead
function regexp (regexp, timeout, KeepEval, Seq)
local ke, seq = 0, tonumber(seq) or 100
if KeepEval then ke = trigger_flag.KeepEvaluating end
local id = "wait_trigger_" .. GetUniqueNumber ()
threads [id] = assert (coroutine.running (), "Must be in coroutine")
check (AddTriggerEx (id, regexp,
"-- added by wait.regexp",
trigger_flag.Enabled + trigger_flag.RegularExpression +
trigger_flag.Temporary + trigger_flag.Replace +
trigger_flag.OneShot + ke,
custom_colour.NoChange,
0, "", -- wildcard number, sound file name
"wait.trigger_resume",
12, seq)) -- send to script (in case we have to delete the timer)
-- if timeout specified, also add a timer
if timeout and timeout > 0 then
local hours, minutes, seconds = convert_seconds (timeout)
-- if timer fires, it deletes this trigger
check (AddTimer (id, hours, minutes, seconds,
"DeleteTrigger ('" .. id .. "')",
timer_flag.Enabled + timer_flag.OneShot +
timer_flag.Temporary + timer_flag.ActiveWhenClosed + timer_flag.Replace,
"wait.timer_resume"))
check (SetTimerOption (id, "send_to", "12")) -- send to script
-- if trigger fires, it should delete the timer we just added
check (SetTriggerOption (id, "send", "DeleteTimer ('" .. id .. "')"))
end -- if having a timeout
return coroutine.yield () -- return line, wildcards
end -- function regexp
And then in your plugin...
require "wait"
function defupAlias (a, l, w)
wait.make(function ()
for _,v in ipairs (defining.eqdefs) do
if not defense[v.name] then
SendImmediate(v.command)
wait.match("You have recovered equilibrium.", nil, true, 50)
end --if
end --for
end) --function in wait.make
end -- function for alias to call
|