Jump to content

Recommended Posts

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
Posted

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

Posted

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.

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
Posted

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.

Posted

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.

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
Posted
: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.

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
  • Recently Browsing   0 members

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