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
ballin
Newbie


Joined: 03 Apr 2010
Posts: 7

PostPosted: Tue Apr 06, 2010 7:44 am   

zmud #wait question
 
When using the #wait command is there another command that will cancel it within a script so that it doesn't continue in an endless loop situation?
If not, what other pausing command can I use and what is its cancel command?

along the lines of

1. look for trigger
2. fire off a command
3. wait x seconds
4. look for another trigger and if received then stop the waiting/loop
5. If the second trigger isn't received, fire off first command (repeat until second trigger is received).
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Apr 06, 2010 6:04 pm   
 
Check out multistate triggers.
_________________
EDIT: I didn't like my old signature
Reply with quote
ballin
Newbie


Joined: 03 Apr 2010
Posts: 7

PostPosted: Thu Apr 08, 2010 4:28 am   
 
ok, thats pretty much as useful as saying RTFM.

I have looked through the various "help" files and obviously , Im still confused.

Im using the 7.21 zmud and I have to say that the help files arent that helpful to someone new to programming in general ( doesnt help that the pictures included are obviously from earlier versions of zmud that I have no experience with).


I've looked everywhere I could think too, and it seems my only semi-answer would be that I need to set a class for my script then disable the class with another trigger - that seems unwieldy. Is there a better way to just stop the looping alarm?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Apr 08, 2010 5:46 am   
 
Better examples will bring better solutions. To clarify your search regarding my previous statement, check out #TRIGGER, Trigger Options, #CONDITION, and whatever related helps those three might link to that I haven't mentioned.
_________________
EDIT: I didn't like my old signature
Reply with quote
myddrun
Wanderer


Joined: 31 Mar 2005
Posts: 58

PostPosted: Fri Apr 09, 2010 12:12 pm   
 
You might also have a look at #Temp, #Alarm & #Untrigger

If I understand it you send a command to the mud and wait for trigger1. When trigger1 is received you want to wait for trigger2 to do something. If there is no trigger 2 repeat the procedure.


Ok so this is going to be clumsy as I have no way to test it here but......
You send your command to the mud and wait for pattern1.

Pattern1 is received and this trigger is always on.

Code:
#trigger {pattern1} {
         #var SecondPatternRecieved 0
         #temp {pattern2} {#var SecondPatternRecieved 1; your second set of commands}
         #alarm +20 {#untrigger pattern2; #if (SecondPatternRecieved = 0) {retry your initial command}}}


When it triggers it does several things.

1) Sets a variable to 0
2) Sets up a temporary trigger to fire on your second pattern. When a #temp trigger fires on a pattern match it gets removed automatically.
3) Sets an alarm to delete the temporary trigger after 20 seconds if it's still there. The alarm also tests to see if number 2 has fired.

If the temporary pattern is recieved before it gets deleted it sets the variable to 1 to block the loop via the #If test and fires your second set of commands.

#wait is not very useful. While you are waiting you can't do anything else as it's a OS driven pause as I understand it. While the #alarm is counting down you can do stuff in the mean time.

Giving your trigger pattern1 a unique name will allow you to use #T- and #T+ to enable/disable in the usual manner
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