Sign in to follow this  
Followers 0
Karasu

PixelSearch - weird colour

2 posts in this topic

Hi,

my problem is that I use PixelSearch to determine a colour - I do this check in a while loop. In the first run it does detect the colour, but then the output becomes "000001" in Hex which is none of the colours I look for, and I believe it is not present on the screen..

I even tried that I reset the variable storing the result of the method, but it doesn't work.

Any idea?

Present colours are red, white, grey, and blue - their values aren't even close to this strange value.

Here's the snippet:

While $g < 1
    
    $d = $d + 15 (these are coordinates, nothing relevant I believe)
    $c = $c + 15
    $f = $f + 15

    MsgBox(64, "Bigyo", $d)
    MsgBox(64, "Bigyo", $c)

    $e = PixelSearch(812, $d, 852, $f, 0x000000)
    ;$e = PixelGetColor(822, $d)
    MsgBox(64, "Bigyo", Hex($e, 6))
bla
bla
bla

WEnd

Thanks in advance everyone!

Cheers,

Kara

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

These lines make no sense:

$e = PixelSearch(812, $d, 852, $f, 0x000000)

;$e = PixelGetColor(822, $d)

MsgBox(64, "Bigyo", Hex($e, 6))

PixelSearch returns an array (X, Y coordinates) upon success, so first off you should be checking the result with IsArray(), secondly you are attempting to convert said array to hex.

$e = PixelSearch(812, $d, 852, $f, 0x000000)

If NOT IsArray($e) Then

MsgBox(0,"","Pixel not found")

EndIf

MsgBox(64, "Bigyo", "X:" & $e[0] & " Y:" & $e[1])

EDIT: Man this topic is like deja-vu http://www.autoitscript.com/forum/index.ph...;hl=pixelsearch

Edited by weaponx

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