This article's documentation is for anything that uses the Source engine. Click here for more information.

Wait: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Console command}}
{{this is a|console command|name=wait}}
Stop command parsing for next '''N''' frames (or ticks, when run from a dedicated server).
Stop command parsing for next '''N''' frames (or ticks, when run from a dedicated server).


==Syntax==
==Syntax==
{{syntax|wait <number>|note=0}}
{{syntax|wait <number>|note=0}}
If omitted, defaults to 1 tick.
 
If the parameter is omitted, it defaults to 1 tick.


==Example Usage==  
==Example Usage==  
Line 10: Line 11:


==Caveats==
==Caveats==
* {{csgo}} {{portal2}} <code>wait</code> isn't available in [[CS:GO]] or [[Portal 2]] (despite sv_allow_wait_command still being present and enabled)
* {{csgo}} {{portal2}} <code>wait</code> isn't available in [[Counter-Strike: Global Offensive]] or [[Portal 2]] (despite sv_allow_wait_command still being present and enabled)
 


{{note|The following may only apply to Team Fortress 2}}


* {{warning | Some servers disable the <code>wait</code> command by using the cvar <code>sv_allow_wait_command 0</code>. If you use a looping script (which relies on <code>wait</code>) on a server with <code>wait</code> disabled, your game '''will''' crash.}}  
{{warning | Some servers disable the <code>wait</code> command by using the cvar <code>sv_allow_wait_command 0</code>. If you use a looping script (which relies on <code>wait</code>) on a server with <code>wait</code> disabled, the engine '''will''' crash.}}  


{{workaround | Use a [https://web.archive.org/web/20211022194014/https://old.reddit.com/r/tf2scripthelp/wiki/innovativescripts wait tester] to test beforehand whether or not the <code>wait</code> command is enabled. You may automate the process by hooking the aliases provided by the wait tester.}}
{{workaround|Use a script that detects if <code>wait</code> is enabled.
{{CodeBlock|<!--
      -->{{stx|type|alias}} {{stx|func|wait_enabled}} [commands to run when wait is enabled]<nowiki>
</nowiki>{{stx|type|alias}} wait "{{stx|type|alias}} {{stx|func|wait_enabled}}; [commands to run when wait is disabled]"<nowiki>
</nowiki>wait {{stx|no|0}}; {{stx|func|wait_enabled}}
}}
}}
{{stub|console command}}

Latest revision as of 14:40, 25 February 2024

wait is a console command available in all Source Source games. Stop command parsing for next N frames (or ticks, when run from a dedicated server).

Syntax

Syntax: wait <number>

If the parameter is omitted, it defaults to 1 tick.

Example Usage

+duck; wait 150; -duck

Caveats


Warning.pngWarning: Some servers disable the wait command by using the cvar sv_allow_wait_command 0. If you use a looping script (which relies on wait) on a server with wait disabled, the engine will crash.
PlacementTip.pngWorkaround:Use a script that detects if wait is enabled.
alias wait_enabled [commands to run when wait is enabled] alias wait "alias wait_enabled; [commands to run when wait is disabled]" wait 0; wait_enabled

Stub

This article or section about a console command is a stub. You can help by expanding it.