Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
chelleNYC
Newbie


Joined: 29 May 2008
Posts: 5
Location: nyc

PostPosted: Thu May 29, 2008 9:21 pm   

how to trigger a 30 second timer to send a command...
 
Hello all! How do I set up a trigger to start a 30 second timer, then to send a command?

Thanks in advance.
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Thu May 29, 2008 9:29 pm   
 
Code:

#alarm "30second_timer" {*30} {do command}


This makes a named alarm called 30second_timer which activates after every 30 seconds and does the command. Once done it 'does the command' again after another 30 seconds have past. You can disable it by #t- 30second_timer and enable it by #t+ 30second_timer.


Prog
_________________
The Proud new owner of CMud.

--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
--------------------------------
Reply with quote
chelleNYC
Newbie


Joined: 29 May 2008
Posts: 5
Location: nyc

PostPosted: Thu May 29, 2008 10:35 pm   
 
i truly appreciate it. how can i modify the trigger so that it only sends the command once?
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Thu May 29, 2008 10:44 pm   
 
You mean send it once after 30 seconds and then never again until you re-enable it?

Just add the #t- 30second_timer at the end of command part.

Code:

#alarm "30second_timer" {*30} {do command;#t- 30second_timer}


You can make an alias respectively which turns the alarm on whenever you'd need it again.

Code:

#alias alarmOn {#t+ 30second_timer}
_________________
The Proud new owner of CMud.

--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
--------------------------------
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Fri May 30, 2008 12:22 am   
 
If you want to make a one-off timer, that is, a timer that only fires onces and then vanishes.

Code:
#ALARM a30second_timer {+30} {#echo this is a one-off timer}


The ID, if one is entered, should start with a letter to ensure ZMUD doesn't confuse it for the timer pattern, a la a30second_timer
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri May 30, 2008 5:12 am   
 
See also #alarm. If you've found the #wait command, I'll say right now that the only time you should use it is to slow down a loop, like:

#loop 50 {dance;#wait 5000}

The #wait command in zMUD can cause problems if you use it in triggers or aliases. You should use #alarm instead.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
PsyberMind
Newbie


Joined: 20 Jun 2008
Posts: 1

PostPosted: Fri Jun 20, 2008 12:54 am   
 
Could something like this be utilized in a status window? For example.. I have a command I want to send every 5 seconds or so that updates my sensor reports (TrekMUSH)
Now I know I can do this as a simple trigger, but it would clutter up my display. It would be more efficient to put it into a Status Window I could have docked somewhere.
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Fri Jun 20, 2008 1:28 am   
 
You can of course send the output to another window. Using :windowname:cmd
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri Jun 20, 2008 10:50 am   
 
And you can display a variable in the status window that you update with a new value to be displayed whenever you like. Just use an alarm to change the variable.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net