Jump to content

PixelSearch search similar colors

Recommended Posts

I made a script that searches the color 4A3203.

Local $aCoord = PixelSearch($x-300, $y+300, $x+300, $y-300, 0x4A3203)

it worked at first but the color that its supposed to be searching changes very slightly.. is there anyway to have it search through multiple colors that are similar?

Local $aCoord = PixelSearch($x-300, $y+300, $x+300, $y-300, 0x4A3203 to 0x4A3209)      - I know this wont work but is there any way you can do that?

Here is the full script that i wrote(i dont really know what im doing)

   Click($x, $y)

Func Click(ByRef $x, ByRef $y)
   Local $i = $x
   Local $j = $y

   Local $aCoord = PixelSearch($x-300, $y+300, $x+300, $y-300, 0x4A3203)
   If IsArray($aCoord) = 1 Then
      MouseMove($aCoord[0], $aCoord[1])
      MouseClick("left", $aCoord[0], $aCoord[1], 1, 1)
      $x = $i
      $y = $j

Func endProg()

Link to post
Share on other sites
Func _PixelSearchEx($x, $y, $iStart, $iEnd)

    For $col = $iStart To $iEnd

        $aCoord = PixelSearch($x - 300, $y + 300, $x + 300, $y - 300, $col)
        If Not @error Then
            Return $aCoord


    Return SetError(1, 0, 0)

EndFunc   ;==>_PixelSearchEx


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...