{"name":"uiSleep","operator":null,"title":"uiSleep","type":"command","url":"https://community.bistudio.com/wiki/uiSleep","revid":370497,"updated":"2024-12-26T17:41:42Z","groups":["Program Flow"],"status":"ok","replaced_by":[],"games":[{"game":"arma2","name":"Arma 2","version":"1.05"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma2","name":"Arma 2","version":"1.05"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Suspend execution of script for given uiTime. uiSleep is a sleep method to delay script execution where script time/simulation time is stopped.\nuiSleep is basically using the system time (uiTime more specifically) and not simulation time.\nSo 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.","syntaxes":[{"syntax":"uiSleep delay","since":null,"effect":null,"exec":null,"params":[{"name":"delay","type":"Number","optional":false,"default":null,"description":null,"types":["Number"],"since":null,"text":"delay: Number"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"unary","operator":null,"left":null,"right":{"text":"delay","types":["Number"]}}],"examples":[{"text":"In singleplayer:\n\n```sqf\nsetAccTime 0.25;    // slows down time\nsleep 1;            // waits for 1 second in-game, 4 IRL seconds (1 / 0.25)\n\nsetAccTime 0;        // freezes simulation\n// sleep 1;            // would wait forever\nuiSleep 1;            // waits for 1 IRL second\n```","code":["setAccTime 0.25;\t// slows down time\nsleep 1;\t\t\t// waits for 1 second in-game, 4 IRL seconds (1 / 0.25)\n\nsetAccTime 0;\t\t// freezes simulation\n// sleep 1;\t\t\t// would wait forever\nuiSleep 1;\t\t\t// waits for 1 IRL second"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["uiTime","sleep","waitUntil","canSuspend","spawn","execVM","Control Structures","sleep vs uiSleep"],"notes":[],"categories":["Arma 2: New Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Program Flow","Introduced with Arma 2 version 1.05","Scripting Commands","Take On Helicopters: Scripting Commands"]}