ScriptSpot

Forum topic · General Scripting

Exit / Escape / Quit a running script

By br0t · 2011-06-21

Description

Hey,
I have a script that renders out a number of images, one by one as single images, not a frame range or stuff like that. It changes some texture maps and says

max quick render

in the last of three nested for loops. So lets say when testing the script, I want it to start and maybe render 1 or 2 images and then I want to stop it. Right now I have to cancel each rendering manually by clicking on the "Cancel" button. The script is meant to render hundreds of images, so that will not be a nice way of quitting script execution...

Is there any way to end the script, e.g. by pressing the escape button for 5secs or so? Maybe there is a callback for this, butI have to get out of the for-loop, and I dont know how.

Cheers

Comments (3)

br0t · 2011-06-21

sounds good to me, I will try that! Thanks, also for your continuing help even in some of my pretty old threads, I havent had the time to answer some of them yet so I do it here: thanks ;)

Swordslayer · 2011-06-21

My pleasure :)

Swordslayer · 2011-06-21

I'd say the most common way of exiting the for-loop this way is using something like

if keyboard.escPressed do exit

inside the loop or just

for i = 1 to ... while NOT keyboard.escPressed do ...

. Of course this condition is checked only at the start of each iteration so it only makes sense to hold the escape key at that time...