{"name":"scriptDone","title":"scriptDone","type":"command","url":"https://community.bistudio.com/wiki/scriptDone","revid":321342,"updated":"2022-05-13T19:10:40Z","groups":["Program Flow"],"status":"ok","games":{"ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofpe 1.00","arma3_since":"0.50","description":"Check if a script is finished running using the Script Handle returned by execVM or spawn.","syntaxes":[{"syntax":"scriptDone handle","params":[{"name":"handle","type":"Script Handle","description":"handle returned by spawn or execVM","type_expr":"Script Handle"}],"returns":{"type":"Boolean","type_expr":"Boolean"},"form":"unary","right":{"text":"handle"}}],"examples":[{"code":["_scriptHandle = [\"arguments\"] execVM \"scriptname.sqf\";\nwaitUntil { scriptDone _scriptHandle };"]}],"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."}]}