Jump to content

searching for change of pixel


Recommended Posts

Alright ive made a small script that located where a certian colored pixel is. I then need it to check that area and a small area around it to see if the pixels in that area change to white.

This is what ive come up with so far

do

$cords = pixelsearch(150,200,600,500, 0xCA5316, 20) //finds my pixel

mousemove($cords[0],$cords[1]) // moves mouse to pixel

$x1 = $cords[0] - 10 //

$x2 = $cords[1] - 10 // creates vars that are 10 pixels greater than the targeted

$y1 = $cords[0] + 10 //area.

$y2 = $cords[1] + 10 //

Now i cant seem to think of a way to see if any of those pixel change to white. I thought I could do another pixelsearch with x1,x2,y1,y2 cords and 0xFFFFFF parameters and then when it found a white pixel would break me out of my loop but I either did somthing wrong or somthing because no matter what, I would break out immediately after my mouse moved to the orignal pixel spot. Any idea what I could try?

I tried this>

do

$newcords = pixelsearch($x1,$x2,$y1,$y2, 0xFFFFFF)

until $newcords > 0

With the thought that it would give newcords a value when it found pixel and kick me out of the loop..but obviously this logic was flawed

Link to comment
Share on other sites

I tried this>

do

$newcords = pixelsearch($x1,$x2,$y1,$y2, 0xFFFFFF)

until $newcords > 0

With the thought that it would give newcords a value when it found pixel and kick me out of the loop..but obviously this logic was flawed

<{POST_SNAPBACK}>

The problem is that when PixelSearch does not find a matching color, it returns the integer 1 (although not mentioned in the help file) instead of an array.

You should either check to see if the returned value is an array with the IsArray function, or check if @error = 0. When either is true, the color was found.

Phillip

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...