Difference between revisions of "exitWith"

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "{{uc:{{PAGENAME}}}}" to "")
m (Text replacement - "|Game name=" to "|Game name= |gr1= Program Flow |GROUP1= ")
Line 3: Line 3:
| arma |Game name=
| arma |Game name=
|gr1= Program Flow |GROUP1=
|1.00|Game version=
|1.00|Game version=

Revision as of 11:27, 18 September 2020



Posted on May 28, 2010 - 22:15
Since ArmA2 uses Blocks in FSM as any ordinary Handle like while, for etc. in Scripts, ExitWith also only closes the Block in the FSM.
Posted on August 04, 2013 - 12:20
The command will exit the current scope - no ifs no buts. If the current scope is a loop, it will exit the loop. If the current scope is the main body of a script, it will exit the script. For more understanding of scopes and exitWith have a look at this resource.
Posted on January 06, 2014 - 13:41
To further explain Killzone_Kid's above statement, exitWith does not work as described within any subsequent inner scopes of a loop - it will only simply exit the current scope. For example, this code will not exit the while loop:
while {true} do { // 'while' scope if (player == (leader player)) then { // 'if-then' scope if (time > (5 * 60)) exitWith {}; // This will only exit the 'if-then' scope }; sleep 1; }; hint "Mission Started"; // This code will never execute

Bottom Section

Posted on March 10, 2016 - 08:31 (UTC)
Killzone Kid
exitWith cannot be used in event handlers with override ability to simply exit with override value. The following is incorrect: // INCORRECT USAGE onMapSingleClick {if (!isServer) exitWith {true}}; The override value must be returned in the main scope of EH, but since it is exited with exitWith, it never happens. The correct way in this case would be: // CORRECT USAGE onMapSingleClick {call {if (!isServer) exitWith {true}}}; exitWith will exit current call scope only and override value therefore will appear in the main scope of the EH, right where we want it.
Posted on October 12, 2016 - 17:56 (UTC)
exitWith does not use standard "if-then" syntax, but a unique "if-exitWith" structure.
exitWith will NOT take else. Attempts to do so will result in "Error exitwith: Type Array, expected code".