scriptDone: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(add. ArmA2 classification)
(Clarification, null script handle init.)
Line 7: Line 7:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Check if an SQF script is already finished using the return value of [[execVM]] command as the argument. |= Description
| Check if a script is finished running using the script handle returned by [[execVM]] or [[spawn]]. |= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


| '''scriptDone''' script |= Syntax
| '''scriptDone''' handle |= Syntax


|p1= script: [[Script]] |= Parameter 1
|p1= handle: script handle returned by [[spawn]] or [[execVM]] |= Parameter 1


| [[Boolean]] |= Return value
| [[Boolean]] |= Return value
Line 28: Line 28:
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->
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: <code> scriptDone _handle </code> 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.


<!-- Note Section END -->
<!-- Note Section END -->

Revision as of 03:54, 11 September 2009

-wrong parameter ("Arma") defined!-1.00
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:
Uncategorised

Syntax

Syntax:
scriptDone handle
Parameters:
handle: script handle returned by spawn or execVM
Return Value:
Boolean

Examples

Example 1:
@ScriptDone _Handle
Example 2:
script_handler = [parameters] execVM "scriptname.sqf"; waitUntil {scriptDone script_handler};

Additional Information

See also:
execVM

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

Notes

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.

Bottom Section