AddTimer not adding anything

Posted by Larkin on Fri 18 Feb 2005 03:38 PM — 3 posts, 14,976 views.

#0
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!
USA #1
You can't have a subroutine that has a colon in it. So your timer isn't being created because it's an invalid script name.

And timers only send one argument (the timer name), since theres no line, or wildcards.
#2
Thanks. I think it was the parameters not matching up that got me. If it's mentioned in the documentation, I simply overlooked it. Too bad I can't call a table function. That I can live with, though.