Murklor 10 Posted July 22, 2009 Here's part of my script: else { hintSilent "WEST CANNOT CAPTURE THIS ZONE!"; sleep 1; exit; }; // West was already the owner of the zone if (_currentowner == 1) then { hintsilent "WEST OWNS THIS ZONE!"; _stillunits = false; } else { // Set marker color to west hintSilent "WEST CAPTURED THE ZONE!"; _zonemarker setMarkerColor "ColorBlue"; _stillunits = false; }; Notice the little "exit;" at the first else (_stillunits = false is the haxxor way of quitting the loop that's quickly becoming cumbersome for multiple ifs). The problem here is that the script totally bypass it, as if it doesnt even exist. It goes into the else and prints that you cannot capture the zone, sleeps for 1 second and then prints that you've captured the zone. Why does it jump over the exit command alltogether? :confused: Or does exit just quit the current nest level? You'd think this little command is the simplest of things but noooooooo :p Share this post Link to post Share on other sites
Big Dawg KS 6 Posted July 22, 2009 I'm pretty sure exit shouldn't work at all in .sqf, it's an .sqs only command. Share this post Link to post Share on other sites
Murklor 10 Posted July 22, 2009 Oh well that could explain it. So how do one exit an sqf? Share this post Link to post Share on other sites
bobby budnick 0 Posted July 22, 2009 Use exitWith{}; You can put something in between the brackets too for it to do when it exits. Like this: exitWith{hint "Exiting Now"}; Share this post Link to post Share on other sites
Murklor 10 Posted July 22, 2009 Ah, I never thought of using that... because I never had a need to fill in anything in brackes, lol. Thanks. Share this post Link to post Share on other sites
Big Dawg KS 6 Posted July 22, 2009 Well, if you have good program flow you shouldn't even be exiting in the middle of execution. ExitWith is not meant to be used to exit out of scripts. You should refactor your code so that the whole script gets evaluated. Share this post Link to post Share on other sites
Murklor 10 Posted July 22, 2009 Well, if you have good program flow you shouldn't even be exiting in the middle of execution. ExitWith is not meant to be used to exit out of scripts. You should refactor your code so that the whole script gets evaluated. I dont, because I'm lazy :p Share this post Link to post Share on other sites
Big Dawg KS 6 Posted July 22, 2009 I would expect a lazy person (myself as an example) to want to write shorter code, thus using better program flow... :rolleyes: or did you mean the refactoring? Laziness isn't an excuse for bad code. ;) Share this post Link to post Share on other sites