Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
HUD HUD Color Picker  

HUD Color Picker

Rainbow Palette Color picker listener for a product//:LICENSE: CC-BY-SA 3.0

Category: HUD
By : Ferd Frederix
Created: 2015-07-15 Edited: 2015-07-15
Worlds: Second Life

the Zip file

Download all files for HUD Color Picker
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Rainbow Listener Script.lsl
Get file # 2. HUD Script.lsl
Get file # 3. [6260 bytes] RGB.png

This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1 // Rainbow Palette Listen Script originally by Rui Clary
2 // Second component of Rainbow Palette
3 // Add this script to the object to be colorized.
4
5 // Modified by Ferd Frederix 2015.07.14 to have intensity control and be non-UUID specific (Opensim compatible).
6
7 // Available under the Creative Commons Attribution-ShareAlike 3.0 license
8 // http://creativecommons.org/licenses/by-sa/3.0/
9
10 // tunable things
11 integer colorall = TRUE; // set to FALSE to color just one prim, TRUE = all prims
12 integer FACE = ALL_SIDES; // the face of the prim to color, from 1 to N
13 string productName = "pal";// change this to match your HUD name
14 integer channel = 4; // pick a channel that matches the listener prim
15
16 // no changes needed after this
17
18 default
19 {
21 {
22 llListen( channel, productName, NULL_KEY, "" );
23 }
24
25 listen( integer channel, string name, key id, string message )
26 {
27 // only listen to the owner-provided commands to prevent crosstalk
29 if(llList2Key(detail,0) != llGetOwner())
30 return;
31
32 // color one, or all prims to FACE
33 if(colorall)
34 {
35 integer i;
37 for (i = 1; i < j; i++)
38 {
39 llSetLinkColor(i,(vector)message,FACE);
40 }
41
42 } else {
43 llSetColor((vector)message,FACE);
44 }
45 }
46 }

HUD Color Picker

Rainbow Palette Color picker for a HUD//:LICENSE: CC-BY-SA 3.0

Category: HUD
By : Ferd Frederix
Created: 2015-07-15 Edited: 2015-07-15
Worlds: Second Life


This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1
2 // add this script and the texture to a prim. You can touch the prim to change the color of other,unlinked prims.
3
4 // Based on Rainbow Palette by Rui Clary
5 // Modified by Jor3l Boa. Better interface and more readable :P
6 // Modified by Rui Clary on 2011.06.20 - some corrections
7 // Modified by Ferd Frederix 2015.07.14 to have intensity control and be non-UUID specific (Opensim compatible).
8
9 // Available under the Creative Commons Attribution-ShareAlike 3.0 license
10 // http://creativecommons.org/licenses/by-sa/3.0/
11
12 // tunable things
13 string productName = "pal";// change this to match your product prim - they must match to prevent crosstalk between products.
14 integer channel = 4; // pick a channel that matches the listener prim
15
16 // no changes needed after this
17
18 // devolverString -> Convert and return a vector without .0000 and other
19 // float things :)
20 devolverString(float r, float g, float b) {
21 string _vector = "<";
22 if(r <= 0) {
23 _vector += "0,";
24 }
25 else if(r == 1) {
26 _vector += "1,";
27 }
28 else {
29 string temp = (string)r;
30 while(llGetSubString(temp,llStringLength(temp)-1,-1) == "0") {
31 temp = llDeleteSubString(temp,llStringLength(temp)-1,-1);
32 }
33 _vector += temp+",";
34 }
35 //----------------
36 if(g <= 0) {
37 _vector += "0,";
38 }
39 else if(g == 1) {
40 _vector += "1,";
41 }
42 else {
43 string temp = (string)g;
44 while(llGetSubString(temp,llStringLength(temp)-1,-1) == "0") {
45 temp = llDeleteSubString(temp,llStringLength(temp)-1,-1);
46 }
47 _vector += temp+",";
48 }
49 //----------------
50 if(b <= 0) {
51 _vector += "0>";
52 }
53 else if(b == 1) {
54 _vector += "1>";
55 }
56 else {
57 string temp = (string)b;
58 while(llGetSubString(temp,llStringLength(temp)-1,-1) == "0") {
59 temp = llDeleteSubString(temp,llStringLength(temp)-1,-1);
60 }
61 _vector += temp+">";
62 }
63 //----------------
64 llSay(channel,_vector );
65 }
66
67 default
68 {
70 {
71 llSetObjectName(productName);
72 llSetTexture("RGB",1);
73 }
74 touch(integer num_detected)
75 {
76 float x;float r;float g;float b;
77 vector touchedpos = llDetectedTouchST(0);
78
79 if(llDetectedTouchFace(0) != 1) { return; }
80
81 float i = touchedpos.y;
82
83 x=360*touchedpos.x;
84 r=0;
85 g=0;
86 b=0;
87 if(x>=0&&x<=60){
88 r=255;
89 g=x*255/60;
90 }
91 if(x>60&&x<=120){
92 r=255-(x-60)*255/60;
93 g=255;
94 }
95 if(x>120&&x<=180){
96 g=255;
97 b=(x-120)*255/60;
98 }
99 if(x>180&&x<240){
100 g=255-(x-180)*255/60;
101 b=255;
102 }
103 if(x>240&&x<300){
104 r=(x-240)*255/60;
105 b=255;
106 }
107 if(x>300&&x<=360){
108 r=255;
109 b=255-(x-300)*255/60;
110 }
111 r = (r/255);
112 g = (g/255);
113 b = (b/255);
114 //CONVERSION
115 devolverString(r* i,g*i,b*i );
116 }
117
118 }

Back to the Best Free Tools in Second Life and OpenSim.