SQS Syntax

From Bohemia Interactive Community
Revision as of 12:05, 21 December 2006 by Suma (talk | contribs) (Fixed link case)
Jump to navigation Jump to search

Template:SQS-disclaimer Description:

SQS Syntax is a scripting syntax which is executed in a line-by-line nature. Because each line is compiled and executed individually, performance is typically less than that of scripts which are compiled prior to execution such as with code written in the sqf syntax.

Each script line may be one of the following:


Comment: Line starting with ';'.
Example:

;This is a comment


Label: Line starting with '#'.
Example:

#LabelName

See the goto command for more information on using a label in a script.


Waiting for a condition: Line starting with '@'.
Example:

@condition


Waiting for a time: Line starting with '&'.
Example:

&endTime......is equivalent to @_time >= (endTime)


Delay: Line starting with '~'.
Example:

~delay......Is equivalent to __waitUntil = _time+(cas) ; &__waitUntil


Command: Any expression returning no value.
Example:

_unit setBehaviour "safe"

See the scripting command list for more information.

Assignment: Assignment of any value to a variable.
Example:

_a = 10


Conditional: ? condition......Command or assignment, command is executed only when condition is satisfied.
Example:

? _condVar > 10: _var = _var + 2


Local variables can be used during script execution to avoid variable conflicts. Local variable names start with an underscore ('_').
Example:

_varA would be a local variable
varA would be a global variable

Notes:

Variable _time is reserved. It is used to keep the time elapsed since script execution started.

Variables starting with two underscores are reserved and should never be used.

A "local" variable means that the variable's scope is a certain script/function.

A "global" variable means that you can use this variable in any script on that machine.

A "public" variable means that this variable has been broadcasted over the net and is available on every client. See publicVariable for more information.