Difference between revisions of "User:VKing/Sandbox"

From UOAF Codex
Jump to navigation Jump to search
m
Line 9: Line 9:
 
#include "script_component.hpp"
 
#include "script_component.hpp"
  
/*
+
PARAMS_1(_unit);
Do not include
 
these lines
 
at all
 
*/
 
  
PARAMS_4(_name,_unit,_type,_mods);
+
private ["_markerData","_markerArray","_killedType","_pos","_dummy"];
DEFAULT_PARAM(4,_groupSize,-1);
 
DEFAULT_PARAM(5,_scale,1);
 
DEFAULT_PARAM(6,_visibleTo,west);
 
DEFAULT_PARAM(7,_text,"");
 
DEFAULT_PARAM(8,_bft,false);
 
  
private ["_pos","_data"];
+
_markerData = _unit getVariable QGVAR(markerData);
 +
_markerArray = _unit getVariable QGVAR(markerArray);
 +
_killedType = _unit getVariable QGVAR(killedType);
 +
_bft = _unit getVariable QGVAR(markerBFT);
  
// Alternate spellings
+
if (isNil "_markerData") exitWith {
{
+
TRACE_1("No markerData for unit",_unit);
switch (_x) do {
+
if (!isNil "_markerArray") exitWith {
case "infantry": {_mods set [_foreachIndex, "inf"]};
+
_unit setVariable [QGVAR(markerArray),nil,true];
case "armour": {_mods set [_foreachIndex, "armor"]};
 
case "motorized": {_mods set [_foreachIndex, "motor"]};
 
case "artillery": {_mods set [_foreachIndex, "arty"]};
 
case "engineer": {_mods set [_foreachIndex, "eng"]};
 
case "unitair": {_mods set [_foreachIndex, "airunit"]};
 
case "airvehicle": {_mods set [_foreachIndex, "airunit"]}; // In case of fnord
 
case "unitland": {_mods set [_foreachIndex, "landunit"]};
 
};
 
} forEach _mods;
 
 
 
// Air unit markers
 
if ("airunit" in _mods) then {
 
if ("fixed" in _mods) then {
 
REM(_mods,"fixed");
 
};
 
if (!("rotary" in _mods) && "attack" in _mods) then {
 
REM(_mods,"attack");
 
PUSH(_mods,"fattack");
 
};
 
if (!("rotary" in _mods) && "cargo" in _mods) then {
 
REM(_mods,"cargo");
 
PUSH(_mods,"fcargo");
 
};
 
if (!("rotary" in mods) && "uav" in _mods) then {
 
REM(_mods,"uav");
 
PUSH(_mods,"fuav");
 
 
};
 
};
 
};
 
};
</syntaxhighlight>
+
if (isNil "_markerArray") exitWith {
 
+
TRACE_1("No markerArray for unit",_unit);
==CPP==
+
_unit setVariable [QGVAR(markerData),nil,true];
<syntaxhighlight lang="cpp">
+
};
// #define DEBUG_MODE_FULL
 
#include "script_component.hpp"
 
  
/*
+
EXPLODE_7(_markerData,_name,_mods,_type,_size,_scale,_visibleTo,_text);
Do not include
+
_pos = getPos _unit;
these lines
 
at all
 
*/
 
  
PARAMS_4(_name,_unit,_type,_mods);
+
if (isNil "_killedType") then {
DEFAULT_PARAM(4,_groupSize,-1);
+
_killedType = GVAR(gKilledType);
DEFAULT_PARAM(5,_scale,1);
 
DEFAULT_PARAM(6,_visibleTo,west);
 
DEFAULT_PARAM(7,_text,"");
 
DEFAULT_PARAM(8,_bft,false);
 
 
 
private ["_pos","_data"];
 
 
 
// Alternate spellings
 
{
 
switch (_x) do {
 
case "infantry": {_mods set [_foreachIndex, "inf"]};
 
case "armour": {_mods set [_foreachIndex, "armor"]};
 
case "motorized": {_mods set [_foreachIndex, "motor"]};
 
case "artillery": {_mods set [_foreachIndex, "arty"]};
 
case "engineer": {_mods set [_foreachIndex, "eng"]};
 
case "unitair": {_mods set [_foreachIndex, "airunit"]};
 
case "airvehicle": {_mods set [_foreachIndex, "airunit"]}; // In case of fnord
 
case "unitland": {_mods set [_foreachIndex, "landunit"]};
 
};
 
} forEach _mods;
 
 
 
// Air unit markers
 
if ("airunit" in _mods) then {
 
if ("fixed" in _mods) then {
 
REM(_mods,"fixed");
 
};
 
if (!("rotary" in _mods) && "attack" in _mods) then {
 
REM(_mods,"attack");
 
PUSH(_mods,"fattack");
 
};
 
if (!("rotary" in _mods) && "cargo" in _mods) then {
 
REM(_mods,"cargo");
 
PUSH(_mods,"fcargo");
 
};
 
if (!("rotary" in _mods) && "uav" in _mods) then {
 
REM(_mods,"uav");
 
PUSH(_mods,"fuav");
 
};
 
 
};
 
};
 +
TRACE_2("",_killedType,_bft);
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 16:04, 26 December 2014

{{#invoke:Message box|mbox}}

SQF

<syntaxhighlight lang="sqf"> // #define DEBUG_MODE_FULL

  1. include "script_component.hpp"

PARAMS_1(_unit);

private ["_markerData","_markerArray","_killedType","_pos","_dummy"];

_markerData = _unit getVariable QGVAR(markerData); _markerArray = _unit getVariable QGVAR(markerArray); _killedType = _unit getVariable QGVAR(killedType); _bft = _unit getVariable QGVAR(markerBFT);

if (isNil "_markerData") exitWith { TRACE_1("No markerData for unit",_unit); if (!isNil "_markerArray") exitWith { _unit setVariable [QGVAR(markerArray),nil,true]; }; }; if (isNil "_markerArray") exitWith { TRACE_1("No markerArray for unit",_unit); _unit setVariable [QGVAR(markerData),nil,true]; };

EXPLODE_7(_markerData,_name,_mods,_type,_size,_scale,_visibleTo,_text); _pos = getPos _unit;

if (isNil "_killedType") then { _killedType = GVAR(gKilledType); }; TRACE_2("",_killedType,_bft); </syntaxhighlight>