Arma 3 Scripting

scriptDone

  • Arma 3 v0.50
  • First in Operation Flashpoint: Elite v1.00

Command · Markdown · JSON · original wiki page

Description

Check if a script is finished running using the Script Handle returned by execVM or spawn.

Syntax

scriptDone handle

Parameters:

Returns: Boolean

Examples

Example 1

_scriptHandle = ["arguments"] execVM "scriptname.sqf";
waitUntil { scriptDone _scriptHandle };

See also

execVM · spawn · terminate · scriptNull

Community notes

Bn880

A Null Script handle can be created in this manner:

_handle = 0 spawn {};

That is what any Script Handle becomes when a script is finished running, meaning it will test as true with:

scriptDone _handle;

and it returns "<NULL-script>" when converted to string. This in turn lets you initialize the variable with a completed Script Handle and lets you test the variable even though nothing else may have set the handle by creating a script with spawn or execVM. It also lets you store and manage script handles in arrays, and a few other sexy things.