Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ AddTimer not adding anything

AddTimer not adding anything

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Larkin   (278 posts)  Bio
Date Fri 18 Feb 2005 03:38 PM (UTC)
Message
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!
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #1 on Fri 18 Feb 2005 04:44 PM (UTC)
Message
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.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Larkin   (278 posts)  Bio
Date Reply #2 on Fri 18 Feb 2005 05:09 PM (UTC)
Message
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.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


11,384 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.