HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger continues to be evaluated after being disabled

04-02-2008, 05:15 PM#1
grupoapunte
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:

Collapse 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:

Collapse 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
tamisrah
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
Vexorian
No, disabling a trigger is the same as disabling its events.
04-02-2008, 09:59 PM#4
Here-b-Trollz
As in:

Collapse JASS:
if(TriggerEvaluate(trig) and IsTriggerEnabled(trig)then
    call TriggerExecute(trig)
endif
04-02-2008, 10:17 PM#5
Toadcop
Quote:
No, disabling a trigger is the same as disabling its events.
~
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
Vexorian
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
Toadcop
Quote:
And you only need one 0.001 seconds periodic timer to freeze the game.
lol +1 but you missed 1st april xD.

Quote:
Periodical event creates an internal timer
yes this maybe true =) BUT it's a fault from blizz side...
04-02-2008, 11:30 PM#8
Vexorian
Quote:
lol +1 but you missed 1st april xD.
Double check your testing ways.
04-02-2008, 11:39 PM#9
Toadcop
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
grupoapunte
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