scriptDone: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<code>([^ ]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^ ]*) ([^ ]*)<\/code>" to "<code>$1$2$3 $4</code>")
m (Some wiki formatting)
 
(2 intermediate revisions by the same user not shown)
Line 29: Line 29:
|r1= [[Boolean]]
|r1= [[Boolean]]


|x1= SQS Syntax:
|x1= <sqf>
<code>@scriptDone _Handle</code>
_scriptHandle = ["arguments"] execVM "scriptname.sqf";
 
waitUntil { scriptDone _scriptHandle };
|x2= SQF Syntax:
</sqf>
<code>script_handler = [parameters] execVM "scriptname.sqf";
waitUntil { scriptDone script_handler };</code>


|seealso= [[execVM]] [[spawn]] [[terminate]] [[scriptNull]]
|seealso= [[execVM]] [[spawn]] [[terminate]] [[scriptNull]]
}}
}}


<dl class="command_description">
{{Note
 
|user= Bn880
<dt><dt>
|timestamp= 20090911035400
<dd class="notedate">Posted on 03:54, 11 September 2009</dd>
|text= A Null Script handle can be created in this manner:
<dt class="note">[[User:Bn880|Bn880]]</dt>
<sqf>_handle = 0 spawn {};</sqf>
<dd class="note">A Null Script handle can be created in this manner:
<code>_handle = 0 spawn {};</code>
That is what any [[Script Handle]] becomes when a script is finished running, meaning it will test as [[true]] with:  
That is what any [[Script Handle]] becomes when a script is finished running, meaning it will test as [[true]] with:  
<sqf>scriptDone _handle;</sqf> 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.</dd>
<sqf>scriptDone _handle;</sqf>
 
and it returns "<NULL-script>" when converted to string.
</dl>
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.
}}

Latest revision as of 20:10, 13 May 2022

Hover & click on the images for description

Description

Description:
Check if a script is finished running using the Script Handle returned by execVM or spawn.
Groups:
Program Flow

Syntax

Syntax:
scriptDone handle
Parameters:
handle: Script Handle - handle returned by spawn or execVM
Return Value:
Boolean

Examples

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

Additional Information

See also:
execVM spawn terminate scriptNull

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Bn880 - c
Posted on Sep 11, 2009 - 03:54 (UTC)
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.