eagledude4 3 Posted May 18, 2014 When I call a function in the _Code argument, it doesn't call the function when the action is activated _Unit addAction [_Str, _Code, _Args, 1, false, true, "", _Condition]; The wiki doesn't say anything about calling functions, but I think the feature been present since OA. Share this post Link to post Share on other sites
fight9 14 Posted May 18, 2014 Just place the function name as the code. _id = _unit addAction ["Name",Tag_fnc_myFunction,_arg]; Then the function with have the same parameters sent. _target = _this select 0; _caller = _this select 1; _id = _this select 2; _arg = _this select 3; Share this post Link to post Share on other sites
eagledude4 3 Posted May 18, 2014 That's what I'm doing. The action shows, but "TEST" is not displayed when I try to activate the action. actions.sqf: [player, "#FF8000", "TEST", "ED4_fnc_TEST", "", "AdminMode"] call ED4_fnc_addAction; fn_addAction.sqf: //By Eagledude4 _Unit = _this select 0; _Color = _this select 1; _actionStr = _this select 2; _Str = format["<t color='%1'>%2</t>", _Color, _ActionStr]; _Code = _this select 3; _Args = _this select 4; _Condition = _this select 5; _Unit addAction [_Str, _Code, _Args, 1, false, true, "", _Condition]; fn_TEST.sqf: hint "TEST"; Share this post Link to post Share on other sites
k0rd 3 Posted May 18, 2014 (edited) That's what I'm doing. The action shows, but "TEST" is not displayed when I try to activate the action.actions.sqf: [player, "#FF8000", "TEST", "ED4_fnc_TEST", "", "AdminMode"] call ED4_fnc_addAction; fn_addAction.sqf: //By Eagledude4 _Unit = _this select 0; _Color = _this select 1; _actionStr = _this select 2; _Str = format["<t color='%1'>%2</t>", _Color, _ActionStr]; _Code = _this select 3; _Args = _this select 4; _Condition = _this select 5; _Unit addAction [_Str, _Code, _Args, 1, false, true, "", _Condition]; fn_TEST.sqf: hint "TEST"; you are not doing it right. your action does not point to a function. Edited May 19, 2014 by k0rd Share this post Link to post Share on other sites
fight9 14 Posted May 18, 2014 Function name should be code, not a string. [player, "#FF8000", "TEST", ED4_fnc_TEST, "", "AdminMode"] call ED4_fnc_addAction; Share this post Link to post Share on other sites
Tajin 349 Posted May 19, 2014 Hmm, haven't heard of that. To be on the safe side, what stops you from simply putting the code for executing the function in it? Like so: _Unit addAction [_Str, {_this call _function;}, _Args, 1, false, true, "", _Condition]; Share this post Link to post Share on other sites
fight9 14 Posted May 19, 2014 Some people do that as well. Though you might have to compile or format it to make it work across functions as a parameter like that. Share this post Link to post Share on other sites