SQS Syntax: Difference between revisions
m (→Notes) |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{ | {{tool-disclaimer | ||
| <center>Disclaimer: SQS script syntax is considered deprecated</center> | |||
| <center>When creating scripts for [[Armed Assault]] or newer products, use [[SQF syntax]] where possible.</center> | |||
}} | |||
'''SQS syntax''' was the main [[Syntax|syntax]] in [[Operation Flashpoint]] and is still available in [[Armed Assault]]. It can only be used for [[Script (File)|scripts]], but not for [[Function|functions]], in the [[Mission Editor]] or in addon config files. The alternative syntax is [[SQF syntax]]. | '''SQS syntax''' was the main [[Syntax|syntax]] in [[Operation Flashpoint]] and is still available in [[Armed Assault]]. It can only be used for [[Script (File)|scripts]], but not for [[Function|functions]], in the [[Mission Editor]] or in addon config files. The alternative syntax is [[SQF syntax]]. | ||
Revision as of 15:59, 21 December 2006
SQS syntax was the main syntax in Operation Flashpoint and is still available in Armed Assault. It can only be used for scripts, but not for functions, in the Mission Editor or in addon config files. The alternative syntax is SQF syntax.
Rules
Binding rules:
- Commands are seperated by line breaks and semicolons (;). This means that a command must not span over multiple lines.
- Curled braces ({ }) group code to blocks. A block is considered a single command, thus may not span over multiple lines.
Example:
COMMAND 1 COMMAND 2; COMMAND 3 BLOCK { COMMAND 4; COMMAND 5 }
Comments
A line beginning with a semicolon (;) is considered a comment and ignored by the game engine.
Example:
; this is my comment
Language Constructs
The control structures listed in the article Control Structures may also be used in SQS syntax. Note that they must be written within a single line due to the above rules.
There exist also special structures limited to SQS syntax.
Label
You may define labels in the code by beginning a line with #, followed by the name of the label (without spaces). You may use the command goto at any point of the script to jump to this label.
#Label1 CODE goto "Label1"
Conditional
You may query a Boolean condition and define code, that is executed only when the condition is true. Note that there is no equivalent for "else". A conditional line must start with ?, followed by the condition and :, followed by one or more commands. Multiple commands are seperated by commas (,) or semicolons (;).
? CONDITION : COMMAND 1; COMMAND 2
Notes
Due to line-based nature of Sqs scripts it is not possible to create multiline string constants in them. To overcome this limitation you can store multiline in separate SQF function files and load them using loadFile or preprocessFile (the second uses C-like preprocessor with // or /* */ comments and #define macros).