Color Changer
Revision as of 01:24, 21 October 2012 by Kireji Haiku (talk | contribs) (some readability improvements)
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
This is a color changer script I made.
<lsl> // Color Changer Plus v1.0 // by Neo Calcutt // // distributed under the Creative Commons Attribution-Share Alike 3.0 United States License. // // please leave the script full permissions and keep this header intact
// you might want to change this integer listenChannel = 5;
default {
state_entry() { llListen(listenChannel, "", NULL_KEY, ""); }
listen(integer channel, string name, key id, string message) { // uncomment the next line to only listen to the owner // if (id != llGetOwner()) return;
// uncomment the next line to only listen to the owner and other objects by the owner // if (llGetOwnerKey(id) != llGetOwner()) return;
// this would be black vector color = ZERO_VECTOR;
if (message == "red") color = <1.0, 0.0, 0.0>; else if (message == "orange") color = <1.0, 0.5, 0.0>; else if (message == "yellow") color = <1.0, 1.0, 0.0>; else if (message == "lime") color = <0.5, 1.0, 0.0>; else if (message == "green") color = <0.0, 1.0, 0.0>; else if (message == "teal") color = <0.0, 1.0, 0.5>; else if (message == "cyan") color = <0.0, 1.0, 1.0>; else if (message == "light blue") color = <0.0, 0.5, 1.0>; else if (message == "blue") color = <0.0, 0.0, 1.0>; else if (message == "purple") color = <0.5, 0.0, 1.0>; else if (message == "magenta") color = <1.0, 0.0, 1.0>; else if (message == "pink") color = <1.0, 0.0,0.5>; else if (message == "white") color = <1.0, 1.0, 1.0>; else if (message == "random") { float r = llFrand(1.0); float g = llFrand(1.0); float b = llFrand(1.0); color = <r, g, b>; } else if (llSubStringIndex(message, "<") == 0) color = (vector)message;
llSetColor(color, ALL_SIDES); }
} </lsl>