Jump to content
Sign in to follow this  
Arkon2

Exit from SQF

Recommended Posts

Hi,

Can anybody tell me how to exit from an SQF script at any point - is this possible?

Arkon2

Share this post


Link to post
Share on other sites

You can for example terminate the whole script:

_scriptHandle = [] execvm "myscript.sqf";
terminate _scriptHandle;

Or, by breaking out to the main scope of the script and letting it run to the end (where it automatically exits):

scopename "mymainscope";
while {true} do {
 if (somethingIsTrue) then {
   breakto "mymainscope";
 };
};

Obviously, it's recommended to write the script so it doesn't need breakto. In this simple and silly example, you could just make the while condition to a variable and changing it to a false.

Edited by Shuko

Share this post


Link to post
Share on other sites

To exit the script from within the script itself the simplest way is

if(true) exitWith{};

The true you then can replace by any condition you want.

This command is supposed to exit the current scope, but works a charm in script scope itself. Here the detailed description: http://community.bistudio.com/wiki/exitWith

Edited by Bon

Share this post


Link to post
Share on other sites

Thanks guys for all your answers - having a look at them all...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×