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 White_hearts  

White_hearts

Ama's_Jopsy's Particle Script 0.lsl

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

the Zip file

Download all files for White_hearts
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. White_hearts_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 = 1.0; // 0.0 to 1.0(*), lower = more transparent
13 float endAlpha = 1.0; //
14 vector startSize = <0.1,0.1,0>; // <0.04,0.04,0>(min) to <10,10,0>(max>, <1,1,0>(*)
15 vector endSize = <0.1,0.1,0>; // (Z part of vector is discarded)
16 string texture = "heartatvalentine"; // 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 = 5; // Number of particles created per burst, 1(*) to 4096
21 float rate = 0.1; // Delay between bursts of new particles, 0.0 to 60, 0.1(*)
22 float age = 3.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 = .30; // 0.0(default) to 64? Distance from Emitter where new particles are created.
27 float innerAngle = 0.75; // "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_ANGLE_CONE; // 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 = TRUE; // TRUE or FALSE(*), Particles get blown away by wind in the sim
42 integer bounce = FALSE; // TRUE or FALSE(*), Make particles bounce on Z altitude of emitter
43 float minSpeed = 0.3; // 0.01 to ? Min speed each particle is spit out at, 1.0(*)
44 float maxSpeed = 0.2; // 0.01 to ? Max speed each particle is spit out at, 1.0(*)
45 vector push = <0,0,-0.3>; // 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 onoff=0;
123 updateParticles();
124 }
125
127 {
128 if( enableoutput == FALSE ) {
129 if( onoff ) llResetScript();
130 onoff++;
131 llParticleSystem( [ ] );
132 return;
133 }
134 if(1) return; // Comment out this line to enable this function
135 llWhisper(0,"...Generating List...");
136 for (i=1;i<42;i+=2)
137 {
138 type = llGetListEntryType(sys,i);
139 if(type == TYPE_FLOAT)
140 {
141 tempString = float2String(llList2Float(sys,i));
142 sys = llDeleteSubList(sys,i,i);
143 sys = llListInsertList(sys,[tempString],i);
144 }
145 else if(type == TYPE_VECTOR)
146 {
147 tempVector = llList2Vector(sys,i);
148 tempString = "<" + float2String(tempVector.x) + ","
149 + float2String(tempVector.y) + ","
150 + float2String(tempVector.z) + ">";
151 sys = llDeleteSubList(sys,i,i);
152 sys = llListInsertList(sys,[tempString],i);
153 }
154 else if(type == TYPE_ROTATION)
155 {
156 tempRot = llList2Rot(sys,i);
157 tempString = "<" + float2String(tempRot.x) + ","
158 + float2String(tempRot.y) + ","
159 + float2String(tempRot.z) + ","
160 + float2String(tempRot.s) + ">";
161 sys = llDeleteSubList(sys,i,i);
162 sys = llListInsertList(sys,[tempString],i);
163 }
164 else if(type == TYPE_STRING || type == TYPE_KEY)
165 {
166 tempString = "\"" + llList2String(sys,i) + "\"";
167 sys = llDeleteSubList(sys,i,i);
168 sys = llListInsertList(sys,[tempString],i);
169 }
170 }
171 i = llListFindList(sys,[20,""]);
172 if(i != -1) sys = llDeleteSubList(sys,i,i+1);
173 llWhisper(0,"[" + llList2CSV(llList2List(sys,0,22)) + ",");
174 llWhisper(0,llList2CSV(llList2List(sys,23,-1)) + "]");
175 }
176 }// END //

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