I've come across a weird phenomenon.
When comparing animationState as a condition it will return FALSE even though in ACTUAL FACT should/must be TRUE.
The same code applied to a player works just fine.
I've come across a weird phenomenon.
When comparing animationState as a condition it will return FALSE even though in ACTUAL FACT should/must be TRUE.
The same code applied to a player works just fine.
_anims = [
"ainvpknlmstpsnonwrfldnon_ainvpknlmstpsnonwrfldnon_medic",
"AinvPknlMstpSnonWrflDnon_medic0s",
"AinvPknlMstpSnonWrflDnon_medic",
"AinvPknlMstpSnonWrflDnon_medic0",
"AinvPknlMstpSnonWrflDnon_medic1",
"AinvPknlMstpSnonWrflDnon_medic2",
"AinvPknlMstpSnonWrflDnon_medic3",
"AinvPknlMstpSnonWrflDnon_medic4",
"AinvPknlMstpSnonWrflDnon_medic5",
"AinvPknlMstpSnonWrflDnon_medicend"
];
sleep 1;
test_unit playActionNow "medicStart";
sleep 1;
_anim = (animationState test_unit);
hint format["%1 (%2)", (_anim in _anims), _anim];
diag_log text format["%1 (%2)", (_anim in _anims), _anim];
while {(_anim in _anims)} do {
_anim = (animationState test_unit);
hint format["%1 (%2)", (_anim in _anims), _anim];
diag_log text format["%1 (%2)", (_anim in _anims), _anim];
sleep 1;
};
true (ainvpknlmstpsnonwrfldnon_ainvpknlmstpsnonwrfldnon_medic)
true (ainvpknlmstpsnonwrfldnon_ainvpknlmstpsnonwrfldnon_medic)
false (ainvpknlmstpsnonwrfldnon_medic0s) <-- FALSE - EVEN THOUGH THIS IS INSIDE THE _anims ARRAY
Same is true for direct comparison like:
if ((animationState test_unit) != "ainvpknlmstpsnonwrfldnon_ainvpknlmstpsnonwrfldnon_medic"
&&
(animationState test_unit) != "AinvPknlMstpSnonWrflDnon_medic0s"
&&
(animationState test_unit) != "AinvPknlMstpSnonWrflDnon_medic"
&&
(animationState test_unit) != "AinvPknlMstpSnonWrflDnon_medic0"
&&
(animationState test_unit) != "AinvPknlMstpSnonWrflDnon_medic1"
&&
(animationState test_unit) != "AinvPknlMstpSnonWrflDnon_medic2"
&&
(animationState test_unit) != "AinvPknlMstpSnonWrflDnon_medic3"
&&
(animationState test_unit) != "AinvPknlMstpSnonWrflDnon_medic4"
&&
(animationState test_unit) != "AinvPknlMstpSnonWrflDnon_medic4"
&&
(animationState test_unit) != "AinvPknlMstpSnonWrflDnon_medicend") then {};
Condition will be FALSE although is should/must be TRUE.
WTF.
Please note what the documentation for the <i>in</i> command says:
"Checks whether x is equal to any element in the array. If x is a string, the array is checked case-sensitive"
I am note sure what the second example is supposed to demonstrate. That condition will be true only when you are not performing any of the checked medic anims.
case-sensitive, you nailed it. Now I feel stupid. I used "in" so many times and never ran into this.
It's working now. Ticket can be closed... Sorry :-/