Jump to content

Color Variable... Different Colors..


jensj
 Share

Recommended Posts

hi..

i use pixelgetcolor to get the color of one pixel. but that pixel hast not always the one color. there is a little difference.

if pixelgetcolor( 3, 1004 )=( 0x010101 ) then ; H Checken

Sleep(1000)

send("{h}")

Else

sleep(1000)

endif

the color is almost black and highest violett like this 2B1831

how do i get the difference of these colors?

if the color is between black and that violett, my script should send h.

i hope u understood the problem. thx

Link to comment
Share on other sites

Actually this would be rather complicated... you want to return true based on if the color is between black and violet (2B1831), correct?

Well, technically 001800 is between black and violet, but it's green. Would you want that to return true?

The simplest way to do it (although not necessarily reliable I think) would be like so:

$iPixelColor = PixelGetColor(3, 1004)
$aPixelSplit = _ColorSplit($iPixelColor)
If $aPixelSplit[0] < 0x2B And $aPixelSplit[1] < 0x18 And $aPixelSplit[2] < 0x31 Then
    Sleep(1000)
    Send("{h}")
Else
    Sleep(1000)
EndIf

Func _ColorSplit($i_Color)
    Local $a_Color[3]
    $a_Color[0] = BitAND(BitShift($i_Color, 16), 0xff)
    $a_Color[1] = BitAND(BitShift($i_Color, 8), 0xff)
    $a_Color[2] = BitAND($i_Color, 0xff)
    Return $a_Color
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

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