Page MenuHomeFeedback Tracker

BIS_fnc_taskState not working on a dedicated server
New, NormalPublic

Description

The function works otherwise fine, expect doesn't return anything on a dedicated server.

_state = toUpper (taskState _taskReal);

if (_state == "") then
{
	_state = GET_DATA(_taskVar,STATE);
};

_state

The if statement should be replaced with

isNil "_state"

as taskState doesn't return an empty string, it returns nothing.

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 8 x64
Category
Scripting
Additional Information
/*
	Author: Jiri Wainar

	Description:
	Return a task's state.

	Parameters:
		0: STRING - Task name

	Returns:
	STRING - task's state.
*/

#include "defines.hpp"

private ["_taskID","_taskVar","_data","_taskReal","_state"];

_taskID = _this param [0,"",[""]];
_taskVar = _taskID call bis_fnc_taskVar;
_taskReal = [_taskID] call bis_fnc_taskReal;

if (isNull _taskReal || {isNil{GET_DATA_NIL(_taskVar,ID)}}) exitwith {["Task '%1' does not exists.",_taskID] call bis_fnc_error; ""};

_state = toUpper (taskState _taskReal);

if (_state == "") then
{
	_state = GET_DATA(_taskVar,STATE);
};

_state

Event Timeline

Firstborn renamed this task from BIS_fnc_taskState not working on a dedicated server. to BIS_fnc_taskState not working on a dedicated server.Jun 12 2016, 9:29 AM

seems like it's issue with taskState not working/returning anything on dedicated server?

BIS_fnc_KK added a subscriber: BIS_fnc_KK.EditedJun 17 2016, 8:12 PM

Why are you running this on dedicated server? The task commands are designed to work with local player and I would expect on dedicated these commands simply do not exist.

@Dwarden
The issue is the if statement, as it would need to trigger for the function to work on a dedicated server, but it won't as it checks for an empty string that taskState command doesn't ever return.
As for example BIS_fnc_taskCompleted works completely fine on a dedicated server as it's written simply like this:

/*
	Author: Jiri Wainar

	Description:
	Return if a task has been completed.

	Parameters:
		0: STRING - Task name

	Returns:
	BOOL - True if the task has been completed, false if not.

	Example:
	["TestTask"] call bis_fnc_taskCompleted;
*/

#include "defines.hpp"

private ["_taskID","_taskVar","_state"];

_taskID = _this param [0,"",[""]];
_taskVar = _taskID call bis_fnc_taskVar;

if (isNil{GET_DATA_NIL(_taskVar,ID)}) exitwith {["Task '%1' does not exists.",_taskID] call bis_fnc_error; false};

_state = GET_DATA(_taskVar,STATE);

{_x == _state} count ["SUCCEEDED", "FAILED", "CANCELED"] > 0

Of course don't know why on BIS_fnc_taskState the definition of _state isn't just written the same way as in BIS_fnc_taskCompleted.

@BIS_fnc_KK
https://community.bistudio.com/wiki/Arma_3_Task_Framework

Has been fixed with the new Apex release.

"•Tweaked: The BIS_fnc_taskState was optimized to prevent problems with non-existing tasks on Dedicated Servers "
https://dev.arma3.com/post/spotrep-00058