HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

TriggerExecCount and TriggerEvalCount

10-03-2008, 05:33 AM#1
chobibo
Both of them returns the number of times a trigger is executed, TriggerEvalCount does not return how many times a triggerconditions is ran. I used this script to test it:
Collapse JASS:
scope Test initializer Init

globals
    trigger T=null
    triggeraction TA=null
    triggercondition TC=null
endglobals

private function Conditions takes nothing returns boolean
    call BJDebugMsg(I2S(GetTriggerEvalCount(T)))
    return true
endfunction

private function Display takes nothing returns nothing
    local integer eval=GetTriggerEvalCount(T)
    local integer exec=GetTriggerExecCount(T)
    //call TriggerExecute(T)
    call TriggerEvaluate(T)
    call BJDebugMsg(I2S(eval)+"   :   "+I2S(exec))
endfunction

private function Init takes nothing returns nothing
    local trigger trig=CreateTrigger()

    call TriggerRegisterPlayerEvent(trig, Player(0), EVENT_PLAYER_END_CINEMATIC)
    call TriggerAddAction(trig, function Display)

    set T=CreateTrigger()
    set TC=TriggerAddCondition(T, Condition(function Conditions))
endfunction

Please tell me if it really does work this way, I'm confused because of the function names, I really think EvalCount should return how many times a trigger is evaluated. Thanks for any help and/or comments.
10-03-2008, 05:58 AM#2
DioD
eval shows executions - condition fails.

your condition always pass.
10-03-2008, 08:18 AM#3
Captain Griffen
I do believe eval just returns how many times the event fires - ignoring if the trigger is disabled or not - but I might be wrong, never used it.
10-03-2008, 02:57 PM#4
chobibo

If the trigger was fired by an event (Any kind of event added via TriggerRegisterX), the Evaluation counter is incremented when the boolexpr is ran, else if TriggerEvaluate was called, it will not count as an evaluation, rather it will increment evaluation if TriggerExecute was called. Weird...


@Diod: I tried using a Conditionfunc that returns true or false if X, which is a global integer, X%2==1:=TRUE; else it is false, do note that I didn't bother updating the script above but you may test it to confirm it, when a trigger is fired by a call, it will not increment evaluation by TriggerEvaluate, but it will increment if TriggerExecute was called.
10-03-2008, 04:57 PM#5
Captain Griffen
Quote:
Originally Posted by chobibo
If the trigger was fired by an event (Any kind of event added via TriggerRegisterX), the Evaluation counter is incremented when the boolexpr is ran

So you're disagreeing with:

Quote:
I do believe eval just returns how many times the event fires - ignoring if the trigger is disabled or not - but I might be wrong, never used it.

If so, I hope you tested it, then great, I've learnt something. If not, be more precise.
10-06-2008, 02:47 AM#6
chobibo
I stand corrected, Griffen's post was the correct one, TriggerEvaluate counts how many times the trigger is fired by event, it also counts how many times a TriggerExecute was called. However, it does not count TriggerConditions execution and TriggerEvaluate calls. I'm sorry for the confusion, I'm not just good at analyzing things.

@Captain Griffen: Thanks for doubting man, It made me test it again, also aside from counting events fired, it also counts TriggerExecute calls.