Script File: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Lou Montana moved page Script (File) to Script File: name standard)
m (Text replacement - "[[Image:" to "[[File:")
 
(One intermediate revision by the same user not shown)
Line 13: Line 13:




[[Image: Script_Execution.png|frame|right||Script Execution Diagram<br>'''Executing Instance:''' script, [[Function|function]] or game engine]]
[[File: Script_Execution.png|frame|right||Script Execution Diagram<br>'''Executing Instance:''' script, [[Function|function]] or game engine]]


== Execution ==
== Execution ==
Line 40: Line 40:


{{Feature | Informative |
{{Feature | Informative |
* [[execVM]] is almost like using {{ic|[[spawn]] [[compile]] [[preprocessFile]]}}.
* [[execVM]] is almost like using <sqf inline>[] spawn compile preprocessFile</sqf>.
* [[spawn]] and [[execVM]] both add the thread to the [[Scheduler]] and provide a [[Script Handle|script handle]] which allows you to check if the spawned script is done (using [[scriptDone]]).}}
* [[spawn]] and [[execVM]] both add the thread to the [[Scheduler]] and provide a [[Script Handle|script handle]] which allows you to check if the spawned script is done (using [[scriptDone]]).}}



Latest revision as of 00:09, 21 November 2023

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 Operation Flashpoint 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