Jump to content
Sign in to follow this  
Boolean0

Problems with PixelChecksum

Recommended Posts

Boolean0

Working on a script which is trying to watch two specific areas onscreen with pixelchecksum. Below is a snippet where the problem is occuring. The first checksum ($checksum1) works fine through all iterations of the while loop. However $checksum2 fails to function when the area it is watching changes. Is the problem with Pixelchecksum itself or have I made a mistake in my If/Then/Else statement? Thanks for the suggestions.

While $units > 14 AND $extras >= 0
    
    $checksum1 = PixelChecksum(215, 211, 233, 237) ;Reset checksum
    $checksum2 = PixelChecksum(123, 281, 301, 144) ;Reset checksum
    
    While $checksum1 = PixelChecksum(215, 211, 233, 237)
        
        If $checksum2 = PixelChecksum(123, 281, 301, 144) Then
            MouseClick ( "left" , 134, 293 , 1 , 7  )
            Sleep(600)
            MouseClick ( "left" , 165, 293 , 1 , 7  )
            Sleep(600)
            MouseClick ( "left" , 337, 274 , 1 , 7  )
            Sleep(6000)
            $units = $units - 1
        ElseIf $extras > 0 Then
            Select
                Case $extras = 1
                    MouseClickDrag ( "left", 134, 321, 134, 293, 10 )
                Case $extras = 2
                    MouseClickDrag ( "left", 166, 321, 134, 293, 10 )
                Case $extras = 3
                    MouseClickDrag ( "left", 198, 321, 134, 293, 10 )
                Case $extras = 4
                    MouseClickDrag ( "left", 224, 321, 134, 293, 10 )
                Case Else
                    $extras = 4
                    MouseClickDrag ( "left", 224, 321, 134, 293, 10 )
            EndSelect
            $extras = $extras - 1
        Else
            MsgBox(0, "GUI Event", "XYZ.")
            Exit
        EndIf
    WEnd
.
.
.
WEnd

I did not include the entire code for the topmost while loop. That section functions perfectly.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.