I'm trying to make a system whereby flags will reset themselves when commands fail. If the command succeeds, I want to delete the timer before it fires. My problem, however, is that the timer isn't created when I put something in the Script parameter field. I've tried varying the other parameters to see if it has any effect, but the only thing that allows me to successfully add the timer is to null out the Script parameter.
I'm using Lua for this and here's basically what I want to do:
function Balances:flag(key, val)
self.flags[key] = val
Note("Flag " .. tostring(key) .. " set to " .. tostring(val))
AddTimer("resetflag_" .. key, 0, 0, 2, "", timer_flag.Enabled + timer_flag.OneShot + timer_flag.Replace + timer_flag.Temporary, "Balances:resetflag")
end
function Balances:resetflag(a, b, c)
Note("Timer fired to reset a flag")
end
Then, I have an alias for when I try to do a certain action and set the flag to true. When the action succeeds, I have a trigger to delete the named timer for the flag and set another flag for my balance.
Can anyone point out something I should be doing differently?
(I've tried using a global function instead of the class/table function. I've also tried putting a 'dummy' command in the 'Send to world' parameter. Neither have worked for me.)
Thanks! |