Jump to content
Sign in to follow this  
coolfact

Problem exiting while loop

Recommended Posts

The overall situation is that I have built a GUI where I can add three inputs, to a map marker script, containing following while loop:

while {?????} do //
{
	_Name setMarkerPosLocal [(getPos leader _grp select 0),(getPos leader _grp select 1)];
	sleep 6;
};

now lets say I'm not happy with my input choice, and want to change them, then I am running the same script, which makes another marker(now I have two markers), so my problem is how can I break the first script "while loop", while still running the second one?

Share this post


Link to post
Share on other sites

You will need an if exitWith check in the while loop, something like this:

//Psuedo code
while {blah} do
{
//code

if (isNull _marker) exitWith {};

};

Share this post


Link to post
Share on other sites

spawn, terminate

loop1 = [] spawn
{
while {true} do
{
};
};

loop2 = [] spawn
{
while {true} do
{
};
};

//now you decide you don't want to use loop1 anymore
terminate loop1;

Share this post


Link to post
Share on other sites

my problem exit this loop intro and back game

 

titlecut [" ","BLACK IN",3];
_camera = "camera" camcreate [0,0,0];
_camera cameraeffect ["external", "front"];
showCinemaBorder true;
 
while {true} do
{
_aliveCount = count allUnits; 
_aliveSelect = _aliveCount - 1;
_randomSelect = round random _aliveSelect;
_newTarget = allUnits select _randomSelect;
_camera camsettarget _newTarget;
_randomX = (random 6);
_randomY = (random 6);
_camera camsetrelpos [_randomX,_randomY,4];
_camera camcommit 0;
sleep (3+ (random 6));
 
};

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  

×