Jump to content

PixelSearch problems


Recommended Posts

Hi All,

Thanks for reading! I have a script that Is reliable without a pixelsearch but, the program that the script runs is not always reliable. here is the code:

Do 
        
        Sleep(1000)
        
        $color11 = PixelGetColor(561, 89)

        Sleep(1)

        $color12 = PixelGetColor(561, 89)

        Sleep(1)

        $color13 = PixelGetColor(561, 89)

        Sleep(1)

        $color14 = PixelGetColor(561, 89)

        Sleep(1)

        $color15 = PixelGetColor(561, 89)

        Sleep(1)

        $color16 = PixelGetColor(561, 89)

        Sleep(1)

        $color17 = PixelGetColor(561, 89)

        Sleep(1)

        $color18 = PixelGetColor(561, 89)

        Sleep(1)

        $color19 = PixelGetColor(561, 89)

        Sleep(1)

        $color20 = PixelGetColor(561, 89)
        
        
        $colorAverage = ($color11 + $color12 + $color13 + $color14 + $color15 + $color16 + $color17 + $color18 + $color19 + $color20) / 10
        
        
        
        If $colorAverage = 2302755 Or $colorAverage = 2368548 Or $colorAverage = 2407204 Then
            
            $win = False

            ExitLoop
                        
        ElseIf $colorAverage = 16720675 Or $colorAverage = 16720932 Then
            
            $win = True

            ExitLoop
            
        EndIf
        
        
    Until $color = 0oÝ÷ Ù8b±¹hrJr^È+y«nØ¥¶©®+jkajØ­®éì¢x"½ë-ꮢÜ"x§«¨µÊ'v+b¢x§iØ}êÞÖ«y¤ájÙj{-«Zé
.ÚÞr'7ªê-Â)êºZÖµ§¢·b    rnëmë®*')h¢H§«hêbÅém¢Ç¶ªºpz®¢Ú+ªê-,ªê-jwl¢Ø^±Êâ¦×hzÉ÷öÖ¥Á¬¬±ç­ê®¢Ü"«¨µ©Ý¦ºyçljÈØZvZ,´è­×«¶r§µú+¶¬#
èµè§hø±zTj·!jëh×6Do 
        
        Sleep(1000)
        
        $color11 = PixelGetColor(561, 89)
        Sleep(1)
        $color12 = PixelGetColor(561, 89)
        Sleep(1)
        $color13 = PixelGetColor(561, 89)
        Sleep(1)
        $color14 = PixelGetColor(561, 89)
        Sleep(1)
        $color15 = PixelGetColor(561, 89)
        Sleep(1)
        $color16 = PixelGetColor(561, 89)
        Sleep(1)
        $color17 = PixelGetColor(561, 89)
        Sleep(1)
        $color18 = PixelGetColor(561, 89)
        Sleep(1)
        $color19 = PixelGetColor(561, 89)
        Sleep(1)
        $color20 = PixelGetColor(561, 89)
        
        
        
        $colorAverage = ($color11 + $color12 + $color13 + $color14 + $color15 + $color16 + $color17 + $color18 + $color19 + $color20) / 10
        
        
        
        If $colorAverage = 2302755 Or $colorAverage = 2368548 Or $colorAverage = 2407204 Then
            
            $coordY = PixelSearch( 695, 45, 780, 60, 0xF0D300 )
    
                If Not @error Then
            
                            $win = False
                ExitLoop
            Else
            
                    $coordG = PixelSearch( 695, 45, 780, 60, 0x50FF2F )
        
                        If Not @error Then
                    $win = False
                    ExitLoop
        
                        EndIf
            EndIf
        
                    If @error Then
         
                        $win = True
                ExitLoop
            EndIf
        
                ElseIf $colorAverage = 16720675 Or $colorAverage = 16720932 Then
                $coord = PixelSearch( 695, 45, 780, 60, 0xFF0000 )
        
                    If @error Then
                $win = True
                ExitLoop
            Else
                $win = False
                ExitLoop
            EndIf
        EndIf
        
        
    Until $color = 0

This change was supposed to make the script have fewer mistakes but, it seems even more buggy. I would like to keep the PixelSearch but I get worse results.

Thanks again for reading and for your help!!

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