SQS to SQF conversion: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (minor rephrasing)
Line 1: Line 1:
==What's different in SQF==
==What's different in SQF==
* Every command have to be ended with semicolon.
* Every command has to end with semicolon.
* Cycles with the While-Do structure are limited to 10 000 loops.
* Cycles with the While-Do structure are limited to 10 000 loops.
* SQF does not have a [[goto]] command anymore.
* SQF commands can span several lines if they are enclosed in brackets.
* SQF can return a variable, where SQS cannot.
* SQF can return a variable, where SQS cannot.


Line 17: Line 19:
  */
  */


  comment "And this is comment working both in SQS and SQF";
  comment "And this is a comment working both in SQS and SQF";
}}
}}


Line 36: Line 38:
}}
}}


===Command with condition===
===Conditional command===
{{Box_File|SQS|
{{Box_File|SQS|
  ?CONDITION: COMMAND
  ?CONDITION: COMMAND
Line 44: Line 46:
}}
}}


===Structured command with condition===
===Multi-conditional command===
{{Box_File|SQS|
{{Box_File|SQS|
  ?CONDITION: [[goto]] "SKIP"
  ?CONDITION: [[goto]] "SKIP"
COMMAND_2
  COMMAND_2
[[goto]] "END"
  [[goto]] "END"
  #SKIP
  #SKIP
COMMAND_1
  COMMAND_1
  #END
  #END
}}
}}
Line 60: Line 62:
{{Box_File|SQS|
{{Box_File|SQS|
  #loop
  #loop
COMMAND
  COMMAND
~DELAY
  ~DELAY
  ?CONDITION: [[goto]] "LOOP"
  ?CONDITION: [[goto]] "LOOP"
}}
}}
Line 75: Line 77:
  _n <nowiki>=</nowiki> 0
  _n <nowiki>=</nowiki> 0
  #LOOP
  #LOOP
COMMAND
  COMMAND
_n <nowiki>=</nowiki> _n + 1;
  _n <nowiki>=</nowiki> _n + 1;
  ?_n < COUNT: [[goto]] "LOOP"
  ?_n < COUNT: [[goto]] "LOOP"
}}
}}
Line 85: Line 87:
}}
}}


===Structured command with conditions===
===Structured conditional command===
{{Box_File|SQS|
{{Box_File|SQS|
  ?VARIABLE <nowiki>==</nowiki> VALUE_1: [[goto]] "SKIP_1"
  ?VARIABLE <nowiki>==</nowiki> VALUE_1: [[goto]] "SKIP_1"
  ?VARIABLE <nowiki>==</nowiki> VALUE_2: [[goto]] "SKIP_2"
  ?VARIABLE <nowiki>==</nowiki> VALUE_2: [[goto]] "SKIP_2"
DEFAULT
  DEFAULT COMMAND
[[goto]] "END"
  [[goto]] "END"
  #SKIP_1
  #SKIP_1
COMMAND_1
  COMMAND_1
goto "END"
  goto "END"
  #SKIP_2
  #SKIP_2
COMMAND_2
  COMMAND_2
  #END
  #END
}}
}}

Revision as of 23:51, 1 March 2007

What's different in SQF

  • Every command has to end with semicolon.
  • Cycles with the While-Do structure are limited to 10 000 loops.
  • SQF does not have a goto command anymore.
  • SQF commands can span several lines if they are enclosed in brackets.
  • SQF can return a variable, where SQS cannot.

Replacing

Comment

Template:Box File Template:Box File

Condition

Template:Box File Template:Box File

Delay

Template:Box File Template:Box File

Conditional command

Template:Box File Template:Box File

Multi-conditional command

Template:Box File Template:Box File

Cycle

Template:Box File Template:Box File

Cycle with step

Template:Box File Template:Box File

Structured conditional command

Template:Box File Template:Box File