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
Color Large_Color_Change_Script  

Large_Color_Change_Script

Large Color Change Script - Linked channel 1 color.lsl

Category: Color
By : Anonymous
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Large_Color_Change_Script
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Large_Color_Change_Script__Linked_c_1.lsl
1
2 // This code is public domain.
3 // masa was here 20050302
4
5 integer CHANNEL = 1; // channel to listen for commands on
6 integer OWNER_ONLY = TRUE; // only owner can control
7 integer USE_IMS = TRUE; // send IMs instead of using chat
8 string COMMAND_CHANGE_COLOR = "color"; // command to change color
9 string COMMAND_LIST_COLORS = "listcolors"; // command to list colors
10 integer MAX_CHAT_LENGTH = 255; // max size for one message
11 string PREFIX_HEX = "#"; // prefix to specify hex code
12 string PREFIX_VECTOR = "<"; // prefix to specify vector code
13 list LINKS_TO_SET = [LINK_SET, ALL_SIDES]; // [link number, link face, ...]
14
15 list COLORS;
16
17 // the list is too big to set at once :o
18 // note that you may get syntax errors and need to rearrange this list
19 // if you change the script much.
20 set_colors() {
21 COLORS = [
22 // [url]http://halflife.ukrpack.net/csfiles/help/colors.shtml[/url]
23 "steelblue", "#4682B4", "royalblue", "#041690", "cornflowerblue", "#6495ED",
24 "lightsteelblue", "#B0C4DE", "mediumslateblue", "#7B68EE", "slateblue", "#6A5ACD",
25 "darkslateblue", "#483D8B", "midnightblue", "#191970", "navy", "#000080",
26 "darkblue", "#00008B", "mediumblue", "#0000CD", "blue", "#0000FF",
27 "dodgerblue", "#1E90FF", "deepskyblue", "#00BFFF", "lightskyblue", "#87CEFA",
28 "skyblue", "#87CEEB", "lightblue", "#ADD8E6", "powderblue", "#B0E0E6",
29 "azure", "#F0FFFF", "lightcyan", "#E0FFFF", "paleturquoise", "#AFEEEE",
30 "mediumturquoise", "#48D1CC", "lightseagreen", "#20B2AA", "darkcyan", "#008B8B",
31 "teal", "#008080", "cadetblue", "#5F9EA0", "darkturquoise", "#00CED1",
32 "aqua", "#00FFFF", "cyan", "#00FFFF", "turquoise", "#40E0D0",
33 "aquamarine", "#7FFFD4", "mediumaquamarine", "#66CDAA", "darkseagreen", "#8FBC8F"
34 ] + [
35 "mediumseagreen", "#3CB371", "seagreen", "#2E8B57", "darkgreen", "#006400",
36 "green", "#008000", "forestgreen", "#228B22", "limegreen", "#32CD32",
37 "lime", "#00FF00", "chartreuse", "#7FFF00", "lawngreen", "#7CFC00",
38 "greenyellow", "#ADFF2F", "yellowgreen", "#9ACD32", "palegreen", "#98FB98",
39 "lightgreen", "#90EE90", "springgreen", "#00FF7F", "mediumspringgreen", "#00FA9A",
40 "darkolivegreen", "#556B2F", "olivedrab", "#6B8E23", "olive", "#808000",
41 "darkkhaki", "#BDB76B", "darkgoldenrod", "#B8860B", "goldenrod", "#DAA520",
42 "gold", "#FFD700", "yellow", "#FFFF00", "khaki", "#F0E68C", "palegoldenrod", "#EEE8AA",
43 "blanchedalmond", "#FFEBCD", "moccasin", "#FFE4B5", "wheat", "#F5DEB3",
44 "navajowhite", "#FFDEAD", "burlywood", "#DEB887", "tan", "#D2B48C"
45 ] + [
46 "rosybrown", "#BC8F8F", "sienna", "#A0522D", "saddlebrown", "#8B4513",
47 "chocolate", "#D2691E", "peru", "#CD853F", "sandybrown", "#F4A460",
48 "darkred", "#8B0000", "maroon", "#800000", "brown", "#A52A2A",
49 "firebrick", "#B22222", "indianred", "#CD5C5C", "lightcoral", "#F08080",
50 "salmon", "#FA8072", "darksalmon", "#E9967A", "lightsalmon", "#FFA07A",
51 "coral", "#FF7F50", "tomato", "#FF6347", "darkorange", "#FF8C00",
52 "orange", "#FFA500", "orangered", "#FF4500", "crimson", "#DC143C",
53 "red", "#FF0000", "deeppink", "#FF1493", "fuchsia", "#FF00FF",
54 "magenta", "#FF00FF", "hotpink", "#FF69B4", "lightpink", "#FFB6C1",
55 "pink", "#FFC0CB", "palevioletred", "#DB7093", "mediumvioletred", "#C71585"
56 ] + [
57 "purple", "#800080", "darkmagenta", "#8B008B", "mediumpurple", "#9370DB",
58 "blueviolet", "#8A2BE2", "indigo", "#4B0082", "darkviolet", "#9400D3",
59 "darkorchid", "#9932CC", "mediumorchid", "#BA55D3", "orchid", "#DA70D6",
60 "violet", "#EE82EE", "plum", "#DDA0DD", "thistle", "#D8BFD8",
61 "lavender", "#E6E6FA", "ghostwhite", "#F8F8FF", "aliceblue", "#F0F8FF",
62 "mintcream", "#F5FFFA", "honeydew", "#F0FFF0", "lightgoldenrodyellow", "#FAFAD2",
63 "lemonchiffon", "#FFFACD", "cornsilk", "#FFF8DC", "lightyellow", "#FFFFE0",
64 "ivory", "#FFFFF0", "floralwhite", "#FFFAF0", "linen", "#FAF0E6",
65 "oldlace", "#FDF5E6", "antiquewhite", "#FAEBD7", "bisque", "#FFE4C4 ",
66 "peachpuff", "#FFDAB9", "papayawhip", "#FFEFD5", "beige", "#F5F5DC"
67 ] + [
68 "seashell", "#FFF5EE", "lavenderblush", "#FFF0F5", "mistyrose", "#FFE4E1",
69 "snow", "#FFFAFA", "white", "#FFFFFF", "whitesmoke", "#F5F5F5",
70 "gainsboro", "#DCDCDC", "lightgrey", "#D3D3D3", "silver", "#C0C0C0",
71 "darkgray", "#A9A9A9", "gray", "#808080", "lightslategray", "#778899",
72 "slategray", "#708090", "dimgray", "#696969", "darkslategray", "#2F4F4F",
73 "black", "#000000"
74 ] + [
75 // :o
76 "carnationpink", "#FA7FC1"
77 ];
78 }
79
80 say(key id, string str) {
81 if( USE_IMS ) llInstantMessage( id, str );
82 else llWhisper(0, str);
83 }
84
85 vector color_from_hex(string str) {
86 return <(integer)("0x" + llGetSubString(str,1,2)),
87 (integer)("0x" + llGetSubString(str,3,4)),
88 (integer)("0x" + llGetSubString(str,5,6))> / 255;
89 }
90
91 vector color_from_vector(string vec) {
92 // caveat: 1,1,1 will be treated as #ffffff, not #010101
93 list l = llParseString2List(vec, [" ", ",", "<", ">"], []);
94 vector v;
95
96 v.x = (float)llList2String(l, 0);
97 v.y = (float)llList2String(l, 1);
98 v.z = (float)llList2String(l, 2);
99
100 if( v.x > 1 || v.y > 1 || v.z > 1 ) v /= 255;
101
102 return v;
103 }
104
105 vector color_from_name(string name) {
106 // vv strip spaces and force lowercase vv
107 integer x = llListFindList(COLORS, [ llToLower(llDumpList2String(llParseString2List(name, [" "], []), "")) ]);
108 if( x == -1 ) return <-1,-1,-1>;
109 return color_from_hex( llList2String(COLORS, x+1) );
110 }
111
112 set_color(key id, string str) {
113 vector color;
114 integer i;
115 if( llGetSubString(str, 0, 0) == PREFIX_HEX ) // hex code
116 color = color_from_hex( str );
117 else if( llGetSubString(str, 0, 0) == PREFIX_VECTOR ) // vector
118 color = color_from_vector( str );
119 else
120 color = color_from_name( str );
121
122 if( color.x < 0 || color.x > 1 || color.y < 0 || color.y > 1 || color.z < 0 || color.z > 1 ) {
123 say( id, "Invalid color specified: " + str );
124 return;
125 }
126
127 //llSetColor(color,ALL_SIDES);
128 llSetLinkColor(LINK_SET,color,ALL_SIDES);//used to color all prims in a linked object including start prim
129 }
130
131 list_colors(key id) {
132 string str = "";
133 string nstr = "";
134 integer i;
135
136 for ( i = 0; i < llGetListLength( COLORS ); i += 2 ) {
137 nstr = str + llList2String(COLORS, i) + ", ";
138
139 if( llStringLength(nstr) > MAX_CHAT_LENGTH ) {
140 say(id, str);
141 str = llList2String(COLORS, i);
142 } else {
143 str = nstr;
144 }
145 }
146 if( str != "" ) say(id, str);
147 }
148
149 default {
150 on_rez(integer start_param) {
152 }
153 state_entry() {
154 set_colors();
155 llListen( CHANNEL, "", llGetOwner(), "" );
156 }
157
158 listen(integer channel, string name, key id, string msg) {
159 string command;
160 string argument;
161 list l;
162
163 if(OWNER_ONLY && id != llGetOwner()) return;
164
165 l = llParseStringKeepNulls( msg, [" "], [] );
166 command = llList2String(l, 0);
167 argument = llDumpList2String( llList2List(l, 1, -1), " " );
168
169 if( command == COMMAND_CHANGE_COLOR )
170 set_color(id, argument);
171 else if( command == COMMAND_LIST_COLORS )
172 list_colors(id);
173
174 }
175 }// END //

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