Script File: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "[[{{ofp}}]]" to "{{ofp}}")
m (Text replacement - "{{SideTOC}}" to "{{TOC|side}}")
Line 1: Line 1:
{{SideTOC}}
{{TOC|side}}
A [[{{PAGENAME}}|script file]] is multiple commands and arguments defining wanted behaviour from the game, all grouped together in a textfile. This code does a specific task handled by the game engine. The common extensions for Arma scripts are '''.sqf''' and '''.sqs''', depending on the used syntax: [[SQF syntax|SQF]] or (deprecated) [[SQS syntax]].
A [[{{PAGENAME}}|script file]] is multiple commands and arguments defining wanted behaviour from the game, all grouped together in a textfile. This code does a specific task handled by the game engine. The common extensions for Arma scripts are '''.sqf''' and '''.sqs''', depending on the used syntax: [[SQF syntax|SQF]] or (deprecated) [[SQS syntax]].
{{Informative | See [[:Category:Community Tools#Code Edition|Community Tools - Code Edition]] for recommended text editors.}}
{{Informative | See [[:Category:Community Tools#Code Edition|Community Tools - Code Edition]] for recommended text editors.}}

Revision as of 04:41, 29 December 2020

A script file is multiple commands and arguments defining wanted behaviour from the game, all grouped together in a textfile. This code does a specific task handled by the game engine. The common extensions for Arma scripts are .sqf and .sqs, depending on the used syntax: SQF or (deprecated) SQS syntax.

See Community Tools - Code Edition for recommended text editors.


Syntax

In Operation Flashpoint, scripts are limited to SQS syntax.

The already existing (since OFP v1.85) SQF syntax was introduced for scripts in Armed Assault. SQS syntax is still usable but is considered deprecated since.


Script Execution Diagram
Executing Instance: script, function or game engine

Execution

Scripts can be executed from several points in the game:


The commands to execute scripts are:

exec
exec starts a thread for a script in SQS syntax.
execVM
execVM preprocesses and compiles a SQF syntax script file and starts a thread for it.
call
call adds provided Code to the stack and wait for it to execute, then returns the code's last returned value.
spawn
spawn starts a thread for provided Code.


See also