[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  basic help with alias

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

basic help with alias

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Demonsurfer   USA  (256 posts)  [Biography] bio
Date Thu 07 Feb 2002 12:54 AM (UTC)  quote  ]
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.
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Thu 07 Feb 2002 02:25 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Demonsurfer   USA  (256 posts)  [Biography] bio
Date Reply #2 on Thu 07 Feb 2002 04:58 AM (UTC)  quote  ]
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!
[Go to top] 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.


1,148 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]