Jump to content
Sign in to follow this  
Cliffy123

PixelSearch Help

Recommended Posts

Cliffy123

Hi,

I'm new to this forum and I'm trying to use PixelSearch but it doesn't seem to be working. I wanted to optimize it's performance by only searching 1 pixel. I used the Au3 Info tool to collect the exact color. When I search for it I can't find it. I also tried increasing the size of the box to the whole orange area I was searching for and I still couldn't find it. It couldn't locate a pixel of this color unless i changed the shade tolerance to 180. Here is my code:

Func playSearch()
    Local $orange = 0xAD5104
    Local $keepLooping = 1
    While $keepLooping = 1
        Sleep(100)

        ;Focus window
        $hWnd = ControlGetHandle("PVP.net Patcher", "", "")

        $coor = PixelSearch(650, 555, 652, 557, $orange, 10, 1, $hWnd)
        If not @error Then
           $keepLooping = 0

           ;click play
           ControlClick("", "", $hWnd, "", 1, $coor[0], $coor[1])
        Else
           MsgBox(1, "Nope", "You Fail", "", "")
            EndIf
    WEnd
EndFunc

The button does lite up when you cursor over it, but it is not lit up when the tool goes over and gets the color information, so I don't think it is that.

Any help would be greatly appreciated!

Thanks

Share this post


Link to post
Share on other sites
dexto

Its working you just not sampling color right. Button changes color when you mouse is over it.

Share this post


Link to post
Share on other sites
Cliffy123

I am sampling right I'm pretty sure. I tried getting the sample when it was lite up and it did not work even with 255 shader leniency. The other set does work at a shade leniency of about 180ish but i would rather have it with less leniency as that is a lot. Can I get this to work or should i just set it to the high leniency and forget about it. Any help is greatly appreciated.

Share this post


Link to post
Share on other sites
rockets

try

if @error <> 1 then

instead of

If not @error Then
Edited by rockets

Share this post


Link to post
Share on other sites
dexto

Add to the top

Opt("PixelCoordMode", 2)

gg

Add me at lol "nvn"

Edited by dexto

Share this post


Link to post
Share on other sites
Cliffy123

Add to the top

Opt("PixelCoordMode", 2)

gg

Add me at lol "nvn"

This worked perfectly thank you!

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  

×