shag Posted October 9, 2010 Posted October 9, 2010 I have one main while loop and have couple while loops inside my structure is like while 1 ;some codes while *condition* ;some codes wend if *condition* continueloop endif wend when i did this continueloop restarts the code back to the loop inside not the main loop. I tried to look for some example, but i think i'm the only one with this problem.. lol how can I fix this? thank you in advance!
JohnOne Posted October 9, 2010 Posted October 9, 2010 Probably start by using the level paramater for ContinueLoop(). AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
jaberwacky Posted October 9, 2010 Posted October 9, 2010 You say you have one main while loop with two while loops inside but I'm only seeing one while loop inside of there. Helpful Posts and Websites: AutoIt Wiki | Can't find what you're looking for on the Forum? My scripts: Guiscape | Baroque AU3 Code Formatter | MouseHoverCalltips | SciTe Customization GUI | ActiveWindowTrack Toy | Monitor Configuration UDF
shag Posted October 9, 2010 Author Posted October 9, 2010 You say you have one main while loop with two while loops inside but I'm only seeing one while loop inside of there.I have continueloop after the second loop for starting back to main loop, but it also goes back to the second loop not the main loop
shag Posted October 9, 2010 Author Posted October 9, 2010 Probably start by using the level paramater for ContinueLoop().I was wondering what I need to put in there 1 or some other number?
shag Posted October 9, 2010 Author Posted October 9, 2010 Do you have a working example?it's not my code, so i didn't want to pose it online for the respect for distributor, but is that really needed? I can make an example that work i guess..
MrMitchell Posted October 9, 2010 Posted October 9, 2010 it's not my code, so i didn't want to pose it online for the respect for distributor, but is that really needed? I can make an example that work i guess..A really simple **working** example would help...as jaberwocky said your structure example doesn't seem match your description of the problem.
shag Posted October 9, 2010 Author Posted October 9, 2010 A really simple **working** example would help...as jaberwocky said your structure example doesn't seem match your description of the problem. while 1 $load=0 $counter=0 While ($load=0 AND $counter<50) $load = _ImageSearchArea("loading.BMP",0,$centre_x-35,$centre_y-100,$centre_x+35,$centre_y-10,$loading_x,$loading_y,80) $counter = $counter + 1 WEnd if $load=0 Then ContinueLoop EndIf $loaded=0 $countersec=0 While ($loaded=0 AND $countersec<50) $load = _ImageSearchArea("loaded.BMP",0,$centre_x-35,$centre_y-100,$centre_x+35,$centre_y-10,$loading_x,$loading_y,80) $countersec = $countersec + 1 WEnd if $loaded=0 Then ContinueLoop EndIf WEnd so this is basically the code. what I want is for ContinueLoop to go back to main while loop "while 1" not the loop inside above the if statement.
MrMitchell Posted October 9, 2010 Posted October 9, 2010 Try this: While ($load=0 AND $counter<50) $load = _ImageSearchArea("loading.BMP",0,$centre_x-35,$centre_y-100,$centre_x+35,$centre_y-10,$loading_x,$loading_y,80) $counter = $counter + 1 If $load = 50 and $counter = 49 Then ContinueLoop(2) WEnd it might not work, but do you see what I am getting at?
PsaltyDS Posted October 9, 2010 Posted October 9, 2010 (edited) All your instances of ContinueLoop are in the outer loop. There is no way ContinueLoop is taking it back into one of the nested loops. But with that example I don't know how you would know the difference, since on returning to the start of the outer loop, normal program flow takes it right back into the first nested loop anyway. Edit: Maybe this helps to see how it's working: HotKeySet("{ESC}", "_Quit") While 1 ConsoleWrite("Top of loop 1" & @LF) $a = 0 $b = 0 While ($a = 0) And ($b < 5) ConsoleWrite($a & "-" & $b & @LF) $b += 1 Sleep(500) WEnd If $a = 0 Then ContinueLoop ConsoleWrite("End of loop 1" & @LF) WEnd Func _Quit() Exit EndFunc ;==>_Quit Edited October 9, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
shag Posted October 9, 2010 Author Posted October 9, 2010 All your instances of ContinueLoop are in the outer loop. There is no way ContinueLoop is taking back into one of the nested loops. But with that example I don't know how you would know the difference, since on returning to the start of the outer loop, normal program flow takes it right back into the first nested loop anyway.there are more codes in the the main while loopI have tested the code with mousemove to see if the continueloop brings it back to main loop or not
shag Posted October 9, 2010 Author Posted October 9, 2010 anyone know the right way of using level for ContinueLoop? I tried ContinueLoop(2), ContinueLoop [2], and ContinueLoop[2]... non of them works..
shag Posted October 9, 2010 Author Posted October 9, 2010 ...nvm i think it was somekind of weird bug... I moved the if statement to front(untab) now it works.. lol thanks everyone who replied!
PsaltyDS Posted October 9, 2010 Posted October 9, 2010 anyone know the right way of using level for ContinueLoop? I tried ContinueLoop(2), ContinueLoop [2], and ContinueLoop[2]... non of them works.. Here's an example: For $a = 0 To 3 For $b = 0 To 3 For $c = 0 To 3 Sleep(500) If $b = 2 Then ContinueLoop 2 ConsoleWrite($a & "-" & $b & "-" & $c & @LF) Next Next Next The ContinueLoop statement is in the "c" loop, and without any argument (or 1) would just return to the top of the "c" loop. With a 2 it goes back to the "b" loop, and if it had a 3 it would go back to the "a" loop. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now