Sign in to follow this  
Followers 0

Newbie- Pixel Color

2 posts in this topic

Hi all

Probably a really simple question for someone

I have a basic script for what i want to do,

What i want to add to it is

I have 12 coordinates of a certain colour i know the co-ords and colours if 5 of them change to a different colour i know that color also i want it to do something

So how do i make it count the colors?

Thanks for the help

Share this post

Link to post
Share on other sites

Well without seeing any of your code, it is like helping blind.

But you are welcome to try this code/ Requires Beta.


Global $co[13][2];; 2 dim array to store co-ords and their related colours.

;; Store your x,y co-ords in this array
$co[1][0]  = "100,100"
$co[2][0]  = "101,101"
$co[3][0]  = "102,102"
$co[4][0]  = "103,103"
$co[5][0]  = "104,104"
$co[6][0]  = "105,105"
$co[7][0]  = "106,106"
$co[8][0]  = "107,107"
$co[9][0]  = "108,108"
$co[10][0] = "109,109"
$co[11][0] = "110,110"
$co[12][0] = "111,111"

;;colours / Store the Expected colour for each co-ord in this array.
$co[1][1]   = "0xFFF000"
$co[2][1]   = "0xFFF003"
$co[3][1]   = "0xFFE100"
$co[4][1]   = "0xFFF100"
$co[5][1]   = "0xFFF000"
$co[6][1]   = "0xFFF000"
$co[7][1]   = "0xFFF000"
$co[8][1]   = "0xFFF000"
$co[9][1]   = "0xFFF000"
$co[10][1]  = "0xFFF000"
$co[11][1]  = "0xFFF000"
$co[12][1]  = "0xFFF000"

while 1
    If _Changed() Then
    ;;do your stuff cos 5 colours changed

Func _Changed()
    $Fail = 0
    For $i = 1 to UBound($co)-1
    $Temp = StringSplit($co[$i][0],",")
    $x = $Temp[1]
    $y = $Temp[2]
    If PixelGetColor($x,$y) <> $co[$i][1] Then
     $Fail +=1

    If $Fail >= 5 Then
        Return 1
        Return 0

Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian? ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

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