Page MenuHomeFeedback Tracker

fn_setTaskLocal.sqf has error on line 175
Closed, ResolvedPublic

Description

Error in expression <=+ _this;
_text = _array select 0;

if (islocalized _text) then {_array set [0,l>
Error position: <islocalized _text) then {_array set [0,l>
Error islocalized: Type Number, expected String
File A3\functions_f\Tasks\fn_setTaskLocal.sqf, line 175

I have scripted tasks using [true,[_tsk],[_taskdesc,_tasktopic,_position_mark],_position_mark,1,2,true,"Search"] call BIS_fnc_taskCreate; and I get that error every time. The tasks do not show at all and prior to patch 1.54 everything worked fine. I see the function has a =+ at line 175 which is definitely a typo causing all tasks to be broken.

Details

Legacy ID
3789462514
Severity
None
Resolution
Not A Bug
Reproducibility
Always
Category
Scripting
Steps To Reproduce

Create a task via a script using bis_fnc_taskcreate function. No task will show and the rpt will have the following error
Error in expression <=+ _this;
_text = _array select 0;

if (islocalized _text) then {_array set [0,l>
Error position: <islocalized _text) then {_array set [0,l>
Error islocalized: Type Number, expected String
File A3\functions_f\Tasks\fn_setTaskLocal.sqf, line 175

Event Timeline

Ghost edited Steps To Reproduce. (Show Details)Dec 3 2015, 7:50 PM
Ghost set Category to Scripting.
Ghost set Reproducibility to Always.
Ghost set Severity to None.
Ghost set Resolution to Not A Bug.
Ghost set Legacy ID to 3789462514.May 8 2016, 1:12 PM
Ghost edited a custom field.

Please provide the input parameters that you use in the bis_fnc_taskCreate call. Seems like you are sending wrong parameters into the function or the function doesn't handle the input properly.

[true,[_tsk],[_taskdesc,_tasktopic,_position_mark],_position_mark,1,2,true,"Search"] call BIS_fnc_taskCreate;

I am especially interested about the:

  • _taskdesc
  • _tasktopic
  • _position_mark

But if you can provide all input parameters, we will be able to test it. The local variables without values do not tell us much.

Please check what you send into the command and the difference (especially in data types and format) between this:

[
true,
["TestTask"],
["TestTask Desc","TestTask Name","TestTask Marker"],
getPos player,
1,
2,
true,
"Search"
]
call BIS_fnc_taskCreate;

Ghost added a subscriber: Ghost.May 8 2016, 1:12 PM
Ghost added a comment.Dec 4 2015, 10:43 AM

_position_mark = _this select 0;position to search buildings around
_rad = _this select 1;
radius around position to search for buildings
_locselname = _this select 2;//name of location

_intelarray = ["Land_Suitcase_F"];//,"Land_Laptop_unfolded_F","Land_Laptop_F","Land_FilePhotos_F","Land_File1_F","Land_File2_F"

//create random number
_rnum = str(round (random 999));

//select random intel
_intelsel = _intelarray call BIS_fnc_selectRandom;

create intel
_intelobj = createVehicle [_intelsel,[_position_mark select 0, _position_mark select 1, 0], [], 0, "NONE"];
_veh_name = getText (configFile >> "cfgVehicles" >> (_intelsel) >> "displayName");
_VarName = ("ghst_intel" + _rnum);
_intelobj setVehicleVarName _VarName;
_intelobj Call Compile Format ["%1=_This;",_VarName];
missionNamespace setVariable [_VarName,_intelobj];
publicVariable _VarName;

//create task
_tsk = "tsk_intel" + _rnum + str(_position_mark);

_tasktopic = format ["Find %1 in %2", _veh_name,_locselname];
_taskdesc = format ["Search the buildings in %2 for %1. Pay attention to the floors.", _veh_name,_locselname];
_position_mark would equal an actual position such as getposatl _intelobject.
Prior to 1.54 all tasks worked flawlesly so how did the structure change? Also looking at the function viewer line 175 of File A3\functions_f\Tasks\fn_setTaskLocal.sqf, line 175 has the typo =+

Thanks for the info provided. I think I find where the issue is. Please check what you are sending into the function as text on the marker. The format is [_taskDescriptionText,_taskNameText,_taskMarkerText]. Focus on the last element in the array which is the text that is displayed on the task marker in 3D.

According to what you say "_position_mark would equal an actual position such as getposatl _intelobject" you are sending into the function ARRAY with task position instead of STRING that is expected.

Please change the 3rd parameter in the task text array (replace _position_mark with some string, like "INTEL IS HERE!") and please let me know if it works.

Note: _array =+ _array is not a typo, the plus sign is a copy operator; see https://community.bistudio.com/wiki/Operators#Array_Operators for more info.

Ghost added a comment.Dec 4 2015, 11:38 AM

Ok I feel like an idiot now. I saw the error prior to 1.54 about the third param but never got around to changing it mainly because it did not affect anything. Then the patch comes out and it doesnt work. Thank you so much for the info but one more question. All of the tasks in my mission are created on the server side and via functions. They will not work unless I init.sqf execVM "shk_taskmaster.sqf"; even though I do not use its functions. Is there an initialization that has to happen before scripted tasks can work?

There is no initialization needed. If you call the bis_fnc_taskCreate on server with proper attributes, the task frameworks should create the individual (local) task on every valid client.

In your example, you call it with owner being true, which means the task should be created on every client.

To ensure the bis_fnc_taskCreate is executed from server, try for example put it into the missions init.sqf and frame it into the isServer condition:

if (isServer) then
{

[...] call bis_fnc_taskCreate;

};

Ghost added a comment.Dec 7 2015, 6:03 AM

Everything works great now. I apparently was missing a line waituntil for a shk_taskmaster function thus halting BIS tasks from functioning along with other things. Thanks for your help.

You are welcome.