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.
 Entire forum ➜ MUSHclient ➜ General ➜ basic help with alias

basic help with alias

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


Posted by Guest1   USA  (256 posts)
Date Thu 07 Feb 2002 12:54 AM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 07 Feb 2002 02:25 AM (UTC)
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

Posted by Guest1   USA  (256 posts)
Date Reply #2 on Thu 07 Feb 2002 04:58 AM (UTC)
Message
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!
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.


10,196 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.