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