Rainbow palette
Jump to navigation
Jump to search
<lsl> // Rainbow Palette by Rui Clary // This script will only run in Mono enabled, Second Life Viewer 1.21 or above. // // Interactive Rainbow Palette // // Add this script to a cube prim and add "Listen Palete" script to another Object. // You can resize and stretch the cube, the way you want, to make it look like a color palette. // Touch face 1 of "Rainbow Palette" to change "Listen Object" color. // // Available under the Creative Commons Attribution-ShareAlike 3.0 license // http://creativecommons.org/licenses/by-sa/3.0/
default {
state_entry() { llSetObjectName("pal"); llSetTexture ("5748decc-f629-461c-9a36-a35a221fe21f",ALL_SIDES); llSetTexture("5543eaa7-4283-8383-eef9-945c0b3f25c7",1); } touch(integer num_detected) { float x; float r; float g; float b; vector touchedpos = llDetectedTouchST(0); if (llDetectedTouchFace(0)==1) { x=360*touchedpos.x; if (x>=0&&x<=60) {r=255;} if (x>=300&&x<=360) {r=255;} if (x>=120&&x<=240) {r=0;} if (x>60&&x<=120) {r=255-(x-60)*255/60;} if (x>240&&x<300) {r=(x-240)*255/60;} if (x>=0&&x<60) {g=x*255/60;} if (x>=60&&x<=180) {g=255;} if (x>180&&x<240) {g=255-(x-180)*255/60;} if (x>=240&&x<=360) {g=0;} if (x>=0&&x<=120) {b=0;} if (x>120&&x<180) {b=(x-120)*255/60;} if (x>=180&&x<=300) {b=255;} if (x>300&&x<=360) {b=255-(x-300)*255/60;} llSay(4,"<"+(string)(r/255)+","+(string)(g/255)+","+(string)(b/255)+">"); } }
}
</lsl>
<lsl> // Rainbow Palette Listen Script by Rui Clary // // Second component of Rainbow Palette // // Add this script to "Listen Object".
default
{
state_entry() { llSetTexture ("5748decc-f629-461c-9a36-a35a221fe21f",ALL_SIDES); llListen( 4, "pal", NULL_KEY, "" ); } listen( integer channel, string name, key id, string message ) { llSetColor((vector)message,0); }
} </lsl>