Get the RGB values for the pixel under the mouse.
Glenn E. Fisher
gefisher at mac.com
Fri Jul 13 12:45:37 EDT 2007
Here is some of my dumb ways to check for some particular colors in
one of my games.
I thought it might give you some ideas.
function pixelColor lx
set the screenMouseLoc to lx
get the mouseColor
set the screenMouseLoc to 0,0
-- c is the RGB values as an item list
function isGreen c
if item 2 of c > 10+item 1 of c and item 2 of c > 10+item 3 of c
then return true
function isBrown c
if item 1 of c > 30 and item 1 of c < 70 and item 2 of c > 15 and
item 2 of c < 40\
and item 3 of c > 7 and item 3 of c < 20 then return true
function isYellow c
if c = "174,144,96" or c = "161,125,76" then return true
function isBeige c
if item 1 of c > 130 and item 1 of c < 160 and item 2 of c > 90
and item 2 of c < 130\
and item 3 of c > 40 and item 3 of c < 80 then return true
on July 12, 2007 7:08:54 PM CDT Jim Hurley wrote:
> To be sure of my code I started with a script to get the RGB values
> under the mouse, using a MouseMove function.
> To see this
> go url "http://home.infostations.net/jhurley/RGBunderTheMouse.rev"
> Unfortunately the map does not show pure colors so getting the ranges
> for each hazard zone is messy. But this utility is useful in
> exploring the range of colors.
Glenn E. Fisher University of Houston - Retired
22402 Diane Dr. Spring, Tx 77373
gefisher at mac.com http://www.uh.edu/~fisher
More information about the Use-livecode