Arma 3 Scripting

SQS to SQF conversion

Topic · Markdown · JSON · original wiki page

SQF Syntax has been introduced in Operation Flashpoint: Resistance v1.85 and is the Arma series' main scripting language until Arma 3. The main differences with SQS Syntax are:

Conversion Examples

SQS SQF
Comment
; This is a comment
; This is a
; multiline
; comment

comment "this is a comment";
"this is a comment";
// This is single-line comment
/*
    This is a
    multiline
    comment
*/

comment "this is a comment";
"this is a comment";
Conditional Wait
@CONDITION
@ not alive player
waitUntil { CONDITION };
waitUntil { not alive player };
Delay
~DELAY
~5
sleep DELAY;
sleep 5;
Conditional Command
? CONDITION : COMMAND
? alive player : player setDammage 1
if (CONDITION) then { COMMAND };
if (alive player) then { player setDammage 1 };
Multi-Conditional Command
? CONDITION : goto "SKIP"
 COMMAND_2
goto "END"
#SKIP
 COMMAND_1
#END
if (CONDITION) then
{
    COMMAND_1
}
else
{
    COMMAND_2
};
Cycle
#loop
COMMAND
~DELAY
? CONDITION : goto "LOOP"
while { CONDITION } do
{
    COMMAND;
    sleep DELAY;
};
Cycle With Step
_i = 0
#LOOP
 COMMAND
 _i = _i + 1;
? _i < COUNT : goto "LOOP"
for "_i" from 0 to COUNT -1 do
{
    COMMAND;
};
Structured Conditional Command
? VARIABLE == VALUE_1: goto "SKIP_1"
? VARIABLE == VALUE_2: goto "SKIP_2"
 DEFAULT_COMMAND
 goto "END"
#SKIP_1
 COMMAND_1
 goto "END"
#SKIP_2
 COMMAND_2
#END
switch (VARIABLE) do
{
    case VALUE_1:
        { COMMAND_1 };
    case VALUE_2:
        { COMMAND_2 };
    default
        { DEFAULT_COMMAND };
};
Exiting
? CONDITION : COMMAND_2
? CONDITION : exit
 COMMAND_1
if (CONDITION) exitWith { COMMAND_2; };
COMMAND_1;

See Also