Sign in to follow this  
Followers 0
Metigue

Pixel detection Wildcards?

8 posts in this topic

#1 ·  Posted (edited)

In the program I have created,

It searches the same pixel over and over for a change in the colour, although some colours I don't want it to register a change for, so I created a seperate program to find out all the colours that pass over my single pixel.

However, I am distributing the program and on screen coordinates change depending on your resolution, so the colours change aswell, the beggining of the colour or group it is in does not change, so my question is, Is there a way of creating a range between two pixel colours or having a wildcard?

So e.g.

$Colour = 0x66****

or

$colour = 0x66BBBB:0x999999

Edited by Metigue

Share this post


Link to post
Share on other sites



define $color again..

$color = 0x960000

$color = 0x560000

$color = 0xFFFFFF

$color = 0x000000

$coord = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, $color, 0, 2)

If IsArray($coord) = 1 Then

blah blah blah

or

If @error Then

blah blah blah

Share this post


Link to post
Share on other sites

I don't know how to do it myself, but that will definitely not work. Every time you declare a variable, it overwrites whatever was previously stored in that variable.


The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

works for me.. sorry man

try declaring $color1 - however many you need, we'll just say from $coord1 - $coord5

then you can use the same pixelsearch for each variable

$coord1 = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, $color1, 0, 2)

$coord2 = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, $color2, 0, 2)

$coord3 = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, $color3, 0, 2)

$coord4 = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, $color4, 0, 2)

$coord5 = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, $color5, 0, 2)

then you can add all the IsArray / @error things you want it to do..

Edited by demandnothing

Share this post


Link to post
Share on other sites

With the code you posted, it would only find 0x000000.


The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites

It'd be better to use an array. Also, the op doesn't want to find a pixel, he wants to see if a pixel has changed color, but ignore certain colors.

This might work

If PixelGetColor($x, $y) <> $color[1] And PixelGetColor($x, $y) <> $color[2] And PixelGetColor($x, $y) <> $color[3] And PixelGetColor($x, $y) <> $color[4] And PixelGetColor($x, $y) <> $color[5] Then
    ;do stuff
EndIf

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

no it doesnt man.. i dont mean to sound like a prick or anything, but i use that code all the time.. it uses all the colors defined and reacts to each one.. if it only responded to the last color declared it would only react to a dark red color, but it reacts to the light blue and pure green i got declared as well

but yea, what is posted above this post would be what you're lookin for.. pixel change i didnt take into concideration.

Edited by demandnothing

Share this post


Link to post
Share on other sites
:D I'll have to test that out.

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

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