# Newbie- Pixel Color

## Recommended Posts

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

HardCopy

```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

EndIf

Sleep(5)
WEnd

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
EndIf
Next

If \$Fail >= 5 Then
Return 1
Else
Return 0
EndIf

EndFunc```

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

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...