Wait - Utility
Jump to navigation
Jump to search
Member of: Utility Script
Pauses the script for at least the specified amount of real-world time. This function is latent. Unlike WaitMenuMode, time will not be counted while the player is in a menu.
Syntax[edit | edit source]
Function Wait(float afSeconds) native global
Parameters[edit | edit source]
- afSeconds: How long to wait, in real-time seconds.
Return Value[edit | edit source]
None.
Examples[edit | edit source]
; Pause our currently running stack for 5 seconds - and do not count the time spent in a menu
Utility.Wait(5.0)
Notes[edit | edit source]
- This function is often used to wait until a currently-open menu is closed, by waiting for a small amount of time (eg 0.001 or so).
- Crafting menus, conversations, and certain other IU "menus" do not count as menus for this purpose, since they do not pause the game. See IsInMenuMode for alternative detection methods.
- Wait time isn't precise, based on framerate and general Papyrus system workload.
- A wait time of 0 won't actually wait (??? check: even if in a menu?), and will just return immediately.
There is a veritable plethora of ways that scripts, actors and the PC may wait. These include:
- Wait - console command.
- Wait (Procedure) - causes an actor to wait a number of real-world, non-menu seconds.
- WaitGameTime - Utility - like this command, but measures in game-time.
- WaitMenuMode - Utility - like this command, but will count time spent in menus.
- Pause - SoundCategory - causes a sound to pause indefinitely.
- Latent Functions - perform many common operations and wait for them to complete.
- Events - permit scripts to register for, and wait for, in-game events.
- OnUpdateGameTime - Form - In particular, an event can be set for a timer.
- GetCurrentRealTime /GetCurrentGameTime - Utility - can be used for creating your own timers.
- Scene Timer Action Fragments - let you perform timing within scenes.
- Sleep (Procedure) - causes the Actor to sleep, and may work on the PC.
- SetPCSleepHours - causes game time to pass as if the PC is sleeping or waiting.
- ServeTime - Game - causes game time to pass as if the PC is serving time in jail.