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 smokey  

smokey

smokey.lsl

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

the Zip file

Download all files for smokey
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. smokey_1.lsl
1
2 // Particle Script 0.4j
3 // Created by Ama Omega 3-7-2004
4 // Updated by Jopsy Pendragon 5-11-2004
5 // For classes/tutorials/tricks, visit the Particle Labratory in Teal
6 // Values marked with (*) are defaults.
7
8 // SECTION ONE: APPEARANCE -- These settings affect how each particle LOOKS.
9 integer glow = TRUE; // TRUE or FALSE(*)
10 vector startColor = <1,1,1>; // RGB color, black<0,0,0> to white<1,1,1>(*)
11 vector endColor = <1,1,1>; //
12 float startAlpha = 0.08; // 0.0 to 1.0(*), lower = more transparent
13 float endAlpha = 0.04; //
14 vector startSize = <2,2,0>; // <0.04,0.04,0>(min) to <10,10,0>(max>, <1,1,0>(*)
15 vector endSize = <2,2,0>; // (Z part of vector is discarded)
16 string texture = "smokey"; // Texture used for particles. Texture must be in prim's inventory.
17
18 // SECTION TWO: FLOW -- These settings affect how Many, how Quickly, and for how Long particles are created.
19 // Note,
20 integer count = 2; // Number of particles created per burst, 1(*) to 4096
21 float rate = 0.50; // Delay between bursts of new particles, 0.0 to 60, 0.1(*)
22 float age = 030.0; // How long each particle lives, 0.1 to 60, 10.0(*)
23 float life = 0.0; // When to stop creating new particles. never stops if 0.0(*)
24
25 // SECTION THREE: PLACEMENT -- Where are new particles created, and what direction are they facing?
26 float radius = 0.0; // 0.0(default) to 64? Distance from Emitter where new particles are created.
27 float innerAngle = PI; // "spread", for all ANGLE patterns, 0(default) to PI
28 float outerAngle = 0.0; // "tilt", for ANGLE patterns, 0(default) to TWO_PI, can use PI_BY_TWO or PI as well.
29 integer pattern = PSYS_SRC_PATTERN_EXPLODE; // Choose one of the following:
30 // PSYS_SRC_PATTERN_EXPLODE (sends particles in all directions)
31 // PSYS_SRC_PATTERN_DROP (ignores minSpeed and maxSpeed. Don't bother with count>1 )
32 // PSYS_SRC_PATTERN_ANGLE_CONE (set innerangle/outerange to make rings/cones of particles)
33 // PSYS_SRC_PATTERN_ANGLE (set innerangle/outerangle to make flat fanshapes of particles)
34 vector omega = <0,0,0>; // How much to rotate the emitter around the <X,Y,Z> axises. <0,0,0>(*)
35 // Warning, there's no way to RESET the emitter direction once you use Omega!!
36 // You must attach the script to a new prim to clear the effect of omega.
37
38 // SECTION FOUR: MOVEMENT -- How do the particles move once they're created?
39 integer followSource = FALSE; // TRUE or FALSE(*), Particles move as the emitter moves, (TRUE disables radius!)
40 integer followVel = FALSE; // TRUE or FALSE(*), Particles rotate towards their direction
41 integer wind = FALSE; // TRUE or FALSE(*), Particles get blown away by wind in the sim
42 integer bounce = TRUE; // TRUE or FALSE(*), Make particles bounce on Z altitude of emitter
43 float minSpeed = 0.1; // 0.01 to ? Min speed each particle is spit out at, 1.0(*)
44 float maxSpeed = 0.5; // 0.01 to ? Max speed each particle is spit out at, 1.0(*)
45 vector push = <0,0,-0.1>; // Continuous force pushed on particles, use small settings for long lived particles
46 key target = ""; // Select a target for particles to arrive at when they die
47 // can be "self" (emitter), "owner" (you), "" or any prim/persons KEY.
48
49 // SECTION FIVE: Ama's "Create Short Particle Settings List"
50 integer enableoutput = FALSE; // If this is TRUE, clicking on your emitter prim will cause it to speak
51 // very terse "shorthand" version of your particle settings. You can cut'n'paste
52 // this abbreviated version into a call to llParticleSystem([ ]); in another script.
53 // Pros: Takes up far less scripting space, letting you focus on the rest of your code.
54 // Cons: makes tune your settings afterwards rather awkward
55
56 // === Don't muck about below this line unless you're comfortable with the LSL scripting language ====
57
58 // Script variables
59 integer pre = 2; //Adjust the precision of the generated list.
60 integer flags;
61 list sys;
62 integer type;
63 vector tempVector;
64 rotation tempRot;
65 string tempString;
66 integer i;
67
68 string float2String(float in)
69 {
70 return llGetSubString((string)in,0,pre - 7);
71 }
72
73 updateParticles()
74 {
75 flags = 0;
76 if(target == "owner") target = llGetOwner();
77 if(target == "self") target = llGetKey();
78 if(glow) flags = flags | PSYS_PART_EMISSIVE_MASK;
79 if(bounce) flags = flags | PSYS_PART_BOUNCE_MASK;
80 if(startColor != endColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK;
81 if(startSize != endSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK;
82 if(wind) flags = flags | PSYS_PART_WIND_MASK;
83 if(followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK;
84 if(followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK;
85 if(target != "") flags = flags | PSYS_PART_TARGET_POS_MASK;
86 sys = [ PSYS_PART_MAX_AGE,age,
87 PSYS_PART_FLAGS,flags,
88 PSYS_PART_START_COLOR, startColor,
89 PSYS_PART_END_COLOR, endColor,
90 PSYS_PART_START_SCALE,startSize,
91 PSYS_PART_END_SCALE,endSize,
92 PSYS_SRC_PATTERN, pattern,
94 PSYS_SRC_ACCEL, push,
100 PSYS_SRC_INNERANGLE,innerAngle,
101 PSYS_SRC_OUTERANGLE,outerAngle,
102 PSYS_SRC_OMEGA, omega,
103 PSYS_SRC_MAX_AGE, life,
104 PSYS_SRC_TEXTURE, texture,
105 PSYS_PART_START_ALPHA, startAlpha,
106 PSYS_PART_END_ALPHA, endAlpha
107 ];
108 float newrate = rate;
109 if(newrate == 0.0) newrate=.01;
110 if( (age/rate)*count < 4096) llParticleSystem(sys);
111 else {
112 llInstantMessage(llGetOwner(),"Your particle system creates too many concurrent particles.");
113 llInstantMessage(llGetOwner(),"Reduce count or age, or increate rate.");
114 llParticleSystem( [ ] );
115 }
116 }
117 integer onoff;
118 default
119 {
121 {
122 llListen( 25, "", NULL_KEY, "" );
123 onoff=0;
124 updateParticles();
125
126 }
127
128 listen(integer chan, string name, key id, string msg)
129 {
130 if(msg == "pgfgfgf")
131 if( enableoutput == FALSE ) {
132 if( onoff ) llResetScript();
133 onoff++;
134 llParticleSystem( [ ] );
135
136 return;
137 }
138 if(1) return; // Comment out this line to enable this function
139 llWhisper(0,"...Generating List...");
140 for (i=1;i<42;i+=2)
141 {
142 type = llGetListEntryType(sys,i);
143 if(type == TYPE_FLOAT)
144 {
145 tempString = float2String(llList2Float(sys,i));
146 sys = llDeleteSubList(sys,i,i);
147 sys = llListInsertList(sys,[tempString],i);
148 }
149 else if(type == TYPE_VECTOR)
150 {
151 tempVector = llList2Vector(sys,i);
152 tempString = "<" + float2String(tempVector.x) + ","
153 + float2String(tempVector.y) + ","
154 + float2String(tempVector.z) + ">";
155 sys = llDeleteSubList(sys,i,i);
156 sys = llListInsertList(sys,[tempString],i);
157 }
158 else if(type == TYPE_ROTATION)
159 {
160 tempRot = llList2Rot(sys,i);
161 tempString = "<" + float2String(tempRot.x) + ","
162 + float2String(tempRot.y) + ","
163 + float2String(tempRot.z) + ","
164 + float2String(tempRot.s) + ">";
165 sys = llDeleteSubList(sys,i,i);
166 sys = llListInsertList(sys,[tempString],i);
167 }
168 else if(type == TYPE_STRING || type == TYPE_KEY)
169 {
170 tempString = "\"" + llList2String(sys,i) + "\"";
171 sys = llDeleteSubList(sys,i,i);
172 sys = llListInsertList(sys,[tempString],i);
173 }
174 }
175 i = llListFindList(sys,[20,""]);
176 if(i != -1) sys = llDeleteSubList(sys,i,i+1);
177 llWhisper(0,"[" + llList2CSV(llList2List(sys,0,22)) + ",");
178 llWhisper(0,llList2CSV(llList2List(sys,23,-1)) + "]");
179 }
180 }// END //

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