uiSleep: Difference between revisions

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


| arma2 |= Game name
|game1= arma2
|version1= 1.05


|1.05|= Game version
|game2= arma2oa
____________________________________________________________________________________________
|version2= 1.50


| Suspend execution of script for given uitime.  uiSleep is a sleep method to delay script execution where script time/simulation time is stopped. uiSleep is basically using the system time (uiTime more specifically) and not simulation time. So in the cases where sleep command would get stuck indefinitely, uiSleep can still be used to effectively delay script execution. For example in a mission briefing or an editor or when simulation is paused in general.  |DESCRIPTION=
|game3= tkoh
____________________________________________________________________________________________
|version3= 1.00


| '''uiSleep''' delay |SYNTAX=
|game4= arma3
|version4= 0.50


|p1= delay : [[Number]] |PARAMETER1=
|gr1= Program Flow


| [[Nothing]] |RETURNVALUE=
|descr= Suspend execution of script for given UI time. [[uiSleep]] is a sleep method to delay script execution where script time/simulation time is stopped.
____________________________________________________________________________________________
[[uiSleep]] is basically using the system time (uiTime more specifically) and not simulation time.
|x1 = <code> '''uiSleep''' 0.5 </code>
So in the cases where [[sleep]] would get stuck indefinitely, [[uiSleep]] can still be used to effectively delay script execution for example in pause or in a mission briefing or an editor or when simulation is paused in general.
| [[sleep]], [[waitUntil]], [[canSuspend]], [[spawn]], [[execVM]], [[Control Structures]], [[sleep vs uiSleep]] |SEEALSO=


}}
|s1= [[uiSleep]] delay
 
|p1= delay: [[Number]]
 
|r1= [[Nothing]]


<h3 style="display:none">Notes</h3>
|x1= In singleplayer:
<dl class="command_description">
<sqf>
<!-- Note Section BEGIN -->
setAccTime 0.25; // slows down time
<!-- Note Section END -->
sleep 1; // waits for 1 second in-game, 4 IRL seconds (1 / 0.25)
</dl>


<h3 style="display:none">Bottom Section</h3>
setAccTime 0; // freezes simulation
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
// sleep 1; // would wait forever
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
uiSleep 1; // waits for 1 IRL second
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
</sqf>
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:ArmA 2: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]


<!-- CONTINUE Notes -->
|seealso= [[sleep]] [[waitUntil]] [[canSuspend]] [[spawn]] [[execVM]] [[Control Structures]] [[sleep vs uiSleep]]
<dl class="command_description">
}}
<dd class="notedate">Posted on March 28, 2016 - 10:40 (UTC)</dd>
<dt class="note">[[User:Revo|Revo]]</dt>
<dd class="note">
If the game is paused in SP (via ESC) the sleep command will stop working, to prevent that use uiSleep.
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 03:27, 18 April 2023

Hover & click on the images for description

Description

Description:
Suspend execution of script for given UI time. uiSleep is a sleep method to delay script execution where script time/simulation time is stopped. uiSleep is basically using the system time (uiTime more specifically) and not simulation time. So in the cases where sleep would get stuck indefinitely, uiSleep can still be used to effectively delay script execution for example in pause or in a mission briefing or an editor or when simulation is paused in general.
Groups:
Program Flow

Syntax

Syntax:
uiSleep delay
Parameters:
delay: Number
Return Value:
Nothing

Examples

Example 1:
In singleplayer:
setAccTime 0.25; // slows down time sleep 1; // waits for 1 second in-game, 4 IRL seconds (1 / 0.25) setAccTime 0; // freezes simulation // sleep 1; // would wait forever uiSleep 1; // waits for 1 IRL second

Additional Information

See also:
sleep waitUntil canSuspend spawn execVM Control Structures sleep vs uiSleep

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