Stormy Wilde
The Bones In Your Closet
Join date: 31 Jul 2004
Posts: 130
|
01-24-2006 19:41
I am having a bit of a problem with a particle script. I was able to edit it so that when the prim the script is in turns on/off when clicked. However I need to link about 5 prims together, each with this script in it, and have it so when you click one part of it they all turn off. Right now when I click on them when they are linked only the prim I have clicked on turns off/on. I pasted the script below. Either a touch script that will turn all of the particles off in all of the prims at once would be nice or even a listner script would work also. Thanks. // Particle System 1.0 StartSteam() { // MASK FLAGS: set to "TRUE" to enable integer glow = TRUE; // Makes the particles glow integer bounce = FALSE; // Make particles bounce on Z plane of objects integer interpColor = TRUE; // Color - from start value to end value integer interpSize = TRUE; // Size - from start value to end value integer wind = FALSE; // Particles effected by wind integer followSource = FALSE; // Particles follow the source integer followVel = TRUE; // Particles turn to velocity direction
// Choose a pattern from the following: // PSYS_SRC_PATTERN_EXPLODE // PSYS_SRC_PATTERN_DROP // PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY // PSYS_SRC_PATTERN_ANGLE_CONE // PSYS_SRC_PATTERN_ANGLE integer pattern = PSYS_SRC_PATTERN_ANGLE; // PSYS_SRC_PATTERN_EXPLODE;
// Select a target for particles to go towards // "" for no target, "owner" will follow object owner // and "self" will target this object // or put the key of an object for particles to go to key target = "";
// PARTICLE PARAMETERS float age = 4.4; // Life of each particle float maxSpeed = 0.5; // Max speed each particle is spit out at float minSpeed = 0; // Min speed each particle is spit out at string texture = "Particle Arrow"; // Texture used for particles, default used if blank float startAlpha = 0.8; // Start alpha (transparency) value float endAlpha = 0; // End alpha (transparency) value vector startColor = <0.75,0.85,1>; // Start color of particles <R,G,B> vector endColor = <1,1,1>; // End color of particles <R,G,B> (if interpColor == TRUE) vector startSize = <0.25,0.25,0.25>; // Start size of particles vector endSize = <2,10,2>; // End size of particles (if interpSize == TRUE) vector push = <0.5,0.0,0.0>; // Force pushed on particles
// SYSTEM PARAMETERS float rate = 0.1; // How fast (rate) to emit particles float radius = 0.75; // Radius to emit particles for BURST pattern integer count = 4; // How many particles to emit per BURST float outerAngle = 3*PI; // Outer angle for all ANGLE patterns PI/4 float innerAngle = 0.5; // Inner angle for all ANGLE patterns vector omega = <0,0,0>; // Rotation of ANGLE patterns around the source float life = 0; // Life in seconds for the system to make particles
// SCRIPT VARIABLES integer flags;
flags = 0; if (glow) flags = flags | PSYS_PART_EMISSIVE_MASK; if (bounce) flags = flags | PSYS_PART_BOUNCE_MASK; if (interpColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK; if (interpSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK; if (wind) flags = flags | PSYS_PART_WIND_MASK; if (followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK; if (followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK; if (target != "") flags = flags | PSYS_PART_TARGET_POS_MASK;
llParticleSystem([ PSYS_PART_MAX_AGE,age, PSYS_PART_FLAGS,flags, PSYS_PART_START_COLOR, startColor, PSYS_PART_END_COLOR, endColor, PSYS_PART_START_SCALE,startSize, PSYS_PART_END_SCALE,endSize, PSYS_SRC_PATTERN, pattern, PSYS_SRC_BURST_RATE,rate, PSYS_SRC_ACCEL, push, PSYS_SRC_BURST_PART_COUNT,count, PSYS_SRC_BURST_RADIUS,radius, PSYS_SRC_BURST_SPEED_MIN,minSpeed, PSYS_SRC_BURST_SPEED_MAX,maxSpeed, PSYS_SRC_TARGET_KEY,target, PSYS_SRC_INNERANGLE,innerAngle, PSYS_SRC_OUTERANGLE,outerAngle, PSYS_SRC_OMEGA, omega, PSYS_SRC_MAX_AGE, life, PSYS_SRC_TEXTURE, texture, PSYS_PART_START_ALPHA, startAlpha, PSYS_PART_END_ALPHA, endAlpha ]); } default { state_entry() { StartSteam(); //Start making particles }
touch_start( integer num ) //Turn particles off when touched { state off; //Switch to the off state } }
state off { state_entry() { llParticleSystem([]); //Stop making particles } touch_start( integer num ) //Turn particles back on when touched { state default; } }
|
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
|
01-24-2006 19:56
Try this in the root prim: default { state_entry() { StartSteam(); //Start making particles llMessageLinked(LINK_ALL_CHILDREN, TRUE, "", NULL_KEY); }
touch_start( integer num ) //Turn particles off when touched { state off; //Switch to the off state } }
state off { state_entry() { llParticleSystem([]); //Stop making particles llMessageLinked(LINK_ALL_CHILDREN, FALSE, "", NULL_KEY); } touch_start( integer num ) //Turn particles back on when touched { state default; } } and this in the child prims: default { state_entry() { llPassTouches(TRUE); }
link_message(integer sender_num, integer num, string str, key id) { if (num) { StartSteam(); //Start making particles } else { llParticleSystem([]); //Stop making particles } } }
|
Stormy Wilde
The Bones In Your Closet
Join date: 31 Jul 2004
Posts: 130
|
01-24-2006 20:37
I tried these scripts but when compiling i get an error in both of them for the StartSteam(); line of code.
|
Nepenthes Ixchel
Broadly Offended.
Join date: 6 Dec 2005
Posts: 696
|
01-25-2006 01:06
From: Stormy Wilde I tried these scripts but when compiling i get an error in both of them for the StartSteam(); line of code. Add the StartStream() function from your script to the ones supplied. BamBam's code is an example of using touch and link messages to have multiple scripts interact.
|
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
|
01-25-2006 01:10
BamBam has just typed in the updated default state. You still need your StartStream function at the top of both sections of code.
|
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
|
01-25-2006 11:03
Sorry, I forgot to mention that you need to have the StartStream() function in both scripts.
|
Stormy Wilde
The Bones In Your Closet
Join date: 31 Jul 2004
Posts: 130
|
01-25-2006 21:48
I am still confused by what goes where but I guess I will tinker with it and try to figure it out. TY for the help.
|
Troy Vogel
Marginal Prof. of ZOMG!
Join date: 16 Aug 2004
Posts: 478
|
An Attempt at clarification
01-26-2006 08:35
I am also relatively new to SL scripting and it can be confusing. So I figured I will take one last attempt to clarify what other posts in this thread suggested: The following is what goes into The Root Prim: StartSteam() { // MASK FLAGS: set to "TRUE" to enable integer glow = TRUE; // Makes the particles glow integer bounce = FALSE; // Make particles bounce on Z plane of objects integer interpColor = TRUE; // Color - from start value to end value integer interpSize = TRUE; // Size - from start value to end value integer wind = FALSE; // Particles effected by wind integer followSource = FALSE; // Particles follow the source integer followVel = TRUE; // Particles turn to velocity direction
// Choose a pattern from the following: // PSYS_SRC_PATTERN_EXPLODE // PSYS_SRC_PATTERN_DROP // PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY // PSYS_SRC_PATTERN_ANGLE_CONE // PSYS_SRC_PATTERN_ANGLE integer pattern = PSYS_SRC_PATTERN_ANGLE; // PSYS_SRC_PATTERN_EXPLODE;
// Select a target for particles to go towards // "" for no target, "owner" will follow object owner // and "self" will target this object // or put the key of an object for particles to go to key target = "";
// PARTICLE PARAMETERS float age = 4.4; // Life of each particle float maxSpeed = 0.5; // Max speed each particle is spit out at float minSpeed = 0; // Min speed each particle is spit out at string texture = "Particle Arrow"; // Texture used for particles, default used if blank float startAlpha = 0.8; // Start alpha (transparency) value float endAlpha = 0; // End alpha (transparency) value vector startColor = <0.75,0.85,1>; // Start color of particles <R,G,B> vector endColor = <1,1,1>; // End color of particles <R,G,B> (if interpColor == TRUE) vector startSize = <0.25,0.25,0.25>; // Start size of particles vector endSize = <2,10,2>; // End size of particles (if interpSize == TRUE) vector push = <0.5,0.0,0.0>; // Force pushed on particles
// SYSTEM PARAMETERS float rate = 0.1; // How fast (rate) to emit particles float radius = 0.75; // Radius to emit particles for BURST pattern integer count = 4; // How many particles to emit per BURST float outerAngle = 3*PI; // Outer angle for all ANGLE patterns PI/4 float innerAngle = 0.5; // Inner angle for all ANGLE patterns vector omega = <0,0,0>; // Rotation of ANGLE patterns around the source float life = 0; // Life in seconds for the system to make particles
// SCRIPT VARIABLES integer flags;
flags = 0; if (glow) flags = flags | PSYS_PART_EMISSIVE_MASK; if (bounce) flags = flags | PSYS_PART_BOUNCE_MASK; if (interpColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK; if (interpSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK; if (wind) flags = flags | PSYS_PART_WIND_MASK; if (followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK; if (followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK; if (target != "") flags = flags | PSYS_PART_TARGET_POS_MASK;
llParticleSystem([ PSYS_PART_MAX_AGE,age, PSYS_PART_FLAGS,flags, PSYS_PART_START_COLOR, startColor, PSYS_PART_END_COLOR, endColor, PSYS_PART_START_SCALE,startSize, PSYS_PART_END_SCALE,endSize, PSYS_SRC_PATTERN, pattern, PSYS_SRC_BURST_RATE,rate, PSYS_SRC_ACCEL, push, PSYS_SRC_BURST_PART_COUNT,count, PSYS_SRC_BURST_RADIUS,radius, PSYS_SRC_BURST_SPEED_MIN,minSpeed, PSYS_SRC_BURST_SPEED_MAX,maxSpeed, PSYS_SRC_TARGET_KEY,target, PSYS_SRC_INNERANGLE,innerAngle, PSYS_SRC_OUTERANGLE,outerAngle, PSYS_SRC_OMEGA, omega, PSYS_SRC_MAX_AGE, life, PSYS_SRC_TEXTURE, texture, PSYS_PART_START_ALPHA, startAlpha, PSYS_PART_END_ALPHA, endAlpha ]); }
default { state_entry() { StartSteam(); //Start making particles llMessageLinked(LINK_ALL_CHILDREN, TRUE, "", NULL_KEY); }
touch_start( integer num ) //Turn particles off when touched { state off; //Switch to the off state } }
state off { state_entry() { llParticleSystem([]); //Stop making particles llMessageLinked(LINK_ALL_CHILDREN, FALSE, "", NULL_KEY); } touch_start( integer num ) //Turn particles back on when touched { state default; } }
And this snippet is what goes inside the children: StartSteam() { // MASK FLAGS: set to "TRUE" to enable integer glow = TRUE; // Makes the particles glow integer bounce = FALSE; // Make particles bounce on Z plane of objects integer interpColor = TRUE; // Color - from start value to end value integer interpSize = TRUE; // Size - from start value to end value integer wind = FALSE; // Particles effected by wind integer followSource = FALSE; // Particles follow the source integer followVel = TRUE; // Particles turn to velocity direction
// Choose a pattern from the following: // PSYS_SRC_PATTERN_EXPLODE // PSYS_SRC_PATTERN_DROP // PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY // PSYS_SRC_PATTERN_ANGLE_CONE // PSYS_SRC_PATTERN_ANGLE integer pattern = PSYS_SRC_PATTERN_ANGLE; // PSYS_SRC_PATTERN_EXPLODE;
// Select a target for particles to go towards // "" for no target, "owner" will follow object owner // and "self" will target this object // or put the key of an object for particles to go to key target = "";
// PARTICLE PARAMETERS float age = 4.4; // Life of each particle float maxSpeed = 0.5; // Max speed each particle is spit out at float minSpeed = 0; // Min speed each particle is spit out at string texture = "Particle Arrow"; // Texture used for particles, default used if blank float startAlpha = 0.8; // Start alpha (transparency) value float endAlpha = 0; // End alpha (transparency) value vector startColor = <0.75,0.85,1>; // Start color of particles <R,G,B> vector endColor = <1,1,1>; // End color of particles <R,G,B> (if interpColor == TRUE) vector startSize = <0.25,0.25,0.25>; // Start size of particles vector endSize = <2,10,2>; // End size of particles (if interpSize == TRUE) vector push = <0.5,0.0,0.0>; // Force pushed on particles
// SYSTEM PARAMETERS float rate = 0.1; // How fast (rate) to emit particles float radius = 0.75; // Radius to emit particles for BURST pattern integer count = 4; // How many particles to emit per BURST float outerAngle = 3*PI; // Outer angle for all ANGLE patterns PI/4 float innerAngle = 0.5; // Inner angle for all ANGLE patterns vector omega = <0,0,0>; // Rotation of ANGLE patterns around the source float life = 0; // Life in seconds for the system to make particles
// SCRIPT VARIABLES integer flags;
flags = 0; if (glow) flags = flags | PSYS_PART_EMISSIVE_MASK; if (bounce) flags = flags | PSYS_PART_BOUNCE_MASK; if (interpColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK; if (interpSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK; if (wind) flags = flags | PSYS_PART_WIND_MASK; if (followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK; if (followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK; if (target != "") flags = flags | PSYS_PART_TARGET_POS_MASK;
llParticleSystem([ PSYS_PART_MAX_AGE,age, PSYS_PART_FLAGS,flags, PSYS_PART_START_COLOR, startColor, PSYS_PART_END_COLOR, endColor, PSYS_PART_START_SCALE,startSize, PSYS_PART_END_SCALE,endSize, PSYS_SRC_PATTERN, pattern, PSYS_SRC_BURST_RATE,rate, PSYS_SRC_ACCEL, push, PSYS_SRC_BURST_PART_COUNT,count, PSYS_SRC_BURST_RADIUS,radius, PSYS_SRC_BURST_SPEED_MIN,minSpeed, PSYS_SRC_BURST_SPEED_MAX,maxSpeed, PSYS_SRC_TARGET_KEY,target, PSYS_SRC_INNERANGLE,innerAngle, PSYS_SRC_OUTERANGLE,outerAngle, PSYS_SRC_OMEGA, omega, PSYS_SRC_MAX_AGE, life, PSYS_SRC_TEXTURE, texture, PSYS_PART_START_ALPHA, startAlpha, PSYS_PART_END_ALPHA, endAlpha ]); }
default { state_entry() { llPassTouches(TRUE); }
link_message(integer sender_num, integer num, string str, key id) { if (num) { StartSteam(); //Start making particles } else { llParticleSystem([]); //Stop making particles } } }
Notice that in both instances your original StartStream function comes first and then is followed by the default {} section. So although the two code listings seem identical, if you look closely at the end of each, you will see the difference. I hope this helps, Troy Vogel
|