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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
DanteX
Apprentice


Joined: 13 Aug 2007
Posts: 166

PostPosted: Sun Sep 30, 2007 11:21 pm   

[2.04] Waitfor starting multiple threads of the same script
 
Is there any way to make #WAITFOR not start multiples of the same thread? For example:

I have an alias with a #WAITFOR which I use commonly.
Let's say that I execute it, and it comes to the #WAITFOR
Then a game event makes it so that what is supposed happen when I execute it, doesn't happen. There will then of course be a thread waiting for whatever it's supposed to.
If I then correct whatever was causing the #WAITFOR pattern not to show up, and I use the same alias to try to make it happen again (I use the same alias because I'm used to it and cuz it's easy), and the #WAITFOR pattern shows up afterwards. There will then be two treads running and exectuing the same script parallell, which is something that's not allowed to happen.

So can #WAITFOR be made such that it won't start multiple threads of the same script?

D
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Mon Oct 01, 2007 12:47 am   
 
You can either put a timeout on your #WAITFOR, so that the first one will cancel itself after X seconds, or you can use a variable that you set before the #WAITFOR and switch off again afterwards and don't execute the #WAITFOR if it is switched on, or you can use the #SECTION command: see Zugg's posts in http://forums.zuggsoft.com/forums/viewtopic.php?t=27681&postdays=0&postorder=asc&highlight=%23section&start=25

I'm not sure that any of these solutions is actually ideal. What might be useful is to have a FINALLY clause that executes if a #WAITFOR times out - this could be used to switch off the variable again, as otherwise it could get in the wrong state if you were using the variable method in conjunction with the timeout...

In fact, why don't you use the Duration trigger state or whatever? I'm not sure which is most suitable for your case, but take a look at Advanced zMUD Triggers. You should be able to avoid these issues by using trigger states.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Mon Oct 01, 2007 2:07 am   
 
You don't need a duration trigger state - just use a normal multistate trigger with two (or however many) patterns. Then you can manually set the state whenever you like.
_________________
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 » CMUD Beta Forum 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