{"name":"scriptDone","operator":null,"title":"scriptDone","type":"command","url":"https://community.bistudio.com/wiki/scriptDone","revid":321342,"updated":"2022-05-13T19:10:40Z","groups":["Program Flow"],"status":"ok","replaced_by":[],"games":[{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"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":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Check if a script is finished running using the Script Handle returned by execVM or spawn.","syntaxes":[{"syntax":"scriptDone handle","since":null,"effect":null,"exec":null,"params":[{"name":"handle","type":"Script Handle","optional":false,"default":null,"description":"handle returned by spawn or execVM","types":["Script Handle"],"since":null,"text":"handle: Script Handle - handle returned by spawn or execVM"}],"returns":{"type":"Boolean","types":["Boolean"],"description":null,"text":"Boolean"},"form":"unary","operator":null,"left":null,"right":{"text":"handle","types":["Script Handle"]}}],"examples":[{"text":"```sqf\n_scriptHandle = [\"arguments\"] execVM \"scriptname.sqf\";\nwaitUntil { scriptDone _scriptHandle };\n```","code":["_scriptHandle = [\"arguments\"] execVM \"scriptname.sqf\";\nwaitUntil { scriptDone _scriptHandle };"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["execVM","spawn","terminate","scriptNull"],"notes":[{"user":"Bn880","date":"2009-09-11T03:54:00Z","text":"A Null Script handle can be created in this manner:\n\n```sqf\n_handle = 0 spawn {};\n```\n\nThat is what any Script Handle becomes when a script is finished running, meaning it will test as true with:\n\n```sqf\nscriptDone _handle;\n```\n\nand it returns \"<NULL-script>\" when converted to string.\nThis in turn lets you initialize the variable with a completed Script Handle and lets you test the variable even though nothing else may have set the handle by creating a script with spawn or execVM.\nIt also lets you store and manage script handles in arrays, and a few other sexy things."}],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Program Flow","Introduced with Operation Flashpoint: Elite version 1.00","Operation Flashpoint: Elite: New Scripting Commands","Operation Flashpoint: Elite: Scripting Commands","Scripting Commands","Take On Helicopters: Scripting Commands"]}