Jump to content

Loop Error


J0ker
 Share

Recommended Posts

$Color12 = PixelGetColor(424,174)
            $Color13 = PixelGetColor(612,201)
            
            If $Color12 = "0" AND $Color13 = "0" Then
                MouseClick ( "left" , 509, 430 , 1 , 5  )
                
                sleep(2500)
                
                
                MouseClick ( "left" , 525, 215 , 1 , 3  )
                sleep(1500)
                
                
                MouseClick ( "left" , 501, 288 , 1 , 3  )
                Sleep(1000)
                
                While 1
                    
                $BackB = PixelGetColor(486,259)
                If $BackB = "0" Then MouseClick ( "left" , 500, 214 , 1 , 1 )
                sleep(500)
                MouseClick ( "left" , 501, 288 , 1 , 3  )
                sleep(1000)
            
            Else
                MouseClick ( "left" , 500, 214 , 1 , 1 )
                sleep(1000)
                MouseClick ( "left" , 502, 413 , 1 , 5 )
                sleep(1000)
                ExitLoop
            EndIf
            Wend
                
                
                
            EndIf

I'm getting an error with this code but i dont know why. I ran the syntax checker and im getting like 11 errors because it bugging all my script but this doesnt help me. Does anyone can spot the problem?

Edited by J0ker
Link to comment
Share on other sites

  • Developers

This is what Tidy tells you:

While 1

    $BackB = PixelGetColor(486, 259)
    If $BackB = "0" Then MouseClick("left", 500, 214, 1, 1)
    Sleep(500)
    MouseClick("left", 501, 288, 1, 3)
    Sleep(1000)

;### Tidy Error -> "else" is closing previous "while"
Else
    MouseClick("left", 500, 214, 1, 1)
    Sleep(1000)
    MouseClick("left", 502, 413, 1, 5)
    Sleep(1000)
    ExitLoop
;### Tidy Error -> "endif" is closing previous "while"
EndIf
;### Tidy Error: next line creates a negative tablevel.
;### Tidy Error: next line creates a negative tablevel for the line after it.
WEnd

Your IF is a one line version ....

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

If I change my If, it seem to correct the problem but does it really change something to let the Then alone on one line?

$BackB = PixelGetColor(486,259)
                If $BackB = "0" Then 
                MouseClick ( "left" , 500, 214 , 1 , 1 )
                sleep(500)
                MouseClick ( "left" , 501, 288 , 1 , 3  )
                sleep(1000)
            
            Else
                MouseClick ( "left" , 500, 214 , 1 , 1 )
                sleep(1000)
                MouseClick ( "left" , 502, 413 , 1 , 5 )
                sleep(1000)
                ExitLoop
            EndIf
            Wend
Edited by J0ker
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...