Sign in to follow this  
Followers 0
will88

Pixelsearch problem

6 posts in this topic

I have been using PixelSearch for a long time(almost in every script I make), and this is the first time I've ever had a problem with it.

Posted Image

There are 2 rocks in this picture, one black and on grey. It's almost like it thinks, that there both the same color(clicks both of them). I have retaken the color of the rock several times, but it still clicks both types of rocks.

$Coords=PixelSearch(3,25,508,363,$rock)
    If Not @error Then
        $x = $Coords[0]
        $y = $Coords[1]
        $Speed = Random(2,10)
    MouseClick("left",$x,$y,1,$Speed)
        EndIf

Share this post


Link to post
Share on other sites



The Shade-variations are coinciding... In other words... The color is found in BOTH rocks... :D

Try something like this...

Dim $Colors[3]
$Colors[1] = "Color1 in rock 1"
$Colors[2] = "Color2 in rock 1"
$Colors[3] = "Color3 in rock 1"
$Coords = PixelSearch(3,25,508,363,$Colors[1])
     If Not @Error Then
          $Coords = PixelSearch(3,25,508,363,$Colors[2])
          If Not @Error Then
               $Coords = PixelSearch(3,25,508,363,$Colors[3])
               If Not @Error Then
                    $x = $Coords[0]
                    $y = $Coords[1]
                    $Speed = Random(2,10)
                    MouseClick("left",$x,$y,1,$Speed)
               EndIf
          EndIf
     EndIf

Share this post


Link to post
Share on other sites

theres another problem with pixel functionality

Wen i use get pixel colour on another application on screen

the functioon returns blue for red colour and red for blue colour ,,and hence all the other colours which are formed from RGB..its messed up.

I dont know if its a bug or mistake on my side plz comment

Share this post


Link to post
Share on other sites

The Shade-variations are coinciding... In other words... The color is found in BOTH rocks... ^_^

Try something like this...

Dim $Colors[3]
$Colors[1] = "Color1 in rock 1"
$Colors[2] = "Color2 in rock 1"
$Colors[3] = "Color3 in rock 1"
$Coords = PixelSearch(3,25,508,363,$Colors[1])
     If Not @Error Then
          $Coords = PixelSearch(3,25,508,363,$Colors[2])
          If Not @Error Then
               $Coords = PixelSearch(3,25,508,363,$Colors[3])
               If Not @Error Then
                    $x = $Coords[0]
                    $y = $Coords[1]
                    $Speed = Random(2,10)
                    MouseClick("left",$x,$y,1,$Speed)
               EndIf
          EndIf
     EndIf
Thanks, but that didn't seem to work. ;)

Share this post


Link to post
Share on other sites

Bump - Any idea's on how to avoid clicking the gray rock?

Share this post


Link to post
Share on other sites

Try:

$Coords=PixelSearch(3,25,508,363,0x101010)
If Not @error Then
    $x = $Coords[0]
    $y = $Coords[1]
    $Speed = Random(2,10)
    MouseClick("left",$x,$y,1,$Speed)
EndIf

If the image that you posted above is an exact match to the target image, then 0x101010 only exists in the darker rock.


- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!

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