Sign in to follow this  
Followers 0
whatamidoing

PixelSearch search similar colors

3 posts in this topic

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)

While(1)
   Click($x, $y)
WEnd

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)
      Sleep(5000)
      $x = $i
      $y = $j
   EndIf
EndFunc

Func endProg()
   Exit
EndFunc

Share this post


Link to post
Share on other sites



Quote

PixelSearch ( left, top, right, bottom, color [, shade-variation = 0 [, step = 1 [, hwnd]]] )

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

 

Share this post


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
        EndIf

    Next

    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.

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  
Followers 0