Closed senshi-x closed 3 months ago
Tested locally with multiple clients.
@senshi-x when testing locally in multiplayer I get this error message
11:26:51 Error in expression <
if !(hasInterface) exitWith {};
params [["_unitsToUpdate", allPlayers, [>
11:26:51 Error position: <params [["_unitsToUpdate", allPlayers, [>
11:26:51 Error Params: Type String, expected Array
11:26:51 File C:\Users\Bernhard-WS\Documents\Arma 3 - Other Profiles\Bernhard\mpmissions\Shoot_and_Scoot.Tanoa\scripts\shelltracker\functions\fn_initTracker.sqf, line 11
Does not happen on dedicated server though.
I never test local, only dedicated.
Still, you'll see that on DS as well. It's caused by Arma throwing an Error instead of a warning in case of type checking on params
when a defaultvalue is used.
I never test local, only dedicated. Still, you'll see that on DS as well. It's caused by Arma throwing an Error instead of a warning in case of type checking on
params
when a defaultvalue is used.
Hm if the type check of params
is to blame, could we remove the type check and do it afterwards with checks and exitWith
instead?
But which call is feeding a wrong type in the first place? 🤔
Sure you can do workarounds, but why? It works just as it should.
There's only a single place where this script is called without units, so it's easy to pinpoint: It's the postInit call. https://github.com/gruppe-adler/Shoot_and_Scoot.Tanoa/pull/40/files#diff-0fbb73040b480729a4030dfe426ebebf59a1278b5a1775909243429892b17ff3R12
Sure you can do workarounds, but why? It works just as it should.
In my experience a code base deteriorates if warnings are just ignored and every developer gets used to warnings poping up. When this habbit sinks in, bugs are then slipping through, because no one takes care of warning messages anymore.
where is string coming from?
[[_unit]] remoteExecCall ["shellTracker_fnc_initTracker"];
there shouldnt be a string involved, shouldnt there?
where is string coming from?
[[_unit]] remoteExecCall ["shellTracker_fnc_initTracker"];
there shouldnt be a string involved, shouldnt there?
That's not the line I linked to. :) It comes from the very last line in postInit (line 12). If you call
a fnc without arguments, Arma automatically uses the source function name and a boolean ( I forgot what that one stands for) as args.
In this case, _this
inside initTracker is:
["postInit",true]
And there's your string.
EDIT: If you really are so bothered by this SQF bug, just make it [allPlayers] call ...
in that line.
Sure you can do workarounds, but why? It works just as it should.
In my experience a code base deteriorates if warnings are just ignored and every developer gets used to warnings poping up. When this habbit sinks in, bugs are then slipping through, because no one takes care of warning messages anymore.
Sure, your principle is right. In principle. But working around false positives caused by engine bugs by weakening your own code strengths such as full typechecks, performance and legibility is definitely more harmful overall and will lead to more errors in the future.
EDIT: If you really are so bothered by this SQF bug, just make it
[allPlayers] call ...
in that line.
I will go with this solution. Thx 🙂
If you
call
a fnc without arguments, Arma automatically uses the source function name and a boolean ( I forgot what that one stands for) as args.
Are you sure? The wiki says:
arguments: Anything - (Optional, default nil) arguments that are passed to the method in the _this variable
So the arguments default to nil I would say, see https://community.bistudio.com/wiki/call
If you
call
a fnc without arguments, Arma automatically uses the source function name and a boolean ( I forgot what that one stands for) as args.Are you sure. The wiki says:
arguments: Anything - (Optional, default nil) arguments that are passed to the method in the _this variable
So the arguments default to nil I would say, see https://community.bistudio.com/wiki/call
I'm sure because I tested it. 🤷 Simply add a diag_log(_this) inside the initTracker.sqf to replicate/verify. I do not know why this happens, and did not further investigate it either.
EDIT: You can also checkout the previous commit, which included exactly that debug/diag_log stuff because I was confused as well what was going on. ;)
@senshi-x we just verified the bugfix on the dedicated server (with @nomisum and @PulsarNeutronStar). It works now also after respawn. Thx 🙂