HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

a lame way to disable an event

04-10-2009, 10:01 PM#1
Troll-Brain
Like you know there is no function TriggerRemoveEvent, even if all TriggerRegister... returns an event.
The only way is to destroy/recreate the trigger with all events, conditions and actions without the specific event, so you need to handle all these things

I've discovered a lame way to disable, (not destroy an event).
But it will work only if there is a boolexpr argument to the function TriggerRegister...

Expand JASS:

Maybe someone will find it a little usefull on specific cases.
04-10-2009, 11:59 PM#2
Blackroot
Have you tried swapping boolexpr's to see if it works correctly with the new filter?
04-11-2009, 12:08 AM#3
Troll-Brain
Quote:
Originally Posted by Blackroot
Have you tried swapping boolexpr's to see if it works correctly with the new filter?
You can't swap them.
"Or" and "And" create a new boolexpr each time they are called. You can only destroy the boolexpr specified in the registered event.
If you directly use "Filter" or "Condition" then you don't create a new boolexpr if you had already created it, or destroyed the previous one.

EDIT :

You want mean that ?
Collapse JASS:
set B1 = Or(null,Filter(function True))
Yes it works, but it is useless.

EDIT :
You can also use that, if you don't want to code in the boolexpr, which should be avoided anyway.

Collapse JASS:
set B1 = Not(Or(null,null))
04-11-2009, 04:42 PM#4
Troll-Brain
Unfortunately GetTriggeringTrigger() and GetTriggerEventId() don't work in a such boolexpr, so there is no way to link the event with a global boolean variable, unless you create one function (Filter(function ...)) and one boolean variable for each boolexpr argument ...

If these worked, we could easily make a system that can manage the activation and deactivation of the events.

In conclusion, just forget it
04-19-2009, 07:34 PM#5
SerraAvenger
Quote:
Originally Posted by Troll-Brain
Unfortunately GetTriggeringTrigger() and GetTriggerEventId() don't work in a such boolexpr, so there is no way to link the event with a global boolean variable, unless you create one function (Filter(function ...)) and one boolean variable for each boolexpr argument ...

If these worked, we could easily make a system that can manage the activation and deactivation of the events.

In conclusion, just forget it


Create a linked list with disabled eventids and attach it to the trigger

use TriggerAddCondition() to check whether the eventid was any of the disabled ones and return false if yes?
04-19-2009, 10:23 PM#6
Troll-Brain
It would work only if there are not the same type of events in a same trigger.
And also, much more lame, the others trigger conditions will be evaluated.