User:Toady Nakamura/Color Chooser

From Second Life Wiki
< User:Toady Nakamura
Revision as of 16:36, 26 March 2012 by Toady Nakamura (talk | contribs) (added color picker script)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is extremely handy for picking good colors of hover text as well as for finding out the color vector of a prim, to use in particles for example. The prim color is close to a particle that isn't Emissive (glow), while the hover text is very similar to particles with Glow enabled.

To see it work for yourself, place this in a prim, and do what it tells you to do!!

<lsl>


tell() {

   vector color = llGetColor(0);   // find out what color the prim is now
   llOwnerSay("Color Vector is  "+(string)color );  // tell the owner the current vector by typecasting (string)vector
   llSetText("Color Vector: \n \n "+(string)color, color, 1.0); // post vector in hover text in same color 

}

default {

   state_entry() 
   { 
     llOwnerSay("Change the Color in edit/texture tab; the ball will tell you the new color vector and post it in hover text!");
   } 
   touch_start(integer number) 
   { 
       tell(); // usually you will hear the color by changing it
               // this is here for poky fingered owners
   } 
   changed(integer change) 
   { 
       if (change & CHANGED_COLOR) 
       { 
           tell(); // change the color in edit, it tells & posts the new vector
       } 
   }
   on_rez(integer foo) 
   { 
       llResetScript(); // reset on rezz to repeat instructions
   }  

} </lsl>