Page tree
Skip to end of metadata
Go to start of metadata

Script handle, used to identify scripts in script operations called using spawn or execVM.

When the called script is finished, the handle will contain <NULL-script>; at that point the scriptDone command will return true.
The script can be terminated by using its handle with terminate.

While the engine doesn't contain a null variable for script handles (e.g. like objNull), it can be created with by calling an empty function:
_hdlNull = 0 spawn {}

This "null handle" will return true when tested with scriptDone, and could then be used to populate an array, for example, so that any type-specific test wouldn't fail:

_hdlNull = 0 spawn {};
_handles = [_hdlNull,_hdlNull,_hdlNull];
// only element 1 contains a "real" handle
_sqlHdl1 = execVM "someScript.sqf";
_handles set [1,_sqlHdl1];
// run a type-specific command (scriptDone) against all the array elements 
_done = {scriptDone _x} count _handles;

See also: execVM, spawn, scriptDone, terminate