JacobJ 10 Posted June 23, 2011 Hey all I have a while (true) loop atm. But how can I use another script to make this loop false, if I don't want it to run anymore? Can I make a variable like this: fox = true; And then put fox into the condition ()'s? And whenever I want to make the loop stop, then just: fox = false; ? I have tried, but it doesnt seem to work. Maybe something I have missed about this? /Jacob Share this post Link to post Share on other sites
CarlGustaffa 3 Posted June 23, 2011 why not: fox = true; while {fox} do { ...whatever if (condition) then {fox = false}; }; Share this post Link to post Share on other sites
JacobJ 10 Posted June 23, 2011 Does the: if (condition) then {fox = false}; have to be inside the while code? Can it not be in another script? Share this post Link to post Share on other sites
messiahua 0 Posted June 23, 2011 Does the:if (condition) then {fox = false}; have to be inside the while code? Can it not be in another script? No it hasn't, you can change fox variable anywhere, because it's global. Share this post Link to post Share on other sites
JacobJ 10 Posted June 23, 2011 Okay thanks, I will try that out and see if I can get it working. Share this post Link to post Share on other sites
Woodpeckersam 18 Posted June 23, 2011 while {true} do { [indent]if (fox == 1) then { [indent]code....[/indent] };[/indent]}; put this in a script and run it at init. Everytime you set fox = 1 (inside ANY SCRIPT in your mission, even in the mission editor... triggers.. etc), it will run the code inside the if statement. If you set fox = 0 it will not run it, until you change it back to 1. Do this as many times as you like =) Share this post Link to post Share on other sites
JacobJ 10 Posted June 23, 2011 Are okay I see, thats another way to do it. Thank you for that example, I will try that out. Share this post Link to post Share on other sites