Disguised
Disguised

Reputation: 21

Detect change in color of pixel

I'm new to making programs and I have no idea where to really begin. However I have this simple idea that I want to turn into reality.

I need to find a red pixel in a blue area on screen. The area is a rectangle from

(x = 86)(y = 457) to (x = 770)(y = 641) -- that's just can example.

Then get a list of all the pixels within that region and check if they are a certain color like (Red=186, Blue=10, Green=10) Then 0.2 seconds later check if those pixels that were red are still red. Then check again 3 times, every 0.2 seconds.

After that tell the program to wait until those pixels turn blue. When they do open C:User/User1/documentss/pull.mcs --random file.

I would like to create this thing, but I have no idea how to get all the pixels within a certain region (since there is thousands and doing it manually won't work) then check their color and finally tell the program to open another program.

The picture attached is what I am working on, this red thing moves and I need to first find where it is and then make sure that the pixel stays red. Eventually the thing will sink and I need a program to start.

Thanks for reading and please give me some suggestions.

https://i.sstatic.net/EvC6t.png

Upvotes: 0

Views: 1227

Answers (1)

BUDDGAF
BUDDGAF

Reputation: 1

In case someone else is looking for a solution to a problem like this. This can e accomplished with autohotkey very easily.

"find a red pixel in a blue area on screen. The area is a rectangle from (x = 86)(y = 457) to (x = 770)(y = 641)"

in this example the red area is irrelevant, we're just looking for the blue pixel

PixelSearch, x, y, 457, 770, 770, 641, 0x0000FF, Fast RGB
if (ErrorLevel = 0){    
    MsgBox, Found the pixel at %x%,%y%
}
else MsgBox, We did not find the pixel.

Return  

Upvotes: 0

Related Questions