| 04-02-2008, 05:15 PM | #1 |
Hey, I been doing some tests and i find out that disabled triggers continue to be evaluated (not executed) for example a periodic trigger is evaluated for each period even if its disabled: JASS:function Trig_Distribute_Gold_Actions takes nothing returns nothing endfunction //=========================================================================== function InitTrig_Distribute_Gold takes nothing returns nothing set gg_trg_Distribute_Gold = CreateTrigger() call DisableTrigger(gg_trg_Distribute_Gold) call TriggerRegisterTimerEventPeriodic(gg_trg_Distribute_Gold, 90.00) call TriggerAddAction(gg_trg_Distribute_Gold, function Trig_Distribute_Gold_Actions) endfunction If you do: JASS:set count = count + GetTriggerEvalCount(gg_trg_Distribute_Gold) The number rises every 90 seconds. Am i doing something wrong? |
| 04-02-2008, 07:53 PM | #2 |
I get the same result (the trigger is evaluated anyhow). So it seems like disabling the trigger is the same as adding a condition, which always returns false (since this gives the same results regarding the trigger evaluation count). I have to say that this is only a guess and I suggest waiting for someone else to say something about it. ^^ |
| 04-02-2008, 08:36 PM | #3 |
No, disabling a trigger is the same as disabling its events. |
| 04-02-2008, 09:59 PM | #4 |
As in: JASS:if(TriggerEvaluate(trig) and IsTriggerEnabled(trig)then call TriggerExecute(trig) endif |
| 04-02-2008, 10:17 PM | #5 | |
Quote:
create 1K of triggers with periodical event (0.001) and disable them =) + ontop imho the new added event "somehow enables the trigger" aka disable trigger after event is added. |
| 04-02-2008, 11:21 PM | #6 |
Periodical event creates an internal timer, duh. And you only need one 0.001 seconds periodic timer to freeze the game. |
| 04-02-2008, 11:26 PM | #7 | ||
Quote:
Quote:
|
| 04-02-2008, 11:30 PM | #8 | |
Quote:
|
| 04-02-2008, 11:39 PM | #9 |
call TimerStart(CreateTimer(),0.001,true,null) ? =) // it can also cal a callback function makes not much difference. ... i have used such period for some stuff not once. and it worked normaly. |
| 04-03-2008, 02:55 AM | #10 |
Well if disabling a trigger disables the event it should be evaluated, the thing is that it is evaluated if you make a periodic event of 1 sec and after 5 seconds of gameplay you check the evaluation count it will give you 5, even if the trigger is disabled, i made other tests with other types of events and they are not evaluated so i guess that the best way to disable a trigger that answers to a periodic event is to simply destroy it and then create it when you need it |
