Page MenuHomeFeedback Tracker

Parameter Bug with Object Oriented Scripting Shell (+Oversight?)
Closed, ResolvedPublic

Description

Not sure if people even use this these days, but I find it to be a pretty neat feature.

Upon trying to get this to work with missionConfigFile I also happened upon a bug when calling fn_createObjectOO.sqf. The parameter check is built the wrong way around, trying to pass an ARRAY parameter with numbers - it instead detected as a SCALAR.

if ((count _this) > 1) then 
{
	_constructorParams = [_constructorParams];
	if ((typeName (_this select 1)) == (typeName [])) then 
	{
		_constructorParams = _constructorParams + (_this select 1); // This should be the array
	} 
	else 
	{
		_constructorParams = _constructorParams + [_this select 1]; // Not this
	};
};

The fix:

if ((count _this) > 1) then 
{
	_constructorParams = [_constructorParams];
	if ((typeName (_this select 1)) == (typeName [])) then 
	{
		_constructorParams = _constructorParams + [_this select 1];
	} 
	else 
	{
		_constructorParams = _constructorParams + (_this select 1);
	};
};

As for the oversight, as formerly mentioned - this does in fact work mission-side which I think is pretty neat and can help make code a wee bit more readable. As for if this method has poor performance or is susceptible to hacking - I do not know.

// Old, meant for addons
_class = configFile >> "CfgOO" >> _className;
// New, works for missions
_class = missionConfigFile >> "CfgOO" >> _className;

I understand why it was made this way, but think it'd be neat if both would work as I find iterating via a mission to be a lot faster than having to constantly close and restart Arma 3.

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 11 x64
Category
Scripting
Steps To Reproduce
  1. Trying to add a CfgOO class via mission doesn't work (at least not in my experience).
  2. Modifying the relevant scripts to instead use missionConfigFile works fine.
  3. When it does work, constructor parameters are parsed incorrectly.

Event Timeline

Dealman created this task.Mar 24 2023, 5:16 PM
dedmen closed this task as Resolved.Mar 27 2023, 1:45 PM
dedmen claimed this task.
dedmen added a subscriber: dedmen.

Unsupported legacy feature.
This might interest you for the future: https://feedback.bistudio.com/T170647