{"name":"startLoadingScreen","operator":null,"title":"startLoadingScreen","type":"command","url":"https://community.bistudio.com/wiki/startLoadingScreen","revid":369458,"updated":"2024-09-06T08:44:54Z","groups":["System"],"status":"ok","replaced_by":[],"games":[{"game":"arma2","name":"Arma 2","version":"1.00"},{"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.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Shows loading screen with the given text, using the given resource.\nWhile loading screen is shown, simulation and scene drawing is disabled, user control is disabled, mouse cursor is hidden, scripts run at full speed (50ms per frame instead of 3ms per frame for Scheduled Scripts).\n\n> [!NOTE]\n>\n\n> [!WARNING]\n> - The loading screen does **not** end by itself and absolutely needs a call to endLoadingScreen command\n> - Game simulation is disabled during Loading Screen operation (at least in single player):\n>   - do **not** use the sleep command between startLoadingScreen and endLoadingScreen as **it may freeze the game** - use uiSleep instead\n>   - waitUntil *can* be used to wait for variable initialisation or script loading\n\n> [!NOTE]\n> **Arma 3:** - Use BIS_fnc_startLoadingScreen to prevent potential usage conflicts.\n> - The loading screen can be force-ended with the ENDLOAD cheat code.","syntaxes":[{"syntax":"startLoadingScreen [text, resource]","since":null,"effect":null,"exec":null,"params":[{"name":"text","type":"String","optional":false,"default":null,"description":null,"types":["String"],"since":null,"text":"text: String"},{"name":"resource","type":"String","optional":true,"default":null,"description":null,"types":["String"],"since":null,"text":"resource: String - (Optional)"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"unary","operator":null,"left":null,"right":{"text":"[text, resource]","types":["Array"]}}],"examples":[{"text":"```sqf\nstartLoadingScreen [\"Loading My Mission, please wait...\"];\n```","code":["startLoadingScreen [\"Loading My Mission, please wait...\"];"]},{"text":"```sqf\nstartLoadingScreen [\"Can't skip loading time...\", \"MyLoadingRsc\"];\n```","code":["startLoadingScreen [\"Can't skip loading time...\", \"MyLoadingRsc\"];"]},{"text":"```sqf\nstartLoadingScreen [\"Loading My Mission\"];\n// code\nprogressLoadingScreen 0.5;\n// code\nendLoadingScreen;\n```","code":["startLoadingScreen [\"Loading My Mission\"];\n// code\nprogressLoadingScreen 0.5;\n// code\nendLoadingScreen;"]},{"text":"```sqf\n// this structure prevents error-prone or lengthy code to miss endLoadingScreen.\nprivate _maxTime = diag_tickTime + 30; // max 30s of loading\n\nstartLoadingScreen [\"Loading\"];\nprivate _handle = 0 spawn {\n    // code that may crash or take too long\n};\n\nwaitUntil { uiSleep .1; scriptDone _handle || diag_tickTime > _maxTime };\nendLoadingScreen;\n```","code":["// this structure prevents error-prone or lengthy code to miss endLoadingScreen.\nprivate _maxTime = diag_tickTime + 30; // max 30s of loading\n\nstartLoadingScreen [\"Loading\"];\nprivate _handle = 0 spawn {\n\t// code that may crash or take too long\n};\n\nwaitUntil { uiSleep .1; scriptDone _handle || diag_tickTime > _maxTime };\nendLoadingScreen;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["endLoadingScreen","progressLoadingScreen","BIS_fnc_startLoadingScreen","import (Config)"],"notes":[{"user":"Killzone_Kid","date":"2015-11-21T18:38:00Z","text":"The default Arma 3 loading screen has no control to display text."}],"categories":["Arma 2: New Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: System","Introduced with Arma 2 version 1.00","Scripting Commands","Take On Helicopters: Scripting Commands"]}