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

script error in fn_sm_business_state_voyage_loop #39

Closed
McDiod opened this issue Jan 27, 2020 · 10 comments
Closed

script error in fn_sm_business_state_voyage_loop #39

McDiod opened this issue Jan 27, 2020 · 10 comments
Assignees
Labels

Comments

@McDiod
Copy link
Collaborator

McDiod commented Jan 27, 2020

Happened during Money in the Mist 2020/01/27.

22:06:33 [GRAD] (civs) INFO: civ killed: [[10520.7,6642.8,1.6751],bis_o2_3875]
22:06:44 Error in expression <private _wppos = waypointPosition (_wps select _wpidx);

[_this,  format ["trave>
22:06:44   Error position: <select _wpidx);

[_this,  format ["trave>
22:06:44   Error Zero divisor
22:06:44 File node_modules\grad-civs\functions\sm_business\fn_sm_business_state_voyage_loop.sqf [grad_civs_fnc_sm_business_state_voyage_loop]..., line 3
@McDiod McDiod added the bug label Jan 27, 2020
@Fusselwurm Fusselwurm self-assigned this Jan 27, 2020
@Fusselwurm
Copy link
Member

🍌

... hm, vllt checken ob Waypoints - array leer ist ?

@McDiod
Copy link
Collaborator Author

McDiod commented Jan 29, 2020

Jo

@Fusselwurm
Copy link
Member

Fusselwurm commented Feb 8, 2020

der explodierende Code:

private _wpidx = currentWaypoint group _this;
private _wps = waypoints (group _this);
private _wppos = waypointPosition (_wps select _wpidx);

[_this,  format ["traveling to waypoint %1, %2 (%3m left)", _wpidx, _wppos, _this distance _wppos]] call grad_civs_fnc_setCurrentlyThinking;

ok, eben mal geschaut - "Error Zero divisor" kommt bei Zugriff auf undefinierte array indices, abgesehen von dem direkt nach dem letztdefinierten Element des Arrays; dieses gibt fehlerlos nil zurück

["x"] select -1 => <Error Zero divisor>
["x"] select  0 => "x"
["x"] select  1 => nil
["x"] select  2 => <Error Zero divisor>

Könnt ich mir jetz aussuchen was der Fall ist, allerdings wird currentWaypoint niemals -1 zurückgeben (wenn keine Waypoints definiert sind, gibt es 0 zurück)
...ergo hat

  • entweder die Gruppe während der Ausführung zwischen den Zeilen waypoints verloren.
  • oder die Einheit ist aus der Gruppe geflogen

Ist meine einzige Erklärung -.-

Zwar ist waypoints 0-indiziert, und currentWaypoint kann eins über dem letzten gesetzten index sein (wenn waypoints complete) aber das reicht halt nicht für den Fehler. -.-

Fusselwurm added a commit that referenced this issue Feb 8, 2020
@Fusselwurm Fusselwurm removed their assignment Feb 8, 2020
@Fusselwurm
Copy link
Member

(letztere Möglichkeit kann ich vermeiden, siehe 76b9d3e . die andere nicht. ich laß das ticket erstma offen. )

@Fusselwurm
Copy link
Member

19:13:29 Error in expression <private _wppos = waypointPosition (_wps select _wpidx);

[_this,  format ["trave>
19:13:29   Error position: <select _wpidx);

[_this,  format ["trave>
19:13:29   Error Zero divisor
19:13:29 File z\grad_civs\addons\voyage\functions\fnc_sm_business_state_voyage_loop.sqf..., line 6

still occurs, rarely (first time I'm actually seeing this)

Fusselwurm added a commit that referenced this issue Jul 17, 2020
...provided SQF execution does not suspend within a single statement.
Fusselwurm added a commit that referenced this issue Jul 17, 2020
@Fusselwurm
Copy link
Member

no.

22:12:45 Error in expression <private _wppos = waypointPosition (_wps select (currentWaypoint _group));

[_thi>
22:12:45   Error position: <select (currentWaypoint _group));

[_thi>
22:12:45   Error Zero divisor
22:12:45 File z\grad_civs\addons\voyage\functions\fnc_sm_business_state_voyage_loop.sqf..., line 5

@Fusselwurm Fusselwurm reopened this Jul 17, 2020
@Fusselwurm
Copy link
Member

Fusselwurm commented Jul 17, 2020

judging by the fact it occurs some time into the mission, i'm guessing this does happen at the end of all waypoints after all, probably at the cycle wp. will check.

@Fusselwurm
Copy link
Member

Fusselwurm commented Jul 18, 2020

cannot reproduce while letting AI run/drive in circles with cycle waypoints.

BUT how about this:

private _group = group objNull; // grpNull
private _wps = waypoints _group;  // []
private _wppos = waypointPosition (_wps select (currentWaypoint _group));  // currentWaypoint grpNull => -1⚡ 

=>

17:03:28 Error in expression <private _wppos = waypointPosition (_wps select (currentWaypoint _group));>
17:03:28   Error position: <select (currentWaypoint _group));>
17:03:28   Error Zero divisor

🎉

@Fusselwurm
Copy link
Member

Callstack:"
13:36:47 "	[] L1 ()"
13:36:47 "	[] L100 (x\cba\addons\statemachine\fnc_clockwork.sqf)"
13:36:47 "	[] L0 ()"
13:36:47 "	[] L53 (x\cba\addons\statemachine\fnc_clockwork.sqf)"
13:36:47 "		_x:Location CBA_NamespaceDummy at -1000, -1000"
13:36:47 "		_list: Array of 54 elements. Not printed because too long. Set variable '_debug_dumpFullArrays' to dump force printing."
13:36:47 "		_statemachine:Location CBA_NamespaceDummy at -1000, -1000"
13:36:47 "		_foreachindex:1"
13:36:47 "		_id:3"
13:36:47 "		_tick:3"
13:36:47 "		_skipnull:true"
13:36:47 "	[] L71 (x\cba\addons\statemachine\fnc_clockwork.sqf)"
13:36:47 "		_current:15694678600# 401091: tak_civil02.p3d"
13:36:47 "		_thisstate:bus_voyage"
13:36:47 "	[] L16 (z\grad_civs\addons\voyage\functions\fnc_sm_business.sqf)"
13:36:47 "		_this:15694678600# 401091: tak_civil02.p3d"
13:36:47 "	[] L7 (z\grad_civs\addons\voyage\functions\fnc_sm_business_state_voyage_loop.sqf)"
13:36:47 "		_wppos:array"
13:36:47 "		_wps:[]"
13:36:47 "		_this:15694678600# 401091: tak_civil02.p3d"
13:36:47 "		_group:<NULL-group>"
13:36:47 "CALLSTACK END;;;
"
13:36:47 Error in expression <private _wppos = waypointPosition (_wps select (currentWaypoint _group));

[_thi>
13:36:47   Error position: <select (currentWaypoint _group));

civilian gets passed and is not null, but group is null.
this happens when a unit is dead, see https://community.bistudio.com/wiki/group

 Group - For dead units, the returned group equals grpNull. 

@Fusselwurm
Copy link
Member

Fusselwurm commented Jul 19, 2020

11:08:51 [GRAD_CIVS] (legacy) INFO: civ C Alpha 4-5:1 was killed (index: 35) firing internal 'killed' event
11:08:51 [GRAD_CIVS] (legacy) INFO: releasing civ C Alpha 4-5:1 killed at [4916.75,3696.84,0.793705] by <NULL-object>
11:09:23 [GRAD_CIVS] (voyage) WARNING: unit C Alpha 4-5:1 (type C_man_1) in voyage loop has no group will ignore. alive false index -1 pos [4916.75,3696.84,0.793705]
11:12:10 [GRAD_CIVS] (legacy) INFO: civ C Alpha 1-4:1 was killed (index: 6) firing internal 'killed' event
11:12:10 [GRAD_CIVS] (legacy) INFO: releasing civ C Alpha 1-4:1 killed at [5221.82,3667.09,0.793037] by <NULL-object>
11:13:09 [GRAD_CIVS] (voyage) WARNING: unit C Alpha 1-4:1 (type C_man_1) in voyage loop has no group will ignore. alive false index -1 pos [5221.82,3667.09,0.793037]

looks like the state machine iterates over killed civs even up to a minute later. wth. it only happens once though for each civ, which is even crazier.

I have still no idea how this is even possible, as the state machine usually iterates over all civs within 1s-3s and then re-creates the list from GVAR(localCivs)

There's a workaround in #80 that will avoid the error though so... closed, as there's no adverse effects of this that I know of.

@Fusselwurm Fusselwurm self-assigned this Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants