Bug #16375

Can't run a user script from the mission config parameter onMinimapScript.

Added by Denisko-Redisko about 4 years ago. Updated about 4 years ago.

Status:Assigned Start date:01/01/2011
Priority:Normal Due date:04/01/2011
Assignee:- % Done:

0%

Category:Scripting: Problem
Target version:-
Affected ArmA II version:1.57.76815 First affected build:
Reproduced by another DH user:No First affected ArmA II version:
I am using some Mods:No Single / Multi Player?:
I am using: BIForumURL:
Reproducible for you:Yes NGUrl:
Related to content of DLC: WIKIurl:

Description

Error in the script called from an onLoad event handler:

class RscMiniMap {
    onLoad = "uinamespace setvariable ['BIS_RscMiniMap',_this select 0]; 
_this call compile preprocessfilelinenumbers 'ca\ui\scripts\MiniMap.sqf';"; 


Script Arma2\Expansion\Addons\ui\scripts\MiniMap.sqf:
private ["_display","_script"];

_display = _this select 0;
_script = getText(missionConfigFile >> "onMinimapScript");

if (_script != "") then 
{
    private ["_handle"];
    _handle = [_display] call _script; // attempt to call a string value!
} else {
    _scripts = getArray(missionConfigFile >> "onMinimapScript");
    if (count _scripts > 0) then
    {
        {
            private ["_handle"];
            _handle = [_display] call (missionnamespace getvariable _x);
        } foreach _scripts;
    };
};

Please replace this code with the following:
_arguments = _this;
_onMinimapScript = missionConfigFile >> "onMinimapScript";

_runUserScript = {
    if(typeName _x != "STRING") exitWith {};
    if(_this == "") exitWith {};
    _script = missionNamespace getVariable _this;
    if(isNil "_script") exitWith {
        _arguments call compile preprocessFileLineNumbers _this;
    };
    if(typeName _script == "CODE") exitWith {
        _arguments call _script;
    };
};

call {
    if(isText _onMinimapScript) exitWith {
        getText _onMinimapScript call _runUserScript;
    };
    if(isArray _onMinimapScript) exitWith {
        {
            _x call _runUserScript;
        } foreach getArray _onMinimapScript;
    };
    diag_log "error in description.ext: param onMinimapScript must be Array or Text";
};

onMinimapScript_error.Desert_E_2011-01-02_.01.rar - mission, reproduces the bug (run and press Ctrl+M) (778 Bytes) Denisko-Redisko, 01/01/2011 22:59

History

Updated by Fireball about 4 years ago

  • Due date set to 04/01/2011
  • Status changed from New to Assigned
  • Target version deleted (1.57.76815)
  • Affected ArmA II version changed from Please select... to 1.57.76815
  • Reproducible for you changed from No to Yes

Please only set Affected version, Target version is for fixed issues.

Also available in: Atom PDF