Jump to content

Recommended Posts

Posted (edited)

$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
  • Developers
Posted (edited)

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.
  :)

Posted (edited)

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
Posted

I think you mean why does it matter if theres something after the then. Well the way autoit works to help shorten the code if there is anything after the Then it functions as the command and Endif so you end the IF statement

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
×
×
  • Create New...