HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Cancelling a running trigger

10-26-2004, 05:07 AM#1
Panto
Greetings.

Neither TriggerClearActions() nor DestroyTrigger() cancel a trigger that's currently running. What does?
10-26-2004, 05:21 AM#2
Guest
Quote:
Originally Posted by Panto
Greetings.

Neither TriggerClearActions() nor DestroyTrigger() cancel a trigger that's currently running. What does?

If you get to a point in a trigger that you just dont want to run the rest of the stuff in it use...

Code:
skip remaining actions

it will just skip everything after it and stop the trigger
10-26-2004, 06:00 AM#3
Panto
I'm talking about cancelling a trigger from outside of itself.
10-26-2004, 06:37 AM#4
Guest
Quote:
Originally Posted by Panto
I'm talking about cancelling a trigger from outside of itself.

You can't stop a trigger while its running midway unless its in a trigger queue then you can remove it from the queue and will stop the trigger is its already running.

I would suggest something like this. At the start of each trigger add it to a trigger queue and then remove it from the queue at the end. If you need to you can remove the trigger from the queue from another trigger making it stop even if its running.
10-26-2004, 10:55 AM#5
th15
I suppose you could have a global boolean variable to check if the trigger should run, but if you have a lot of trigger that'd be difficult to implement.

I don't know about trigger queues though, to my knowledge you can't queue up a trigger for any specified duration; it just runs once your processor is free.
10-26-2004, 12:29 PM#6
Anitarf
A way (maybe the only way, but probably not) would be to put some if-then-elses into the trigger that skip remaining actions if a certain boolean is true (so, you can set that boolean outside the trigger). Messy.
10-26-2004, 01:14 PM#7
AFB-DieHard
Yeah I've done this by checking a global bool-var in the running trigger.
10-26-2004, 03:03 PM#8
Panto
Indeed, that's how Blizzard does it. weaaddar once suggested that an alternative was possible, though I haven't been able to get anything to work in that regard.

I'm not entirely sure what the difference here is between running a trigger and queueing it.
10-26-2004, 03:40 PM#9
Anitarf
Yes, here is the thread where weaaddar speaks of this.
10-26-2004, 08:23 PM#10
Panto
Thank you. I originally saw it on the b.net forums, and didn't realize that he also posted it here.