|
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: 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 |
|
|
|
Seb Wizard
Joined: 14 Aug 2004 Posts: 1269
|
Posted: 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. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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.
|
|
|
|
|
|