Difference between revisions of "LlSetColor"

From Second Life Wiki
Jump to navigation Jump to search
m (fixe)
Line 10: Line 10:
|caveats
|caveats
|constants
|constants
<b>NewbieNotes</b>
llSetColor changes the color of a prim, either on a specific side (face) or the entire prim.
Example:  llSetColor(<r,g,b>,ALL_SIDES);
r,g,b:  values for red, green, blue ranging from <0.0,0.0,0.0> (black) to <1.0,1.0,1.0> (white)
Since this is a vector value, be sure to include the <>.
Example color values:  <1.0,1.0,0> = yellow  <0.0,1.0,1.0> = cyan  <0,1,0> = green
ALL_SIDES means all sides of the prim will be changed to the new color.
If you use an integer value instead, only that side of the prim will be changed
Example:  A cube has 6 sides, with values from 0 to 5.  llSetColor(<1,1,1>,0); would change the top side of the cube to white.
|examples=<lsl>
|examples=<lsl>
integer face = -1;
integer face = -1;

Revision as of 21:41, 27 February 2008

Summary

Function: llSetColor( vector color, integer face );

Sets the color on face

• vector color color in RGB <R, G, B> (<0.0, 0.0, 0.0> = black, <1.0, 1.0, 1.0> = white)
• integer face face number or ALL_SIDES

If face is ALL_SIDES then the function works on all sides.

Newbie Notes

llSetColor changes the color of a prim, either on a specific side (face) or the entire prim.

Example:
llSetColor(<r, g, b>, ALL_SIDES);

r, g, b: values for red, green, blue ranging from <0.0, 0.0, 0.0> (black) to <1.0, 1.0, 1.0> (white)

To continue reading see: Newbie Notes

Caveats

  • The function silently fails if its face value indicates a face that does not exist.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl> integer face = -1; vector color = <1.0, 1.0, 1.0>;

default {

   touch_start(integer num)
   {
       if(~face)//quick & dirty check for -1
           llSetColor(color, face); //restore the color
       face = (face + 1) % llGetNumberOfSides(); //increment and keep the face number in range
       color = llGetColor(face); //save the face's color
       llSetColor(<0.5, 0.0, 0.0>, face );//change the face's color
   }

}

</lsl>

See Also

Events

•  changed CHANGED_COLOR

Functions

•  llGetAlpha Gets the prim's alpha
•  llSetAlpha Sets the prim's alpha
•  llGetColor Gets the prim's color
•  llSetLinkColor Sets link's color
•  llSetLinkAlpha Sets link's alpha

Articles

•  Color in LSL

Deep Notes

Search JIRA for related Issues

Signature

function void llSetColor( vector color, integer face );