Array in QUOTE() bug
hi,
if i use "in [x,y]" in "condition = QUOTE(....);" action condition are always true.
ex :
class ACE_actiontest {
displayName = "test";
distance = 4;
condition = QUOTE((_target isKindOf 'Man') && {!alive _target} && {playerSide in [west,independent]} && {'Medikit' in (items _player)});
statement = QUOTE([_target] spawn xxxx);
exceptions[] = {"isNotSwimming"};
showDisabled = 0;
priority = 2.5;
hotkey = "R";
};
this action is always available.
class ACE_actiontest {
displayName = "test";
distance = 4;
condition = "(_target isKindOf 'Man') && {!alive _target} && {playerSide in [west,independent]} && {'Medikit' in (items _player)}";
statement = QUOTE([_target] spawn fnc_test);
exceptions[] = {"isNotSwimming"};
showDisabled = 0;
priority = 2.5;
hotkey = "R";
};
this work nice
The QUOTE macro has multiple limitations. It has trouble with multiple embedded statements and especially arrays. It is mainly used so we can expand macros inside of strings .You cannot do "FUNC(asdf)") for example - this is a scenario where QUOTE is needed.
Your case, it is failing to complete the macro due to the array
thx for info
QUOTE((_target isKindOf 'Man') && {!alive _target} && {playerSide in [ARR_2(west,independent)]} && {'Medikit' in (items _player)});
Note the ARR_2
It's not easy writing complex, QUOTEable code, so an easy and clean method would be to put all your conditionals into a function and just call it.
e.g.:
condition = QUOTE(_this call canCheckFnc);
canCheckFnc = {
_target = _this select 0;
_player = _this select 1;
(_target isKindOf 'Man') && {!alive _target} && {playerSide in [west,independent]} && {'Medikit' in (items _player)}
};
@havena, this is the correct syntax for your action:
class ACE_actiontest {
displayName = "test";
distance = 4;
condition = QUOTE((_target isKindOf 'Man') && {!alive _target} && {playerSide in [ARR_2(west,independent)]} && {'Medikit' in (items _player)});
statement = QUOTE([_target] spawn fnc_test);
exceptions[] = {"isNotSwimming"};
showDisabled = 0;
priority = 2.5;
hotkey = "R";
};
the ARR_X macros are your friends if you need commas inside a cba macro like QUOTE