Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing objective post-init causes script error. #727

Open
5 of 6 tasks
E-Ledere opened this issue Mar 24, 2021 · 3 comments
Open
5 of 6 tasks

Removing objective post-init causes script error. #727

E-Ledere opened this issue Mar 24, 2021 · 3 comments
Assignees

Comments

@E-Ledere
Copy link

Prerequisites

  • Can you reproduce the problem using ALiVE and CBA Only?
  • Are you running the latest version of ALiVE ?
  • Are you running the latest version of CBA_A3?
  • Have you attached an unbinarized SQM?
  • Have you attached your RPT (If the issue relates to data, also attch Server RPT and ALiVE Plugin Log)?
  • Have you attached screenshots of the Parameters set on the offending Module?

Description

Removing an objective using the "removeObjective" case in OPCOM can cause a script error to occur after the command successfully executes, specifically in the "sortObjective" case.

I have attached a test mission to this issue in which I was able to reliably replicate this problem.

Steps to Reproduce

  1. Start a mission with multiple objectives.
  2. Remove an objective during runtime.
  3. Receive script error.

Expected behavior: No script error.

Actual behavior: Script error.

aliveError.Stratis.zip
Arma3_x64_2021-03-24_14-16-01.rpt.txt

@DavisBrown723
Copy link
Contributor

I no longer see this error if OPCOM is allowed to fully start up before executing the script.

sleep 10;

waituntil {
	(OPCOM_INSTANCES select { !([_x,"startupComplete", false] call ALiVE_fnc_hashGet) }) isequalto []
};

{
	if(([_x, "side", ""] call ALiVE_fnc_HashGet) == "WEST") then {
		_objectives = [_x, "objectives", []] call ALiVE_fnc_HashGet;
		private _id = [(_objectives # 0), "objectiveID", "empty"] call ALiVE_fnc_hashGet;
		[_x, "removeObjective", _id] call ALiVE_fnc_OPCOM;
		hint "Removing objective.";
	};
} foreach OPCOM_INSTANCES;

You can check with a manual call to sortObjectives

{
	if(([_x, "side", ""] call ALiVE_fnc_HashGet) == "WEST") then {
		[_x, "sortObjectives"] call ALiVE_fnc_OPCOM;
	};
} foreach OPCOM_INSTANCES;

Can you confirm this fixes your issue?

@E-Ledere
Copy link
Author

I'm continuing to see the same problem in the same test mission, it's just not reproducible 100% of the time anymore.

It still seems fairly reproducible with this code in initServer.sqf:

sleep 10;

waituntil {
	(OPCOM_INSTANCES select { !([_x,"startupComplete", false] call ALiVE_fnc_hashGet) }) isequalto []
};

{
	if(([_x, "side", ""] call ALiVE_fnc_HashGet) == "WEST") then {
		_objectives = [_x, "objectives", []] call ALiVE_fnc_HashGet;
		private _id = [(_objectives # 0), "objectiveID", "empty"] call ALiVE_fnc_hashGet;
		[_x, "removeObjective", _id] call ALiVE_fnc_OPCOM;
		hint "Removing objective.";
	};
} foreach OPCOM_INSTANCES;

@DavisBrown723 DavisBrown723 self-assigned this Mar 25, 2021
@DavisBrown723
Copy link
Contributor

Seems like maybe a race condition that stems from a spawned code block which makes this tougher to track down. Will look again tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants