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
Particles Bling Particles with menu  

Bling Particles with menu

Bling particles

Category: Particles
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-07
Worlds: Second Life

the Zip file

Download all files for Bling Particles with menu
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Script.lsl

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 integer _debug = 1;
3
4 list MENU1 = ["(Bling)","(Effects)","(Poofer)","(Typing)"];
5 list MENU2 = ["(Menu)","Bling Stop","Bling On","Slower","Faster"];
6 list MENU3 = ["(Menu)","Big Bang"];
7 list MENU4 = ["(Menu)","Stop"];
8 list MENU5 = ["(Menu)","Stop"];
9
10
11 list anims = [];
12
13 string typo;
14
15
16 key target = ""; // Select a target for particles to arrive at when they die
17 // can be "self" (emitter), "owner" (you), "" or any prim/persons KEY.
18
19
20
21 Poofer(string target, string texture)
22 {
23 integer followVel = TRUE; // TRUE or FALSE(*), Particles rotate towards their direction
24 integer followSource = FALSE; // TRUE or FALSE(*), Particles move as the emitter moves, (TRUE disables
25 integer wind = TRUE; // TRUE or FALSE(*), Particles get blown away by wind in the sim
26 integer glow = TRUE; // TRUE or FALSE(*)
27 vector startColor = <1,1,1>; // RGB color, black<0,0,0> to white<1,1,1>(*)
28 vector endColor = <1,1,1>; //
29 vector startSize = <0.1,0.1,0>; // <0.04,0.04,0>(min) to <10,10,0>(max>, <1,1,0>(*)/
30 vector endSize = <0.1,0.1,0>; // (Z part of vector is discarded)
31 float age = 10.0; // How long each particle lives, 0.1 to 60, 10.0(*)
32 float Poofrate = 0.1; // Delay between bursts of new particles, 0.0 to 60, 0.1(*)
33 integer count = 10; // Number of particles created per burst, 1(*) to 4096
34 integer bounce = FALSE; // TRUE or FALSE(*), Make particles bounce on Z altitude of emitter
35
36
37
38 list sys;
39 integer flags;
40 key targetkey;
41 if(target == "owner") targetkey = llGetOwner();
42 if(target == "self") targetkey = llGetKey();
43
44 if(glow) flags = flags | PSYS_PART_EMISSIVE_MASK;
45 if(bounce) flags = flags | PSYS_PART_BOUNCE_MASK;
46 if(startColor != endColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK;
47 if(startSize != endSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK;
48 if(wind) flags = flags | PSYS_PART_WIND_MASK;
49 if(followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK;
50 if(followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK;
51 if(target != "owner") flags = flags | PSYS_PART_TARGET_POS_MASK;
52 sys = [ PSYS_PART_MAX_AGE,age,
53 PSYS_PART_FLAGS,flags,
54 PSYS_PART_START_COLOR, startColor,
55 PSYS_PART_END_COLOR, endColor,
56 PSYS_PART_START_SCALE,startSize,
57 PSYS_PART_END_SCALE,endSize,
59 PSYS_SRC_BURST_RATE,Poofrate,
60 PSYS_SRC_ACCEL, <0,0,0.1>,
65 PSYS_SRC_TARGET_KEY,targetkey,
68 PSYS_SRC_OMEGA, <0,0,0>,
70 PSYS_SRC_TEXTURE, texture,
73 ];
74 float newrate = Poofrate;
75 if(newrate == 0.0) newrate=.01;
76 if( (age/Poofrate)*count < 4096) llParticleSystem(sys);
77 else {
78 llInstantMessage(llGetOwner(),"Your particle system creates too many concurrent particles.");
79 llInstantMessage(llGetOwner(),"Reduce count or age, or increate rate.");
80 llParticleSystem( [ ] );
81 }
82 }
83
84 TypingOn(string target, string texture)
85 {
86 integer followVel = TRUE; // TRUE or FALSE(*), Particles rotate towards their direction
87 integer followSource = FALSE; // TRUE or FALSE(*), Particles move as the emitter moves, (TRUE disables
88 integer wind = FALSE; // TRUE or FALSE(*), Particles get blown away by wind in the sim
89 integer glow = TRUE; // TRUE or FALSE(*)
90 vector startColor = <1,1,1>; // RGB color, black<0,0,0> to white<1,1,1>(*)
91 vector endColor = <1,1,1>; //
92 vector startSize = <0.1,0.1,0>; // <0.04,0.04,0>(min) to <10,10,0>(max>, <1,1,0>(*)/
93 vector endSize = <0.1,0.1,0>; // (Z part of vector is discarded)
94 float age = 3.0; // How long each particle lives, 0.1 to 60, 10.0(*)
95 float Poofrate = 0.1; // Delay between bursts of new particles, 0.0 to 60, 0.1(*)
96 integer count = 10; // Number of particles created per burst, 1(*) to 4096
97 integer bounce = FALSE; // TRUE or FALSE(*), Make particles bounce on Z altitude of emitter
98
99 list sys;
100 integer flags;
101 key targetkey;
102 if(target == "owner") targetkey = llGetOwner();
103 if(target == "self") targetkey = llGetKey();
104
105
106 if(glow) flags = flags | PSYS_PART_EMISSIVE_MASK;
107 if(bounce) flags = flags | PSYS_PART_BOUNCE_MASK;
108 if(startColor != endColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK;
109 if(startSize != endSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK;
110 if(wind) flags = flags | PSYS_PART_WIND_MASK;
111 if(followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK;
112 if(followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK;
113 if(target != "owner") flags = flags | PSYS_PART_TARGET_POS_MASK;
115 PSYS_PART_FLAGS,flags,
116 PSYS_PART_START_COLOR, <1,1,1>,
117 PSYS_PART_END_COLOR, <1,1,1>,
118 PSYS_PART_START_SCALE,<0.1,0.1,0>,
119 PSYS_PART_END_SCALE,<1.0,1.0,0>,
122 PSYS_SRC_ACCEL, <0,0,0.1>,
127 PSYS_SRC_TARGET_KEY,targetkey,
130 PSYS_SRC_OMEGA, <0,0,0>,
132 PSYS_SRC_TEXTURE, texture,
135 ]);
136
137
138 }
139
140
141 fakeMakeExplosion(integer particle_count, float particle_scale, float particle_speed,
142 float particle_lifetime, float source_cone, string source_texture_id,
143 vector local_offset)
144 {
145 //local_offset is ignored
149 PSYS_PART_START_COLOR, <1.0, 1.0, 1.0>,
150 PSYS_PART_END_COLOR, <1.0, 1.0, 1.0>,
153 PSYS_PART_START_SCALE, <particle_scale, particle_scale, 0.0>,
154 PSYS_PART_END_SCALE, <particle_scale * 2 + particle_lifetime, particle_scale * 2 + particle_lifetime, 0.0>,
155 PSYS_PART_MAX_AGE, particle_lifetime,
156 PSYS_SRC_ACCEL, <0.0, 0.0, 0.0>,
157 PSYS_SRC_TEXTURE, source_texture_id,
160 PSYS_SRC_ANGLE_END, source_cone * PI,
161 PSYS_SRC_BURST_PART_COUNT, particle_count / 2,
163 PSYS_SRC_BURST_SPEED_MIN, particle_speed / 3,
164 PSYS_SRC_BURST_SPEED_MAX, particle_speed * 2/3,
165 PSYS_SRC_MAX_AGE, particle_lifetime / 2,
166 PSYS_SRC_OMEGA, <0.0, 0.0, 0.0>
167 ]);
168 }
169
170
171 BlingOn(float blingrate)
172 {
175 //| PSYS_PART_BOUNCE_MASK //Bounce on object's z-axis
176 //| PSYS_PART_WIND_MASK //Particles are moved by wind
177 | PSYS_PART_INTERP_COLOR_MASK //Colors fade from start to end
178 | PSYS_PART_INTERP_SCALE_MASK //Scale fades from beginning to end
179 | PSYS_PART_FOLLOW_SRC_MASK //Particles follow the emitter
180 | PSYS_PART_FOLLOW_VELOCITY_MASK//Particles are created at the velocity of the emitter
181 //| PSYS_PART_TARGET_POS_MASK //Particles follow the target
182 | PSYS_PART_EMISSIVE_MASK //Particles will glow
183 //| PSYS_PART_TARGET_LINEAR_MASK//Undocumented--Sends particles in straight line?
184 ,
185
186 //PSYS_SRC_TARGET_KEY , NULL_KEY,//The particles will head towards the specified key
187 //Select one of the following for a pattern:
188 //PSYS_SRC_PATTERN_DROP Particles start at emitter with no velocity
189 //PSYS_SRC_PATTERN_EXPLODE Particles explode from the emitter
190 //PSYS_SRC_PATTERN_ANGLE Particles are emitted in a 2-D angle
191 //PSYS_SRC_PATTERN_ANGLE_CONE Particles are emitted in a 3-D cone
192 //PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY Particles are emitted everywhere except for a 3-D cone
193
195
196 ,PSYS_SRC_TEXTURE, "" //UUID of the desired particle texture, or inventory name
197 ,PSYS_SRC_MAX_AGE, 0.0 //Time, in seconds, for particles to be emitted. 0 = forever
198 ,PSYS_PART_MAX_AGE, 0.2 //Lifetime, in seconds, that a particle lasts
199 ,PSYS_SRC_BURST_RATE, blingrate //How long, in seconds, between each emission
200 ,PSYS_SRC_BURST_PART_COUNT, 6 //Number of particles per emission
201 ,PSYS_SRC_BURST_RADIUS, 10.0 //Radius of emission
202 ,PSYS_SRC_BURST_SPEED_MIN, .1 //Minimum speed of an emitted particle
203 ,PSYS_SRC_BURST_SPEED_MAX, .1 //Maximum speed of an emitted particle
204 ,PSYS_SRC_ACCEL, <0,0,0> //Acceleration of particles each second
205 ,PSYS_PART_START_COLOR, <1,1,1> //Starting RGB color
206 ,PSYS_PART_END_COLOR, <1,1,1> //Ending RGB color, if INTERP_COLOR_MASK is on
207 ,PSYS_PART_START_ALPHA, 1.0 //Starting transparency, 1 is opaque, 0 is transparent.
208 ,PSYS_PART_END_ALPHA, 1.0 //Ending transparency
209 ,PSYS_PART_START_SCALE, <.04,.25,.01> //Starting particle size
210 ,PSYS_PART_END_SCALE, <.03,.25,.01> //Ending particle size, if INTERP_SCALE_MASK is on
211 ,PSYS_SRC_ANGLE_BEGIN, 1.54 //Inner angle for ANGLE patterns
212 ,PSYS_SRC_ANGLE_END, 1.55 //Outer angle for ANGLE patterns
213 ,PSYS_SRC_OMEGA, <0.0,0.0,0.0> //Rotation of ANGLE patterns, similar to llTargetOmega()
214 ]);
215 }
216
217 generalParticleEmitterOff()
218 {
220 }
221
222 float myrate = 0.5;
223
224 integer bling_state = TRUE;
225
226
227
228 integer listener;
229 integer MENU_CHANNEL = 1023;
230
231
232 Dialog(key id, list menu)
233 {
234 llListenRemove(listener);
235 listener = llListen(MENU_CHANNEL, "", NULL_KEY, "");
236 llDialog(id, "Select one object below: ", menu, MENU_CHANNEL);
237 }
238
239
240 list name;
241 list inventory;
242
243
244
245 default
246 {
247 on_rez(integer num)
248 {
250 }
251
252
253 changed(integer num)
254 {
256 }
257
258
260 {
261 BlingOn(myrate);
263 if(_debug)
264 llOwnerSay("Contains " + (string) num );
265 integer i;
266
267 for (i = 0; i < num; ++i)
268 {
270
271
272 if(llGetSubString(name,0,0) == "_")
273 {
274 MENU5 += name;
275 if(_debug)
276 {
277 llOwnerSay("Menu5 " + name );
278 llSleep(0.2);
279 }
280 }
281 else
282 {
283 MENU4 += name;
284 if(_debug)
285 {
286 llOwnerSay("Menu4 " + name );
287 llSleep(0.2);
288 }
289 }
290
291 }
292 }
293
294 timer()
295 {
297 if(llListFindList(anims,[(key)("c541c47f-e0c0-058b-ad1a-d6ae3a4584d9")]) != -1)
298 {
299 TypingOn("owner", typo);
300
301 }
302 if(llListFindList(anims,[(key)("c541c47f-e0c0-058b-ad1a-d6ae3a4584d9")]) == -1)
303 {
304 generalParticleEmitterOff();
305 }
306 }
307
308
309 touch_start(integer total_number)
310 {
311 integer i = 0;
312 Dialog(llDetectedKey(0), MENU1);
313 }
314
315 listen(integer channel, string name, key id, string message)
316 {
317 if(channel == MENU_CHANNEL)
318 {
319
320 if(_debug)
321 llOwnerSay("msg: " + message);
322
323 llListenRemove(listener);
324 if(message == "(Menu)")
325 {
326 Dialog(id, MENU1);
327 }
328 else if(message == "(Bling)")
329 {
330 Dialog(id, MENU2);
331 }
332 else if(message == "(Effects)")
333 {
334 Dialog(id, MENU3);
335 }
336 else if(message == "(Poofer)")
337 {
338 Dialog(id, MENU4);
339 }
340 else if(message == "(Typing)")
341 {
342 Dialog(id, MENU5);
343 }
344 // Effects
345 else if(message == "Big Bang")
346 {
347 fakeMakeExplosion(80, 1.0, 13.0, 2.2, 1.0, "fire", <0.0, 0.0, 0.0>);
348 //llTriggerSound("explosion", 10.0);
349 llSleep(.5);
350 fakeMakeExplosion(80, 1.0, 13.0, 2.2, 1.0, "smoke", <0.0, 0.0, 0.0>);
351 llSleep(1);
352 if(bling_state = TRUE)
353 BlingOn(myrate);
354 else
356
357 Dialog(id, MENU3);
358 }
359
360 //bling
361 else if(message == "Bling Stop")
362 {
363 generalParticleEmitterOff();
364 bling_state = FALSE;
365 Dialog(id, MENU2);
366 }
367 else if(message == "Bling On")
368 {
369 BlingOn(myrate);
370 bling_state = TRUE;
371 Dialog(id, MENU2);
372 }
373 else if(message == "Faster")
374 {
375 myrate /=2;
376 BlingOn(myrate);
377 bling_state = TRUE;
378 Dialog(id, MENU2);
379 }
380 else if(message == "Slower")
381 {
382 myrate *=2;
383 BlingOn(myrate);
384 bling_state = TRUE;
385 Dialog(id, MENU2);
386 }
387 else if(message == "Stop")
388 {
389 llParticleSystem( [ ] );
390 Dialog(id, MENU1);
392 }
393 else if(llGetSubString(message,0,0) == "_")
394 {
395 if(_debug)
396 llOwnerSay("typo " + message);
397 typo = message;
398 Dialog(id, MENU5);
399
401 }
402 else if( llGetSubString(message,0,0) != "_")
403 {
404 if(_debug)
405 llOwnerSay("Playing " + message);
406
407 Poofer("owner", message);
408 Dialog(id, MENU4);
409 }
410
411
412
413
414 else
415 {
416 // todo add offsets so box sites perfect on rezzer
417 //llRezAtRoot(message, llGetPos(), ZERO_VECTOR, llGetRot(), 0);
418 }
419 }
420 }
421 }

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