Notifications
Clear all
[Closed] How to break a endless loop??
Mar 28, 2009 8:24 pm
Hi, I have a script that is looping and wont let me access anything in max. How can I stop it?
7 Replies
Mar 28, 2009 8:24 pm
Several things can be the case, can you post the part of the script that is looping?
-Johan
Mar 28, 2009 8:24 pm
you can use the exit command to break a loop. For example…
local iterations = 0;
local maxIterations = 1000;
while (true) do
(
– do stuff here…
if (iterations > maxIterations) then
exit
iterations = iterations + 1
)
in MAXscript, ‘exit’ is the same as ‘break’ in c/c++
I hope this helps!
Mar 28, 2009 8:24 pm
also… anytime you’re still testing code that involves long / heavy loops, add this inside the loop…
if (keyboard.escPressed) do ( throw "ESCAPE PRESSED" )
That will respond to an Escape Key press much better than the built-in esc key handler which often doesn’t respond at all if the loop does heavy processing.
Mar 28, 2009 8:24 pm
ah!
I killed the 3dsmax task and restored the backup.
CODE=INSERTED!
Thanks guys!