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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Awsmith
Newbie


Joined: 24 May 2012
Posts: 1
Location: Dixie

PostPosted: Fri May 25, 2012 12:05 am   

Cancelling a bunch of #WAIT DDDDDDD commands?
 
So, if you type in:

#wa 10000;look at pool;#wa 10000;look at pool;#wa 10000;look at spoon;

You would expect to see the command look at spool sent three times, 10 minutes apart, right?

So, while its waiting, you decide that there is no spoon and you want to cancel the series of commands.

How do I go about cancelling? I tried #abort but that did not work.

Help help help help!!!!
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri May 25, 2012 2:52 pm   
 
1. You're not looking at a spool - you are looking at a pool twice and a spoon once. :p
2. You're better off using #ALARM. If it's always the same object, then you can do this:

Code:
#ALARM "PoolLook" 10:00 {#SEND {look at pool}}


and follow it up with:

Code:
#ALIAS poollook {#SWITCH (%1) ("on") {#T+ "PoolLook"} ("off") {#T- "PoolLook'} {#ECHO {You don't make any sense. Use poollook <on|off>}}}


Of course, you can use anything you want for the alias. It'll just turn the alarm on/off when you need it.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri May 25, 2012 3:10 pm   
 
And just to clarify another error in the original posting, the #WAIT is not causing a delay of 10 minutes, but rather 10 seconds. If you actually intended it to repeat every ten seconds rather than every ten minutes, the equivalent #ALARM command would be:
Code:
#ALARM "PoolLook" 10 {#SEND {look at pool}}
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri May 25, 2012 3:27 pm   
 
Also, to give a little more explanation of what is happening in your orginal code, Awsmith:

I will assume that this code is in some trigger or other script you are running. You should avoid running code like that directly on the command line because it will essentially freeze your input until it is finished.

The #WAIT command is causing the entire script to become a separate thread. This means that it will run in the background at the same time that other commands are executing and communication with the mud continues. It is possible to stop such a thread either with code in the script itself (i.e. having the script itself decide whether to continue executing the look), or outside the thread with the #STOP or #SUSPEND commands. These commands would require the thread id. By default the thread id will be some arbitrary number which you could determine by the #THREAD command. Alternatively, you could create a name for the thread within the script itself with the #THREAD command.

As Charneus suggested, you might be best off using #ALARM instead of #WAIT for this script. But if you could tell us a bit more about what you are actually trying to do, we can probably suggest better ways for handling the cancellation.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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