View Full Version : how can i stop a loop
Hit Ctrl+Alt+Delete
Then in Task Manager, close the offending application. :)
Then take a look at your code and change your conditional.
What I’m saying is that each time through the loop, your code should be checking if some condition is met. If the condition is not met, you go back through the loop, if the condition is met, you break out of the loop.
Conditionals you might use are:
if/then
while
Check out (Search) for Control Structures in the Help file.
HTH
Intrigued
09-28-2006, 08:22 AM
Take a look at using break in AMS as well.
Hi Ind,
Perhaps you were looking for something like a semaphore (http://en.wikipedia.org/wiki/Semaphore_%28programming%29)?
As JimS and Intrigued have mentioned there are many different ways to break out of a loop in AutoPlay, the decision is mostly dependent on what you are doing and what you are trying to accomplish.
way the break dont work?
27 is "Esc"
for i = 1, 1000000 do
Label.SetText("Label1", i);
if e_Key == 27 then
break;
end
end
Once you are in the loop, there is nothing allowing the system to look for the keypress. A loop will only run the code within itself. Your checking the e_Key value, but the loop is already running, therefore the e_Key is never updated.
Intrigued
09-28-2006, 10:00 AM
I would suggest you explain what you are trying to do exactly and the fellas and gals here will surely fire off some suggestions, workarounds.
i wont to stop a loop whit a stop button
Once you're in the loop, the AMS interface is disabled as the loop has total focus. If you can use the Timer to do the loop, you are better off as it doesn't hold the app hostage. You could use the code below in your loop to break out with an Escape Key press.
for n=1, 10000 do
if System.IsKeyDown(27) then
break
end
Application.Sleep(1)
end
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.