| Message |
OK, an alias to toggle a timer. Make an alias, give it a label, and call a script, eg. toggle_timer. The script would look like this:
sub toggle_timer (thename, theoutput, thewildcards)
dim thestatus
' see if timer enabled at present
thestatus = world.GetTimerInfo ("my_timer", 6)
' if off, turn on
if thestatus = 0 then
World.EnableTimer "my_timer", TRUE
' otherwise, if on, turn off
else
World.EnableTimer "my_timer", FALSE
end if
end sub
The examples given will assume your timer is called "my_timer" however you could make it more general. One way would be to give the alias the name (label) of the timer you want to toggle, and then replace "my_timer" with "thename" (not in quotes) in the script above.
eg.
thestatus = world.GetTimerInfo (thename, 6)
Since "thename" is the name of the alias, you can then use different aliases to toggle different timers, but not have to write lots of different script routines.
It is simpler to simply turn a timer on or off. eg.
sub turn_timer_on (thename, theoutput, thewildcards)
World.EnableTimer "my_timer", TRUE
end sub
sub turn_timer_off (thename, theoutput, thewildcards)
World.EnableTimer "my_timer", FALSE
end sub
Thus you could have two aliases, one calls "turn_timer_on" and the other calls "turn_timer_off".
Now, a trigger to reset all timers ...
sub Reset_Timers (strTriggerName, trig_line, arrWildCards)
world.ResetTimers
end sub
Just make a trigger, give it a label, and call the above script (Reset_Timers).
The easiest one is the last one - to get a timer to send *you* a message. This is straight from the example script file that ships with MUSHclient ...
sub OnTimer (strTimerName)
world.note "Timer has fired!"
end sub
Just make a timer, give it a label, and get it to call the script (OnTimer).
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|