SQF Highlighter – Extension
Jump to navigation
Jump to search
SQF Highlighter | |
---|---|
Description | Highlights and links SQF commands and functions |
Author | Lou Montana |
Version | 0.5b (version is not incremented for now due to continuous updates as of 2022-03-14) |
Release Date | 2022-03-12: First upload |
Project Start | 2022-03-08: Project start |
This extension highlights and automatically links SQF commands and functions.
Installation
- Unzip the directory to wiki
/extensions /SQFHighlighter - Add
wfLoadExtension('SQFHighlighter');
to LocalSettings.php - There are no settings - the extension creates full path links unless the host is one of the following (then relative links are created):
- community.bistudio.com
- community.bohemia.net
Usage
Using <sqf> tags will auto-generate syntax highlighting and links to the pages.
Code | Result |
---|---|
<sqf/> |
-no SQF code provided-
|
<sqf></sqf> |
-no SQF code provided-
|
<sqf> </sqf> |
-no SQF code provided-
|
<sqf>hint "It Works!";</sqf> |
hint "It Works!"; |
<sqf> // your code here hint "good!"; </sqf> |
|
<sqf> #define fadeInDuration 3 waitUntil { not alive player }; hint DEATH_MESSAGE; cutText ["", "Black", playerRespawnTime]; private _deathTime = time; Deaths = Deaths + 1; /* wait for resurrection */ waitUntil { alive player && { preloadCamera getPosATL player } }; sleep 3; cutText ["Welcome!", "Black in", fadeInDuration]; // after 10s, end the mission sleep 10; [] call BIS_fnc_endMission; </sqf> |
#define fadeInDuration 3
waitUntil { not alive player };
hint DEATH_MESSAGE;
cutText ["", "Black", playerRespawnTime];
private _deathTime = time;
Deaths = Deaths + 1;
/*
wait for resurrection
*/
waitUntil { alive player && { preloadCamera getPosATL player } };
sleep 3;
cutText ["Welcome!", "Black in", fadeInDuration];
// after 10s, end the mission
sleep 10;
[] call BIS_fnc_endMission; |
CSS Classes
All elements are <span>.
Element | CSS class | Overview |
---|---|---|
parent block | sqfhighlighter-block | |
error message | sqfhighlighter-error | -no SQF code provided-
|
comment | sqfhighlighter-comment | // comment
/*
this is
a multiline
comment
*/ |
string | sqfhighlighter-string | "string" |
number | sqfhighlighter-number | 42
-6.9
10e10 |
operator | sqfhighlighter-operator | |
keyword (if, then, waitUntil, etc) | sqfhighlighter-keyword | |
command | sqfhighlighter-command | |
function | sqfhighlighter-function | |
external function | sqfhighlighter-function-ext | // not just considering BIS_ or BIN_
BIS_fnc_unknownFunction
TAG_fnc_spawnGroup |
local variable | sqfhighlighter-localvar | _localVar |
global variable | sqfhighlighter-globalvar | |
constant (#defined value) | sqfhighlighter-const | // anything #defined or anything UNDERSCORED_ALL_CAPS
#define testVar
testVar;
MY_CONSTANT; |
macro | sqfhighlighter-macro | #define |
array start ([) | sqfhighlighter-arraystart | [... |
array end (]) | sqfhighlighter-arrayend | ...] |
code start ({) | sqfhighlighter-codestart | {... |
code end (}) | sqfhighlighter-codeend | ...} |
parenthese start ({) | sqfhighlighter-parenthesestart | (... |
parenthese end (}) | sqfhighlighter-parentheseend | ...) |
Known Issues
- comment blocks still highlight words as global variables for now
- single-quote strings have issues with other formatting between quotes
- report other issues on Discord