User:VKing/SQF Highlighting

From UOAF Codex
Jump to navigation Jump to search

SQF syntax highlighting for the MediaWiki GeSHi syntax highlighting extension. Written by VKing and implemented for the UO wiki by Verox.

Report any suggestions etc. in the forum thread.

Usage

<syntaxhighlight lang="sqf">
//Code goes here
</syntaxhighlight>

Additional parameters documented here.

Examples

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

  1. include "script_component.hpp"

PARAMS_1(_unit);

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

[fnord] call BIS_fnc_arrayPop;

_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>


<syntaxhighlight lang="sqf"> _logic = _this select 0;

//--- Execute Functions if (isnil "bis_fnc_init") then { _logicFnc = (group _logic) createunit ["FunctionsManager",position player,[],0,"none"]; }; waituntil {!isnil "bis_fnc_init"};

//--- Track List _trackList = if (isnil {_logic getvariable "trackList"}) then {[]} else {_logic getvariable "trackList"}; _logic setvariable ["trackList",_trackList,true];

//--- Delay _delay = if (isnil {_logic getvariable "delay"}) then {3} else {_logic getvariable "delay"}; _logic setvariable ["delay",_delay,true];

[_trackList,_delay] spawn bis_fnc_music; </syntaxhighlight>