basic help with alias

Posted by Guest1 on Thu 07 Feb 2002 12:54 AM — 3 posts, 13,836 views.

USA #0
Just need some basic help here..
wanting help with several things -

(i) an alias to either toggle a specified timer on/off, or 2 separate alias' to enable a specified timer and disable a specified timer.

(ii) also a trigger that resets all the timers.

(iii) when the timer activates, can it send a message not to the MUD, but just display the message to me?

These are for interval timers obviously, just not sure how to get the commands right to make it happen... your help is appreciated.
Australia Forum Administrator #1
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).
USA #2
That is exactly what I needed to know :) Thankyou very much! Group tick timer and solo tick timer working great, and a shiny new afk script as well.

Now for the next mission.. a tank whiner.. heh

Thanks again!