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
Chain Particles Amethyst_Chain_Script  

Amethyst_Chain_Script

Amethyst Chain Script.lsl

Category: Chain Particles
By : Amethyst Rosencrans
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Amethyst_Chain_Script
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Amethyst_Chain_Script_1.lsl
1
2 // Amethyst Chain Script
3 // By: Amethyst Rosencrans
4
5 // Customizable variables
6 string lockmeistername = "chainupperleft"; // Lockmeister name we respond to
7 string texturename = "chain"; // Name of the chain texture
8 list Names = [ "lcuff" ]; // List of lockmeister names
9 list IDs = [ -1 ]; // and associated IDs (use -1 for any)
10 string Card = "Chain Settings"; // Settings notecard
11
12 // Intgernal variables
13 string nullstr = "";
14 key nullkey = NULL_KEY;
15 key posekey = nullkey;
16 string lockmeistertarget = "lcuff"; // Lockmeister name to chain to
17 float age = 2;
18 float gravity = 0.7;
19 key currenttarget = nullkey;
20 string ourtarget = nullstr;
21 integer line;
22 key loadkey;
23 string ourtexture = texturename;
24
25 // Set the texture back to the original values after unsitting
26 ReloadDefaults()
27 {
28 ourtexture = texturename;
29 age = 2;
30 gravity = 0.7;
31 }
32
33 UpdateParticles(key leashtarget)
34 {
35 currenttarget = leashtarget;
37 // Appearance Settings
38 PSYS_PART_START_SCALE,(vector) <0.1,0.1,0>,// Start Size, (minimum .04, max 10.0?)
39 PSYS_PART_END_SCALE,(vector) <1,1,0>, // End Size, requires *_INTERP_SCALE_MASK
40 PSYS_PART_START_COLOR,(vector) <1,1,1>, // Start Color, (RGB, 0 to 1)
41 PSYS_PART_END_COLOR,(vector) <1,1,1>, // EndC olor, requires *_INTERP_COLOR_MASK
42 PSYS_PART_START_ALPHA,(float) 1.0, // startAlpha (0 to 1),
43 PSYS_PART_END_ALPHA,(float) 1.0, // endAlpha (0 to 1)
44 PSYS_SRC_TEXTURE,(string) texturename, // name of a 'texture' in emitters inventory
45 // Flow Settings, keep (age/rate)*count well below 4096 !!!
46 PSYS_SRC_BURST_PART_COUNT,(integer) 1, // # of particles per burst
47 PSYS_SRC_BURST_RATE,(float) 0.0, // delay between bursts
48 PSYS_PART_MAX_AGE,(float) age, // how long particles live
49 PSYS_SRC_MAX_AGE,(float) 0.0, // turns emitter off after 15 minutes. (0.0 =never)
50 // Placement Settings
52 // _PATTERN can be: *_EXPLODE, *_DROP, *_ANGLE, *ANGLE_CONE or *_ANGLE_CONE_EMPTY
53 PSYS_SRC_BURST_RADIUS,(float) 0.5, // How far from emitter new particles start,
54 PSYS_SRC_INNERANGLE,(float) 0.0, // aka 'spread' (0 to 2*PI),
55 PSYS_SRC_OUTERANGLE,(float) 0.0, // aka 'tilt' (0(up), PI(down) to 2*PI),
56 PSYS_SRC_OMEGA,(vector) <0,0,0>, // how much to rotate around x,y,z per burst,
57 // Movement Settings
58 PSYS_SRC_ACCEL,(vector) <0,0,-gravity>, // aka gravity or push, ie <0,0,-1.0> = down
59 PSYS_SRC_BURST_SPEED_MIN,(float) 1000.0, // Minimum velocity for new particles
60 PSYS_SRC_BURST_SPEED_MAX,(float) 1000.0, // Maximum velocity for new particles
61 PSYS_SRC_TARGET_KEY,(key) leashtarget, // key of a target, requires *_TARGET_POS_MASK
62 // for *_TARGET try llGetKey(), or llGetOwner(), or llDetectedKey(0) even. :)
63
64 PSYS_PART_FLAGS, // Remove the leading // from the options you want enabled:
65
66 //PSYS_PART_EMISSIVE_MASK | // particles glow
67 //PSYS_PART_BOUNCE_MASK | // particles bounce up from emitter's 'Z' altitude
68 //PSYS_PART_WIND_MASK | // particles get blown around by wind
69 PSYS_PART_FOLLOW_VELOCITY_MASK | // particles rotate towards where they're going
70 PSYS_PART_FOLLOW_SRC_MASK | // particles move as the emitter moves
71 //PSYS_PART_INTERP_COLOR_MASK | // particles change color depending on *_END_COLOR
72 //PSYS_PART_INTERP_SCALE_MASK | // particles change size using *_END_SCALE
73 PSYS_PART_TARGET_POS_MASK | // particles home on *_TARGET key
74 0 // Unless you understand binary arithmetic, leave this 0 here. :)
75 ] );
76 }
77
78 // Initiate a notecard reload
79 LoadCard()
80 {
81 line = 0;
83 {
84 loadkey = llGetNotecardLine(Card, line);
85 }
86 }
87
88 // Validate a key
89 integer isKey(key in)
90 {
91 if(in) return 2;
92 return (in == nullkey);
93 }
94
95 default
96 {
98 {
99 llListen(-8888, "", NULL_KEY, "");
100 LoadCard();
101 }
102
103 on_rez(integer start_param)
104 {
107 }
108
109 link_message(integer sender, integer num, string str, key id)
110 {
111 // Handle sit/unsit/change
112 if(num == 50 || num == 51)
113 {
114 integer which = (integer)str;
115 integer index = llListFindList(IDs, [ which ]);
116
118
119 if(index == -1)
120 {
121 index = llListFindList(IDs, [ -1 ]);
122 }
123 if(index > -1)
124 {
125 lockmeistertarget = llList2String(Names, index);
126
127 if(num == 50 && lockmeistertarget != nullstr)
128 {
129 posekey = id;
130 ourtarget = lockmeistertarget;
131 llWhisper(-8888, (string)id + lockmeistertarget);
132 }
133 else if(num == 51)
134 {
135 posekey = nullkey;
136 ReloadDefaults();
137 }
138 }
139 }
140 // Handle lockmeister update
141 else if(num == 52)
142 {
143 integer index = llListFindList(IDs, [ (integer)str ]);
144 list templist = llParseString2List((string)id, [ " " ], []);
145 integer current = 0;
146
147 while(llList2String(templist, current) != nullstr)
148 {
149 string us = llList2String(templist, current);
150 string them = llList2String(templist, current + 1);
151
152 if(us == lockmeistername)
153 {
154 if(index != -1)
155 {
156 IDs = llDeleteSubList(IDs, index, index);
157 Names = llDeleteSubList(Names, index, index);
158 }
159 IDs += (integer)str;
160 Names += them;
161 return;
162 }
163 current += 2;
164 }
165 }
166 }
167
168 listen(integer channel, string name, key id, string message)
169 {
170 // Handle lockmeister chatter
171 if(channel == -8888)
172 {
173 key ltarget = (key)llGetSubString(message, 0, 35);
174 string command = llGetSubString(message, 36, -1);
175
176 llMessageLinked(LINK_SET, 352, message, id);
177
178 if(ltarget == posekey)
179 {
180 list templist = llParseStringKeepNulls(command, [ "|" ], []);
181
182 if(command == lockmeistername)
183 {
184 llSay(-8888, (string)ltarget + lockmeistername + " ok");
185 }
186 else if(llGetSubString(command, 0, 6) == "gravity")
187 {
188 float newgrav = (float)llList2String(templist, 1);
189 string thistarget = llList2String(templist, 2);
190
191 if(newgrav != 0 && (thistarget == nullstr || thistarget == lockmeistername))
192 {
193 gravity = newgrav;
194 if(currenttarget != nullkey)
195 {
196 UpdateParticles(currenttarget);
197 }
198 }
199 }
200 else if(llGetSubString(command, 0, 6) == "texture")
201 {
202 string newtex = llList2String(templist, 1);
203 string thistarget = llList2String(templist, 2);
204
205 if(isKey((key)newtex) && (thistarget == nullstr || thistarget == lockmeistername))
206 {
207 texturename = newtex;
208 if(currenttarget != nullkey)
209 {
210 UpdateParticles(currenttarget);
211 }
212 }
213 }
214 else if(llGetSubString(command, 0, 2) == "age")
215 {
216 float newage = (float)llList2String(templist, 1);
217 string thistarget = llList2String(templist, 2);
218
219 if(newage != 0 && (thistarget == nullstr || thistarget == lockmeistername))
220 {
221 age = newage;
222 if(currenttarget != nullkey)
223 {
224 UpdateParticles(currenttarget);
225 }
226 }
227 }
228 else if(llGetSubString(command, 0, 5) == "target")
229 {
230 if(command == "target")
231 {
233 currenttarget = nullkey;
234 }
235 else
236 {
237 integer current = 1;
238
239 while(llList2String(templist, current) != nullstr)
240 {
241 string us = llList2String(templist, current);
242 string them = llList2String(templist, current + 1);
243
244 if(us == lockmeistername)
245 {
246 if(them == nullstr)
247 {
248 ourtarget = nullstr;
250 currenttarget = nullkey;
251 }
252 else
253 {
254 list dests = llParseStringKeepNulls(them, [ "-" ], []);
255 integer z;
256 ourtarget = them;
257 for(z=0;z<llGetListLength(dests);z++)
258 {
259 llWhisper(-8888, (string)posekey + llList2String(dests, z));
260 }
261 }
262 }
263 current += 2;
264 }
265 }
266 }
267 else if(ourtarget != nullstr)
268 {
269 list dests = llParseStringKeepNulls(ourtarget, [ "-" ], []);
270 integer z;
271 integer num = llGetListLength(dests);
272
273 for(z=0;z<num;z++)
274 {
275 if(command == (llList2String(dests, z) + " ok"))
276 {
277 ourtarget = nullstr;
278 if(num > z+1)
279 {
280 integer y;
281 ourtarget = llList2String(dests, z+1);
282 for(y=z+2;y<num;y++)
283 {
284 ourtarget += "-" + llList2String(dests, y);
285 }
286 }
287 UpdateParticles(id);
288 return;
289 }
290 }
291 }
292 }
293 }
294 }
295
296 // Handle loading of the config file...
297 // Using Xcite format for compatibility
298 dataserver(key query_id, string data)
299 {
300 if(data != EOF)
301 {
302 if(data != nullstr && llGetSubString(data, 0, 0) != "#" && query_id == loadkey)
303 {
304 list templist = llParseStringKeepNulls(data, ["|"], []);
305 string category = llList2String(templist, 0);
306 string text = llList2String(templist, 1);
307
308 // Override name setting
309 if(category == "name")
310 {
311 if(text != nullstr)
312 {
313 lockmeistername = text;
314 }
315 }
316 // Override texture setting
317 if(category == "texture")
318 {
319 if(text != nullstr)
320 {
321 texturename = text;
322 }
323 }
324 // Override target setting
325 if(category == "target")
326 {
327 if(text != nullstr)
328 {
329 lockmeistertarget = text;
330 }
331 }
332 // Override age setting
333 if(category == "age")
334 {
335 if(text != nullstr)
336 {
337 age = (float)text;
338 }
339 }
340 // Override gravity setting
341 if(category == "gravity")
342 {
343 if(text != nullstr)
344 {
345 gravity = (float)text;
346 }
347 }
348 }
349 if(query_id == loadkey)
350 {
351 line++; // increase line count
352 loadkey = llGetNotecardLine(Card, line); // request next line
353 }
354 }
355 }
356 }
357 // END //

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