---
name: "Script File"
type: topic
aliases: ["Script (File)"]
source: https://community.bistudio.com/wiki/Script_File
revid: 364510
updated: 2024-05-16T20:42:07Z
---

# Script File

A [script file](../topics/Script_File.md) 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](../topics/SQF_Syntax.md) or (deprecated) [SQS Syntax](../topics/SQS_Syntax.md).

> [!NOTE]
> See Community Tools - Code Edition for recommended text editors.

### Syntax

In Operation Flashpoint, scripts are limited to [SQS Syntax](../topics/SQS_Syntax.md).

- See [exec](../commands/exec.md)

The already existing (since Operation Flashpoint v1.85) [SQF Syntax](../topics/SQF_Syntax.md) was introduced for scripts in Armed Assault. [SQS Syntax](../topics/SQS_Syntax.md) is still usable but is considered deprecated since.

- See [execVM](../commands/execVM.md), [spawn](../commands/spawn.md)

### Execution

Scripts can be executed from several points in the game:

- Other scripts
- Other [functions](../topics/Function.md)
- Init fields and (de)activation triggers in the Mission Editor
- Event Handlers in addon config files

The commands to execute scripts are:

**exec:** [exec](../commands/exec.md) starts a thread for a script in [SQS Syntax](../topics/SQS_Syntax.md).

**execVM:** [execVM](../commands/execVM.md) [preprocesses](../commands/preprocessFileLineNumbers.md) and [compiles](../commands/compile.md) a [SQF Syntax](../topics/SQF_Syntax.md) script file and starts a thread for it.

**call:** [call](../commands/call.md) adds provided [Code](../topics/Code.md) to the stack and wait for it to execute, then returns the code's last returned value.

**spawn:** [spawn](../commands/spawn.md) starts a thread for provided [Code](../topics/Code.md).

> [!NOTE]
> - [execVM](../commands/execVM.md) is almost like using `[] spawn compile preprocessFile`.
> - [spawn](../commands/spawn.md) and [execVM](../commands/execVM.md) both add the thread to the [Scheduler](../topics/Scheduler.md) and provide a [script handle](../topics/Script_Handle.md) which allows you to check if the spawned script is done (using [scriptDone](../commands/scriptDone.md)).

### See also

- [Functions](../topics/Function.md)
- Syntax
  - [SQF Syntax](../topics/SQF_Syntax.md)
  - [SQS Syntax](../topics/SQS_Syntax.md)
- [Statement](../topics/Statement.md)

<sub>Source: [BI Community Wiki — Script File](https://community.bistudio.com/wiki/Script_File) (revision 364510).</sub>
