scriptDone: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (format)
m (Some wiki formatting)
 
(47 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma |= Game name
|game1= ofpe
|version1= 1.00


|1.00|= Game version
|game2= arma1
____________________________________________________________________________________________
|version2= 1.00


| Check if a script is finished running using the [[Script_(Handle)]] returned by [[execVM]] or [[spawn]]. |= Description
|game3= arma2
____________________________________________________________________________________________
|version3= 1.00


| '''scriptDone''' handle |= Syntax
|game4= arma2oa
|version4= 1.50


|p1= handle: [[Script_(Handle)]] returned by [[spawn]] or [[execVM]] |= Parameter 1
|game5= tkoh
|version5= 1.00


| [[Boolean]] |= Return value
|game6= arma3
____________________________________________________________________________________________
|version6= 0.50


|x1= SQS Syntax:<code>@[[scriptDone]] _Handle</code> |= Example 1
|gr1= Program Flow
____________________________________________________________________________________________


|x2= SQF Syntax:<code>script_handler = [parameters] [[execVM]] "scriptname.sqf";
|descr= Check if a script is finished running using the [[Script Handle]] returned by [[execVM]] or [[spawn]].
[[waitUntil]] { [[scriptDone]] script_handler };</code> |= Example 2
____________________________________________________________________________________________


| [[execVM]], [[spawn]], [[terminate]], [[scriptNull]]|= See also
|s1= [[scriptDone]] handle


|p1= handle: [[Script Handle]] - handle returned by [[spawn]] or [[execVM]]
|r1= [[Boolean]]
|x1= <sqf>
_scriptHandle = ["arguments"] execVM "scriptname.sqf";
waitUntil { scriptDone _scriptHandle };
</sqf>
|seealso= [[execVM]] [[spawn]] [[terminate]] [[scriptNull]]
}}
}}


<h3 style="display:none">Notes</h3>
{{Note
<dl class="command_description">
|user= Bn880
<!-- Note Section BEGIN -->
|timestamp= 20090911035400
<dd class="notedate">Posted: 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:
That is what any [[Script Handle]] becomes when a script is finished running, meaning it will test as [[true]] with:  
<code>_handle = 0 [[spawn]] {};</code>
<sqf>scriptDone _handle;</sqf>
That is what any [[Script_(Handle)]] becomes when a script is finished running, meaning it will test as [[true]] with:  
and it returns "<NULL-script>" when converted to string.
<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.</dd>
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]].
<!-- Note Section END -->
It also lets you store and manage script handles in arrays, and a few other sexy things.
</dl>
}}
 
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands|SCRIPTDONE]]
[[Category:Scripting Commands OFP Elite |SCRIPTDONE]]
[[Category:Scripting Commands ArmA|SCRIPTDONE]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]

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.