- Joined
- Mar 29, 2016
- Messages
- 688
I just wanna share this. It was known in the past that removing the currently evaluated triggercondition using
This means
This is also true for patch 1.27.x
But in patches past 1.30.4 (I actually only tested patches 1.30.4 and 1.31. Haven't also tested patches in between 1.27 and 1.30.4 so don't exactly know when the change happened), you can safety remove the currently evaluated triggercondition without stopping the next triggerconditions in the list. The same code above would display
It seems that in older patches, calling TriggerRemoveCondition() removes the links (A post by Nestharus says that TCs are structures as a linked-list, or that's how they behave atleast) of that TC immediately. While in the recent patches, calling TriggerRemoveCondition() inside an evaluated trigger removes the links of that TC afterall TCs are the current TC is done being evaluated.
Test Code
In older patches, it displays
while in the recent ones
TriggerRemoveCondition()
/ TriggerClearConditions()
/ DestroyTrigger()
will prevent the next triggerconditions in the trigger from being evaluated.This means
JASS:
globals
trigger array trig
triggercondition array tc
endglobals
function A takes nothing returns nothing
call BJDebugMsg("A")
endfunction
function B takes nothing returns nothing
call BJDebugMsg("B")
call TriggerRemoveCondition(trig[0], tc[2])
endfunction
function C takes nothing returns nothing
call BJDebugMsg("C")
endfunction
function D takes nothing returns nothing
call BJDebugMsg("D")
endfunction
function OnInit takes nothing returns nothing
set trig[0] = CreateTrigger()
set tc[1] = TriggerAddCondition(trig[0], Filter(function A))
set tc[2] = TriggerAddCondition(trig[0], Filter(function B))
set tc[3] = TriggerAddCondition(trig[0], Filter(function C))
set tc[4] = TriggerAddCondition(trig[0], Filter(function D))
call TriggerEvaluate(trig[0])
/*Displays:
A
B
*/
endfunction
But in patches past 1.30.4 (I actually only tested patches 1.30.4 and 1.31. Haven't also tested patches in between 1.27 and 1.30.4 so don't exactly know when the change happened), you can safety remove the currently evaluated triggercondition without stopping the next triggerconditions in the list. The same code above would display
JASS:
A
B
C
D
It seems that in older patches, calling TriggerRemoveCondition() removes the links (A post by Nestharus says that TCs are structures as a linked-list, or that's how they behave atleast) of that TC immediately. While in the recent patches, calling TriggerRemoveCondition() inside an evaluated trigger removes the links of that TC after
Test Code
JASS:
globals
trigger array trig
triggercondition array tc
endglobals
function A takes nothing returns nothing
call BJDebugMsg("A")
endfunction
function B takes nothing returns nothing
call BJDebugMsg("B")
call TriggerRemoveCondition(trig[0], tc[3]) // We remove the next TC
endfunction
function C takes nothing returns nothing
call BJDebugMsg("C")
endfunction
function D takes nothing returns nothing
call BJDebugMsg("D")
endfunction
function OnInit takes nothing returns nothing
set trig[0] = CreateTrigger()
set tc[1] = TriggerAddCondition(trig[0], Filter(function A))
set tc[2] = TriggerAddCondition(trig[0], Filter(function B))
set tc[3] = TriggerAddCondition(trig[0], Filter(function C))
set tc[4] = TriggerAddCondition(trig[0], Filter(function D))
call TriggerEvaluate(trig[0])
endfunction
JASS:
A
B
D
JASS:
A
B
Last edited: