Don't click here unless you want to be banned.

LSL Wiki : llGetColor

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl809.us.archive.org
vector llGetColor(integer face)

Returns the color of face (side). If face is ALL_SIDES, the color returned is the mean average of the colors on all sides. This could concievably be used to make a color "blending" script.

Color component values range from 0.0 to 1.0. See color for more info.

Color information can also be retrieved using the llGetPrimitiveParams function.

To set the color use llSetColor or llSetPrimitiveParams.

To access individual color components the vector 'dot' feature can be used:

vector color = llGetColor(ALL_SIDES);
float red_component = color.x;
float green_component = color.y;
float blue_component = color.z;
vector color; //Defines the object color
default
{
state_entry() //Script startup
{
color = llGetColor(); 
llSay(0 , (string)((vector) color)); //States the object color over channel 0
}
}//The End

See vector for more info.

Note: This function will cause the script to fail silently if it is supplied with a face that does not exist: e.g, if a loop goes around 10 times reading the color of faces 0 to 9, and if the script is an unmodified cube, then it will fail on the 7th iteration (as a cube only has 6 sides). There is currently no way to know that this has happened so be careful using loops!

Q: How do I determine which side of an object this applies to?
A: See side.


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Texture | Color
Comments [Hide comments/form]
Attach a comment to this page: