How do I make it so when the user hits the ESC key the operation is completely stopped and canceled....
I've been trying to trouble shoot this and the help file is not really explaining it well enough in a way that is making sense.
Thanks
John
startFrame = animationRange.start
endFrame = animationRange.end
frameCount = endFrame - startFrame
step = 1
prgCount = 0
progressStart "Go:"
for t = startFrame to endFrame by step do
(
if keyboard.escPressed then
exit with (escapeEnable = false; progressEnd(); format "Canceled\n")
else (
sliderTime = t
progPerct = (100.0 * prgCount * step / frameCount) as integer --//ProgressValue
progressUpdate progPerct
prgCount += 1
)
)
progressEnd()
By
Comments (5)
Comment policy
I have implemented what you have written but once I uncomment the
progressStart "Go:"
progressUpdate progPerct
progressEnd()
And run the script I continualy get this "Question" dialog which pops up and whether i hit yes or no it still runs the for loop.....hmmm?
Yeah, the PBar is very capricious feature :)
I remember that changing
not help,
and the ESC key messed up with the PBar cancelation.
The fix is to use other key than ESC, Ctrl for example.
Also sometime needs to set progressUpdate 100.
In other words, replace last lines:
with:
An easy made logical mistake, I think. Your Exit break only stop the progressbar but not the for-loop. You can fix that with boolean pointer into the for-loop (using while), something like:
MZP
they are un-readable files?
I don't have time to find out and post the code, but download RTTAssist and check EXPLODE function. You can see haw I use ESC key to stop explosion.