Activate particle script in child prim from script in root prim?
|
Talthybius Brevity
Headshop Proprietor
Join date: 14 Nov 2006
Posts: 76
|
02-02-2007 17:17
Hiya,
Begging the collective pardons if I should have been able to find this with lslwiki searches or forum searches, but my attempts at finding the answer have left me as ignorant as I was when my search began, and so...
I want to improve on my bong exhale smoke. Currently I'm doing it by rezzing a small transparent prim which has the particle smoke script in it, and it the prim dies after the 3 seconds of smoke. This I like to think of as a clever approach, but it is riddled with problems. Trying to get it to rez in the same place relative to the root prim (regardless of which direction the AV it is attached to is facing) seems to be an uphill battle that I need to route around rather than over. I've changed from the little hippie who could to the little hippie who can't. Or, to use a decidedly unhippie cliché "that's a hill I don't care to die on."
Also, the rezzing of the prim sometimes causes the AV to jump back a meter or more. It seems rather intermittent and random to me, but I have found that the problem is more likely to occur if the AV is within 1meter or less of any other objects. Lag also seems to increase the frequency of this problem, and we've had no shortage of lag in the last few weeks.
So, rather than rezzing the exhale smoke prim, i want to try having that transparent prim permanently attached, and just activate the particle script in it at the right moment. The timer stuff I get...
What I don't have the slightest clue of how to do is to get the main script in the root prim tell the particle script in that child prim to activate.
Can anyone spare me a short explanation with a little example?
TIA, TB
|
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
|
02-02-2007 18:37
At the moment there is a bug that prevents child prims from correctly turning off their own particles... but the following example should work anyway: To turn particles on, use this: llMessageLinked( LINK_ALL_OTHERS, 1, "", "" ); To turn them off from, use: llMessageLinked( LINK_ALL_OTHERS, 0, "", ""  ; In the child prim that will have the particles put: default { link_message( integer sib, integer num, string msg, key id ) { if ( num == 0 ) { // turn off llParticleSystem( [ PSYS_SRC_BURST_PART_COUNT, 0 ]); llSleep(0.5); llParticleSystem( [ ] ); } else { llParticleSystem( [ ... your smoke effect ... ] ); } } } For more examples and tutorials... drop by the Particle Laboratory in Teal. I've recently added several basic effects that people can copy and adapt as well as a section that teaches people how to set up TARGETS for particles. A section on basic on/off switches is coming soon. 
_____________________
* The Particle Laboratory * - One of SecondLife's Oldest Learning Resources. Free particle, control and targetting scripts. Numerous in-depth visual demonstrations, and multiple sandbox areas. - Stop by and try out Jopsy's new "Porgan 1800" an advanced steampunk styled 'particle organ' and the new particle texture store!
|
Talthybius Brevity
Headshop Proprietor
Join date: 14 Nov 2006
Posts: 76
|
02-02-2007 19:14
Thanks Jopsy, you rock! I'll give it a try. And I'll revisit your lab soon to refresh my brain and check out your new stuff! (P.S. you and your lab are in the list of acknowledgments in the notecard README files I put in the delivery box with my products.  )
|
Talthybius Brevity
Headshop Proprietor
Join date: 14 Nov 2006
Posts: 76
|
02-25-2007 20:00
Well I'm clearly doing something wrong here, i get a syntax error at row 8 col 26 (the first appearance of 'vector'): default { link_message( integer sib, integer num, string msg, key id ) { if ( num == 0 ) { // turn off llParticleSystem( [ PSYS_SRC_BURST_PART_COUNT, 0 ]); llParticleSystem( [ ] ); } else { llParticleSystem( [ vector START_SCALE = < 0.0, 0.0, 0.0 >; // < 1.0, 1.0, 0.0 > vector END_SCALE = < 0.6, 0.7, 0.0 >; // < 1.0, 1.0, 0.0 > vector START_COLOR = < 0.9, 0.9, 0.9 >; // < 1.0, 1.0, 1.0 > vector END_COLOR = < 0.9, 0.9, 0.9 >; // < 1.0, 1.0, 1.0 > float START_ALPHA = 1.0; // 1.00 float END_ALPHA = 0.0; // 1.00 integer INTERP_COLOR = TRUE; // FALSE integer INTERP_SCALE = TRUE; // FALSE integer EMISSIVE = TRUE; // FALSE string TEXTURE = "dcab6cc4-172f-e30d-b1d0-f558446f20d4"; // "" // START/END: refers to the birth and death time of each particle. // SCALE: particle height/width, from 0.04 to 4.0. (no depth) // ALPHA: sets transparency, from invis = 0.0 to opaque = 1.0 // START_ALPHA is ignored if it is less than END_ALPHA // COLOR: vectors <Red,Green,Blue>, each 0.00 to 1.00 // INTERP_COLOR: enables/disables END_COLOR and END_ALPHA // INTERP_SCALE: enables/disables END_SCALE // EMISSIVE: enables/diables particle 'glow' // TEXTURE: name of a texture in the emitter-prim's inventory // or the asset id key of any texture // Part-2 - FLOW - These settings affect how Many, how Quickly, // and for how Long particles are present float AGE = 0.60; // 10.00 float RATE = 0.01; // 0.10 integer COUNT = 2; // 1 float LIFE = 0.00; // 0.0 // AGE: How many seconds each particle lives, 0.1 to 60 // RATE: Seconds between particle bursts, 0.0 to 60 // COUNT: Number of particles per burst, 1 to 4096 // LIFE Number of seconds to wait before shutting off 0.1 to 60 // 0.0 never stops // Part-3 - 3 PLACEMENT -- Where are new particles created, and what // direction are they facing? integer PATTERN = PSYS_SRC_PATTERN_ANGLE_CONE; // PSYS_SRC_PATTERN_DROP float RADIUS = 0.00; // 0.00 float ANGLE_BEGIN = 0.05; // 0.00 float ANGLE_END = 1.00; // 0.00 vector OMEGA = < 0.00, 0.00, 0.00 >; // < 0.00, 0.00, 0.00 > //float INNERANGLE = 0.00; // 0.00 //float OUTERANGLE = 0.00; // 0.00 // PATTERN: must be set to one of the following: // PSYS_SRC_PATTERN_EXPLODE sends particles in all directions // PSYS_SRC_PATTERN_DROP ignores minSpeed and maxSpeed. // PSYS_SRC_PATTERN_ANGLE_CONE use ANGLE settings to make rings/cones // PSYS_SRC_PATTERN_ANGLE use innerangle/outerangle to make flat // wedges // RADIUS: distance between emitter and each new particle, 0.0 to 64? // ANGLE_BEGIN: for both ANGLE patterns, 0 to PI(3.14159) // ANGLE_END: for both for ANGLE patterns, 0 to PI. // OMEGA: How much to rotate the emitter around the <X,Y,Z> axises // after each burst. Set OMEGA to all 0's to reset/disable it. // INNER/OUTER ANGLE: Depreciated. Old versions of ANGLE_BEGIN/_END. // Can still be used to make lop-sided angle displays though.
// Part-4 - MOVEMENT - How do the particles move once they're created? integer FOLLOW_SRC = FALSE; // FALSE integer FOLLOW_VELOCITY = FALSE; // FALSE integer WIND = FALSE; // FALSE integer BOUNCE = TRUE; // FALSE float SPEED_MIN = 0.30; // 1.00 float SPEED_MAX = 0.90; // 1.00 vector ACCEL = < 1.25, 4.00, -0.50 >; // < 0.00, 0.00, 0.00 > integer TARGET_POS = FALSE; // FALSE key TARGET = llGetKey(); // llGetKey(); // FOLLOW_SRC: moves particles when emitter moves. It will disable RADIUS! // FOLLOW_VELOCITY: Particles rotate towards their heading // WIND: Sim's Wind will push particles // BOUNCE: Make particles bounce above the Z altitude of emitter // SPEED_MIN: 0.01 to ?, slowest speed of new particles, 1.0(*) // SPEED_MAX: 0.01 to ?, fastest speed of new particle, 1.0(*) // SPEED_ is ignored for the DROP pattern. // ACCEL: a continuous force pushed on particles, // use SMALL settings for long lived particles // TARGET_POS: If FALSE(*), TARGET value is ignored. // TARGET: Select a target for particles to arrive at when they die // key TARGET = llGetKey(); // particles return to the emitter // key TARGET = llGetOwner(); // particles home in on owner // You can have another object llSay(999,llGetKey); // and grab the key with this object by using the listen() // event handler. list particle_parameters = [ PSYS_PART_FLAGS, ( ( EMISSIVE * PSYS_PART_EMISSIVE_MASK ) | ( BOUNCE * PSYS_PART_BOUNCE_MASK ) | ( INTERP_COLOR * PSYS_PART_INTERP_COLOR_MASK ) | ( INTERP_SCALE * PSYS_PART_INTERP_SCALE_MASK ) | ( WIND * PSYS_PART_WIND_MASK ) | ( FOLLOW_SRC * PSYS_PART_FOLLOW_SRC_MASK ) | ( FOLLOW_VELOCITY * PSYS_PART_FOLLOW_VELOCITY_MASK ) | ( TARGET_POS * PSYS_PART_TARGET_POS_MASK ) ), PSYS_PART_START_COLOR, START_COLOR, PSYS_PART_END_COLOR, END_COLOR, PSYS_PART_START_ALPHA, START_ALPHA, PSYS_PART_END_ALPHA, END_ALPHA, PSYS_PART_START_SCALE, START_SCALE, PSYS_PART_END_SCALE, END_SCALE, PSYS_SRC_PATTERN, PATTERN, PSYS_SRC_BURST_PART_COUNT, COUNT, PSYS_SRC_BURST_RATE, RATE, PSYS_PART_MAX_AGE, AGE, PSYS_SRC_ACCEL, ACCEL, PSYS_SRC_BURST_RADIUS, RADIUS, PSYS_SRC_BURST_SPEED_MIN, SPEED_MIN, PSYS_SRC_BURST_SPEED_MAX, SPEED_MAX, PSYS_SRC_TARGET_KEY, TARGET, PSYS_SRC_ANGLE_BEGIN, ANGLE_BEGIN, PSYS_SRC_ANGLE_END, ANGLE_END, //PSYS_SRC_INNERANGLE, INNERANGLE, //PSYS_SRC_OUTERANGLE, OUTERANGLE, PSYS_SRC_OMEGA, OMEGA, PSYS_SRC_MAX_AGE, LIFE, PSYS_SRC_TEXTURE, TEXTURE ] ); } } }
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
02-26-2007 00:33
To answer the first problem, you need to take into account rotation so multiply the positional offset by the rotation when you rez the object. To answer the second, you have cut and pasetd all of the declarations. Jopsy just meant for you to put your primitive parameters there not everything. vector START_SCALE = < 0.0, 0.0, 0.0 >; // < 1.0, 1.0, 0.0 > vector END_SCALE = < 0.6, 0.7, 0.0 >; // < 1.0, 1.0, 0.0 > vector START_COLOR = < 0.9, 0.9, 0.9 >; // < 1.0, 1.0, 1.0 > vector END_COLOR = < 0.9, 0.9, 0.9 >; // < 1.0, 1.0, 1.0 > float START_ALPHA = 1.0; // 1.00 float END_ALPHA = 0.0; // 1.00 integer INTERP_COLOR = TRUE; // FALSE integer INTERP_SCALE = TRUE; // FALSE integer EMISSIVE = TRUE; // FALSE string TEXTURE = "dcab6cc4-172f-e30d-b1d0-f558446f20d4"; // "" // START/END: refers to the birth and death time of each particle. // SCALE: particle height/width, from 0.04 to 4.0. (no depth) // ALPHA: sets transparency, from invis = 0.0 to opaque = 1.0 // START_ALPHA is ignored if it is less than END_ALPHA // COLOR: vectors <Red,Green,Blue>, each 0.00 to 1.00 // INTERP_COLOR: enables/disables END_COLOR and END_ALPHA // INTERP_SCALE: enables/disables END_SCALE // EMISSIVE: enables/diables particle 'glow' // TEXTURE: name of a texture in the emitter-prim's inventory // or the asset id key of any texture // Part-2 - FLOW - These settings affect how Many, how Quickly, // and for how Long particles are present float AGE = 0.60; // 10.00 float RATE = 0.01; // 0.10 integer COUNT = 2; // 1 float LIFE = 0.00; // 0.0 // AGE: How many seconds each particle lives, 0.1 to 60 // RATE: Seconds between particle bursts, 0.0 to 60 // COUNT: Number of particles per burst, 1 to 4096 // LIFE Number of seconds to wait before shutting off 0.1 to 60 // 0.0 never stops // Part-3 - 3 PLACEMENT -- Where are new particles created, and what // direction are they facing? integer PATTERN = PSYS_SRC_PATTERN_ANGLE_CONE; // PSYS_SRC_PATTERN_DROP float RADIUS = 0.00; // 0.00 float ANGLE_BEGIN = 0.05; // 0.00 float ANGLE_END = 1.00; // 0.00 vector OMEGA = < 0.00, 0.00, 0.00 >; // < 0.00, 0.00, 0.00 > //float INNERANGLE = 0.00; // 0.00 //float OUTERANGLE = 0.00; // 0.00 // PATTERN: must be set to one of the following: // PSYS_SRC_PATTERN_EXPLODE sends particles in all directions // PSYS_SRC_PATTERN_DROP ignores minSpeed and maxSpeed. // PSYS_SRC_PATTERN_ANGLE_CONE use ANGLE settings to make rings/cones // PSYS_SRC_PATTERN_ANGLE use innerangle/outerangle to make flat // wedges // RADIUS: distance between emitter and each new particle, 0.0 to 64? // ANGLE_BEGIN: for both ANGLE patterns, 0 to PI(3.14159) // ANGLE_END: for both for ANGLE patterns, 0 to PI. // OMEGA: How much to rotate the emitter around the <X,Y,Z> axises // after each burst. Set OMEGA to all 0's to reset/disable it. // INNER/OUTER ANGLE: Depreciated. Old versions of ANGLE_BEGIN/_END. // Can still be used to make lop-sided angle displays though.
// Part-4 - MOVEMENT - How do the particles move once they're created? integer FOLLOW_SRC = FALSE; // FALSE integer FOLLOW_VELOCITY = FALSE; // FALSE integer WIND = FALSE; // FALSE integer BOUNCE = TRUE; // FALSE float SPEED_MIN = 0.30; // 1.00 float SPEED_MAX = 0.90; // 1.00 vector ACCEL = < 1.25, 4.00, -0.50 >; // < 0.00, 0.00, 0.00 > integer TARGET_POS = FALSE; // FALSE // FOLLOW_SRC: moves particles when emitter moves. It will disable RADIUS! // FOLLOW_VELOCITY: Particles rotate towards their heading // WIND: Sim's Wind will push particles // BOUNCE: Make particles bounce above the Z altitude of emitter // SPEED_MIN: 0.01 to ?, slowest speed of new particles, 1.0(*) // SPEED_MAX: 0.01 to ?, fastest speed of new particle, 1.0(*) // SPEED_ is ignored for the DROP pattern. // ACCEL: a continuous force pushed on particles, // use SMALL settings for long lived particles // TARGET_POS: If FALSE(*), TARGET value is ignored. // TARGET: Select a target for particles to arrive at when they die // key TARGET = llGetKey(); // particles return to the emitter // key TARGET = llGetOwner(); // particles home in on owner // You can have another object llSay(999,llGetKey); // and grab the key with this object by using the listen() // event handler. default { link_message( integer sib, integer num, string msg, key id ) { if ( num == 0 ) { // turn off llParticleSystem( [ PSYS_SRC_BURST_PART_COUNT, 0 ]); llParticleSystem( [ ] ); } else { key TARGET = llGetKey(); // llGetKey(); llParticleSystem( [
PSYS_PART_FLAGS, ( ( EMISSIVE * PSYS_PART_EMISSIVE_MASK ) | ( BOUNCE * PSYS_PART_BOUNCE_MASK ) | ( INTERP_COLOR * PSYS_PART_INTERP_COLOR_MASK ) | ( INTERP_SCALE * PSYS_PART_INTERP_SCALE_MASK ) | ( WIND * PSYS_PART_WIND_MASK ) | ( FOLLOW_SRC * PSYS_PART_FOLLOW_SRC_MASK ) | ( FOLLOW_VELOCITY * PSYS_PART_FOLLOW_VELOCITY_MASK ) | ( TARGET_POS * PSYS_PART_TARGET_POS_MASK ) ), PSYS_PART_START_COLOR, START_COLOR, PSYS_PART_END_COLOR, END_COLOR, PSYS_PART_START_ALPHA, START_ALPHA, PSYS_PART_END_ALPHA, END_ALPHA, PSYS_PART_START_SCALE, START_SCALE, PSYS_PART_END_SCALE, END_SCALE, PSYS_SRC_PATTERN, PATTERN, PSYS_SRC_BURST_PART_COUNT, COUNT, PSYS_SRC_BURST_RATE, RATE, PSYS_PART_MAX_AGE, AGE, PSYS_SRC_ACCEL, ACCEL, PSYS_SRC_BURST_RADIUS, RADIUS, PSYS_SRC_BURST_SPEED_MIN, SPEED_MIN, PSYS_SRC_BURST_SPEED_MAX, SPEED_MAX, PSYS_SRC_TARGET_KEY, TARGET, PSYS_SRC_ANGLE_BEGIN, ANGLE_BEGIN, PSYS_SRC_ANGLE_END, ANGLE_END, //PSYS_SRC_INNERANGLE, INNERANGLE, //PSYS_SRC_OUTERANGLE, OUTERANGLE, PSYS_SRC_OMEGA, OMEGA, PSYS_SRC_MAX_AGE, LIFE, PSYS_SRC_TEXTURE, TEXTURE ] ); } } }
|
Talthybius Brevity
Headshop Proprietor
Join date: 14 Nov 2006
Posts: 76
|
02-28-2007 22:13
Thanks very much Newg. So this is odd (to me.) I'm getting no errors and lslint isn't finding anything either, but i get no smoke. In the child prim i've got the script in your last post. the below is from the script in the root prim, can you spot the error of my ways? touch_start(integer total_number) { key User = llDetectedKey(0); llRequestPermissions(User, PERMISSION_TRIGGER_ANIMATION | PERMISSION_ATTACH); } run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { llPreloadSound("bonghit"); PlayAnimation(0); PlayAnimation(1); if (perm & PERMISSION_ATTACH) llAttachToAvatar(ATTACH_LHAND); PlayAnimation(2); if(llStringLength(soundname) > 0)llPlaySound(soundname,volume); PlayAnimation(3); PlayAnimation(4); llSleep(.15); // commenting the rotation goodies out because the prim is now a linked child instead of being rezzed // rotation x_60 = llEuler2Rot( <60 * DEG_TO_RAD, 90 * DEG_TO_RAD, 90 * DEG_TO_RAD> ); // rotation new_rot = x_60 * llGetRot(); // compute local rotation // llRezObject("ExhalePrim", llGetPos() + <0.02, 0.12, 0.95>, ZERO_VECTOR, new_rot, 42); // orient the object accordingly PlayAnimation(5); llMessageLinked(LINK_ALL_OTHERS,1,"",""); llSleep(.30); llMessageLinked(LINK_ALL_OTHERS,0,"",""); PlayAnimation(6); llResetScript(); // StopAnimation(); } } }
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-01-2007 01:38
You are only letting the smoke run for 0.3 seconds so its probably never getting rezzed?
|
Talthybius Brevity
Headshop Proprietor
Join date: 14 Nov 2006
Posts: 76
|
03-01-2007 21:45
yeah, i'd done that on some crazy notion that perhaps it was parsing it out of order so was perhaps delaying it 3.0 instead of playing it for 3.0. (yes, crazy talk from a newbie 'coder' wannabe)
so, anyway, i get the same lack of results with llSleep(3.0);
whaa
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-02-2007 00:23
From: Talthybius Brevity yeah, i'd done that on some crazy notion that perhaps it was parsing it out of order so was perhaps delaying it 3.0 instead of playing it for 3.0. (yes, crazy talk from a newbie 'coder' wannabe)
so, anyway, i get the same lack of results with llSleep(3.0);
whaa Ok, in the child prim particle script, try putting an llOwnerSay message inside the linked message event handler, just to make sure its getting the messages?
|
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
|
03-02-2007 02:06
And.. the child-prim particle shutdown bug still seems to be around. So when you try to shut off your particles the following sequence seems to work more reliably... llParticleSystem( [ PSYS_SRC_MAX_AGE, 0.25] ); llSleep(.5); llParticleSystem( [] ); Also... I tried your example... doctored up a bit... the run_time_permissions(integer perm) handler didn't seem to be triggering.
|
Talthybius Brevity
Headshop Proprietor
Join date: 14 Nov 2006
Posts: 76
|
03-03-2007 15:17
Thanks Newg, Thanks Jopsy,
I added the llOwnerSay, seems to be no joy in the valley there. I'd fittingly set it to say "wft?" but it did not ask.
I tried unlinking and relinking it all, checked the groups on the individual prims to make sure they all match, particularly the root and the particle child (not knowing if it matters or not) but nothing there either.
Talthybius Brevity Scratches his head some more.
How do I fix the "run_time_permissions(integer perm)" not triggering?
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-04-2007 00:56
Well I just tried the following cut down version of teh code and it worked fine default { touch_start(integer total_number) { key User = llDetectedKey(0); llRequestPermissions(User, PERMISSION_TRIGGER_ANIMATION | PERMISSION_ATTACH); } run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { llOwnerSay("here"); //llPreloadSound("bonghit"); //PlayAnimation(0); //PlayAnimation(1); if (perm & PERMISSION_ATTACH) llAttachToAvatar(ATTACH_LHAND); //PlayAnimation(2); //if(llStringLength(soundname) > 0)llPlaySound(soundname,volume); //PlayAnimation(3); //PlayAnimation(4); llSleep(.15); // commenting the rotation goodies out because the prim is now a linked child instead of being rezzed // rotation x_60 = llEuler2Rot( <60 * DEG_TO_RAD, 90 * DEG_TO_RAD, 90 * DEG_TO_RAD> ); // rotation new_rot = x_60 * llGetRot(); // compute local rotation // llRezObject("ExhalePrim", llGetPos() + <0.02, 0.12, 0.95>, ZERO_VECTOR, new_rot, 42); // orient the object accordingly //PlayAnimation(5); llMessageLinked(LINK_ALL_OTHERS,1,"",""); llSleep(.30); llMessageLinked(LINK_ALL_OTHERS,0,"",""); //PlayAnimation(6); llResetScript(); // StopAnimation(); } } }
|
Talthybius Brevity
Headshop Proprietor
Join date: 14 Nov 2006
Posts: 76
|
03-04-2007 15:49
oh.
I had put the llOwnerSay in the child prim thinking that if it were triggered there then we'd know that the child prim is 'hearing' the root prim.
how does putting it in the root prim confirm that the child prim is getting its command from the root prim (he asks in a confused newbie voice)?
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-05-2007 01:41
From: Talthybius Brevity oh.
I had put the llOwnerSay in the child prim thinking that if it were triggered there then we'd know that the child prim is 'hearing' the root prim.
how does putting it in the root prim confirm that the child prim is getting its command from the root prim (he asks in a confused newbie voice)? It doesnt, it just confirms that the run timer permissions event is running correctly.
|
Talthybius Brevity
Headshop Proprietor
Join date: 14 Nov 2006
Posts: 76
|
03-05-2007 19:46
From: Newgate Ludd It doesnt, it just confirms that the run timer permissions event is running correctly. Yup its running correctly. All the animations are played correctly except the particle script in the child prim. Talthybius Brevity resumes the scratching of his head
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-06-2007 01:24
From: Talthybius Brevity Yup its running correctly. All the animations are played correctly except the particle script in the child prim.
Talthybius Brevity resumes the scratching of his head So does the linked message event get triggered in the child prim? And if so what is it receiving?
|
Talthybius Brevity
Headshop Proprietor
Join date: 14 Nov 2006
Posts: 76
|
03-06-2007 22:03
From: Newgate Ludd So does the linked message event get triggered in the child prim? And if so what is it receiving? Oops, sorry, I'd thought I'd mention that putting the llOwnerSay in the child prim to see if it was getting triggered revealed that it did not seem to be getting the linked message. The thread is getting muddy so I'll post where I'm at currently: All animations and sounds work except the particle script (smoke) in the child prim (aka 'exhale prim' in my mind) and the llOwnerSay in the child prim is never spoken. Here is the part of the script in the root prim which matters to this thread (if you need to see the rest of it just lemme know): default { state_entry() { }
touch_start(integer total_number) { key User = llDetectedKey(0); llRequestPermissions(User, PERMISSION_TRIGGER_ANIMATION | PERMISSION_ATTACH); } run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { llPreloadSound("bonghit"); PlayAnimation(0); PlayAnimation(1); if (perm & PERMISSION_ATTACH) llAttachToAvatar(ATTACH_LHAND); PlayAnimation(2); if(llStringLength(soundname) > 0)llPlaySound(soundname,volume); PlayAnimation(3); PlayAnimation(4); llSleep(.15); // rotation x_60 = llEuler2Rot( <60 * DEG_TO_RAD, 90 * DEG_TO_RAD, 90 * DEG_TO_RAD> ); // rotation new_rot = x_60 * llGetRot(); // compute local rotation // llRezObject("ExhalePrim", llGetPos() + <0.02, 0.12, 0.95>, ZERO_VECTOR, new_rot, 42); // orient the object accordingly PlayAnimation(5); llMessageLinked(LINK_ALL_OTHERS,1,"",""); llSleep(3.0); llMessageLinked(LINK_ALL_OTHERS,0,"",""); PlayAnimation(6); llResetScript(); // StopAnimation(); } } } and here's the entire contents of the particle script in the child prim: vector START_SCALE = < 0.0, 0.0, 0.0 >; // < 1.0, 1.0, 0.0 > vector END_SCALE = < 0.6, 0.7, 0.0 >; // < 1.0, 1.0, 0.0 > vector START_COLOR = < 0.9, 0.9, 0.9 >; // < 1.0, 1.0, 1.0 > vector END_COLOR = < 0.9, 0.9, 0.9 >; // < 1.0, 1.0, 1.0 > float START_ALPHA = 1.0; // 1.00 float END_ALPHA = 0.0; // 1.00 integer INTERP_COLOR = TRUE; // FALSE integer INTERP_SCALE = TRUE; // FALSE integer EMISSIVE = TRUE; // FALSE string TEXTURE = "dcab6cc4-172f-e30d-b1d0-f558446f20d4"; // "" // START/END: refers to the birth and death time of each particle. // SCALE: particle height/width, from 0.04 to 4.0. (no depth) // ALPHA: sets transparency, from invis = 0.0 to opaque = 1.0 // START_ALPHA is ignored if it is less than END_ALPHA // COLOR: vectors <Red,Green,Blue>, each 0.00 to 1.00 // INTERP_COLOR: enables/disables END_COLOR and END_ALPHA // INTERP_SCALE: enables/disables END_SCALE // EMISSIVE: enables/diables particle 'glow' // TEXTURE: name of a texture in the emitter-prim's inventory // or the asset id key of any texture
// Part-2 - FLOW - These settings affect how Many, how Quickly, // and for how Long particles are present float AGE = 0.60; // 10.00 float RATE = 0.01; // 0.10 integer COUNT = 2; // 1 float LIFE = 0.00; // 0.0 // AGE: How many seconds each particle lives, 0.1 to 60 // RATE: Seconds between particle bursts, 0.0 to 60 // COUNT: Number of particles per burst, 1 to 4096 // LIFE Number of seconds to wait before shutting off 0.1 to 60 // 0.0 never stops
// Part-3 - 3 PLACEMENT -- Where are new particles created, and what // direction are they facing? integer PATTERN = PSYS_SRC_PATTERN_ANGLE_CONE; // PSYS_SRC_PATTERN_DROP float RADIUS = 0.00; // 0.00 float ANGLE_BEGIN = 0.05; // 0.00 float ANGLE_END = 1.00; // 0.00 vector OMEGA = < 0.00, 0.00, 0.00 >; // < 0.00, 0.00, 0.00 > //float INNERANGLE = 0.00; // 0.00 //float OUTERANGLE = 0.00; // 0.00 // PATTERN: must be set to one of the following: // PSYS_SRC_PATTERN_EXPLODE sends particles in all directions // PSYS_SRC_PATTERN_DROP ignores minSpeed and maxSpeed. // PSYS_SRC_PATTERN_ANGLE_CONE use ANGLE settings to make rings/cones // PSYS_SRC_PATTERN_ANGLE use innerangle/outerangle to make flat // wedges // RADIUS: distance between emitter and each new particle, 0.0 to 64? // ANGLE_BEGIN: for both ANGLE patterns, 0 to PI(3.14159) // ANGLE_END: for both for ANGLE patterns, 0 to PI. // OMEGA: How much to rotate the emitter around the <X,Y,Z> axises // after each burst. Set OMEGA to all 0's to reset/disable it. // INNER/OUTER ANGLE: Depreciated. Old versions of ANGLE_BEGIN/_END. // Can still be used to make lop-sided angle displays though.
// Part-4 - MOVEMENT - How do the particles move once they're created? integer FOLLOW_SRC = FALSE; // FALSE integer FOLLOW_VELOCITY = FALSE; // FALSE integer WIND = FALSE; // FALSE integer BOUNCE = TRUE; // FALSE float SPEED_MIN = 0.30; // 1.00 float SPEED_MAX = 0.90; // 1.00 vector ACCEL = < 1.25, 4.00, -0.50 >; // < 0.00, 0.00, 0.00 > integer TARGET_POS = FALSE; // FALSE // FOLLOW_SRC: moves particles when emitter moves. It will disable RADIUS! // FOLLOW_VELOCITY: Particles rotate towards their heading // WIND: Sim's Wind will push particles // BOUNCE: Make particles bounce above the Z altitude of emitter // SPEED_MIN: 0.01 to ?, slowest speed of new particles, 1.0(*) // SPEED_MAX: 0.01 to ?, fastest speed of new particle, 1.0(*) // SPEED_ is ignored for the DROP pattern. // ACCEL: a continuous force pushed on particles, // use SMALL settings for long lived particles // TARGET_POS: If FALSE(*), TARGET value is ignored. // TARGET: Select a target for particles to arrive at when they die // key TARGET = llGetKey(); // particles return to the emitter // key TARGET = llGetOwner(); // particles home in on owner // You can have another object llSay(999,llGetKey); // and grab the key with this object by using the listen() // event handler.
default { link_message( integer sib, integer num, string msg, key id ) { if ( num == 0 ) { // turn off llParticleSystem( [ PSYS_SRC_BURST_PART_COUNT, 0 ]); llParticleSystem( [ ] ); } else { llOwnerSay("The Child Prim Speaks!"); key TARGET = llGetKey(); // llGetKey(); llParticleSystem( [
PSYS_PART_FLAGS, ( ( EMISSIVE * PSYS_PART_EMISSIVE_MASK ) | ( BOUNCE * PSYS_PART_BOUNCE_MASK ) | ( INTERP_COLOR * PSYS_PART_INTERP_COLOR_MASK ) | ( INTERP_SCALE * PSYS_PART_INTERP_SCALE_MASK ) | ( WIND * PSYS_PART_WIND_MASK ) | ( FOLLOW_SRC * PSYS_PART_FOLLOW_SRC_MASK ) | ( FOLLOW_VELOCITY * PSYS_PART_FOLLOW_VELOCITY_MASK ) | ( TARGET_POS * PSYS_PART_TARGET_POS_MASK ) ), PSYS_PART_START_COLOR, START_COLOR, PSYS_PART_END_COLOR, END_COLOR, PSYS_PART_START_ALPHA, START_ALPHA, PSYS_PART_END_ALPHA, END_ALPHA, PSYS_PART_START_SCALE, START_SCALE, PSYS_PART_END_SCALE, END_SCALE, PSYS_SRC_PATTERN, PATTERN, PSYS_SRC_BURST_PART_COUNT, COUNT, PSYS_SRC_BURST_RATE, RATE, PSYS_PART_MAX_AGE, AGE, PSYS_SRC_ACCEL, ACCEL, PSYS_SRC_BURST_RADIUS, RADIUS, PSYS_SRC_BURST_SPEED_MIN, SPEED_MIN, PSYS_SRC_BURST_SPEED_MAX, SPEED_MAX, PSYS_SRC_TARGET_KEY, TARGET, PSYS_SRC_ANGLE_BEGIN, ANGLE_BEGIN, PSYS_SRC_ANGLE_END, ANGLE_END, //PSYS_SRC_INNERANGLE, INNERANGLE, //PSYS_SRC_OUTERANGLE, OUTERANGLE, PSYS_SRC_OMEGA, OMEGA, PSYS_SRC_MAX_AGE, LIFE, PSYS_SRC_TEXTURE, TEXTURE ] ); } } } thanks for your help in facing this perplexing thing. i'm thinking at this point that it must be something so obvious that it is hard to see.
|
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
|
03-09-2007 11:14
Heya... I'm still suspicious of that llRequestPermissions() call. Maybe try something more like: integer perms; key lastuser; do_stuff( ) { llPreloadSound("bonghit"); PlayAnimation(0); PlayAnimation(1); if ( perms & PERMISSION_ATTACH) llAttachToAvatar(ATTACH_LHAND); PlayAnimation(2); if(llStringLength(soundname) > 0)llPlaySound(soundname,volume); PlayAnimation(3); PlayAnimation(4); llSleep(.15); PlayAnimation(5); llMessageLinked(LINK_ALL_OTHERS,1,"",""); llSleep(3.0); llMessageLinked(LINK_ALL_OTHERS,0,"",""); PlayAnimation(6); llResetScript(); } default { touch_start(integer total_number) { key user = llDetectedKey(0); perms = llGetPermissions(); if ( user != lastuser ) llRequestPermissions( User, PERMISSION_TRIGGER_ANIMATION | PERMISSION_ATTACH); else { lastuser = user; if ( perms & (PERMISSION_TRIGGER_ANIMATION | PERMISSION_ATTACH) ) do_stuff( ); else llRequestPermissions( user, PERMISSION_TRIGGER_ANIMATION | PERMISSION_ATTACH); } } run_time_permissions(integer local_perm) { perms = local_perm; if (perms & PERMISSION_TRIGGER_ANIMATION) do_stuff( ); } }
permissions stuff isn't my forte... and I haven't tested the above... but it does incorporate the "If I've already checked these permissions, just do the right stuff.. if the user is new... or I don't have permission... ask again." nature that may help... 
_____________________
* The Particle Laboratory * - One of SecondLife's Oldest Learning Resources. Free particle, control and targetting scripts. Numerous in-depth visual demonstrations, and multiple sandbox areas. - Stop by and try out Jopsy's new "Porgan 1800" an advanced steampunk styled 'particle organ' and the new particle texture store!
|
Talthybius Brevity
Headshop Proprietor
Join date: 14 Nov 2006
Posts: 76
|
03-10-2007 17:37
A valiant effort, but alas, the mystery remains. Everything plays as it should except there is no smoke from the child prim and the llOwnerSay isn't fired off either. woe is bong.
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-11-2007 07:20
if everything else is working then obviously (?) the permissions etc are working (agreed?) Have you tried sending a linked message to the prim from a seperate script just to test it ? I just put the following two scripts in a pair of linked prims and get particles Controller / Root Prim integer flag = FALSE;
default { state_entry() { flag = FALSE; }
touch_start(integer total_number) { flag = ! flag; llMessageLinked(LINK_SET,flag,"",NULL_KEY); } }
Child Prim SetParticles() { // Part-1 - APPEARANCE - Settings for how each particle LOOKS vector START_SCALE = < 0.08, 0.08, 1.0>; // < 1.0, 1.0, 0.0 > vector END_SCALE = < 0.04, 0.04, 0.5>; // < 1.0, 1.0, 0.0 > vector START_COLOR = < 0.86, 0.00, 0.0 >; // < 1.0, 1.0, 1.0 > vector END_COLOR = < 1.0, 0.65, 0.1 >; // < 1.0, 1.0, 1.0 > float START_ALPHA = 1.0; // 1.00 float END_ALPHA = 0.5; // 1.00 integer INTERP_COLOR = TRUE; // FALSE integer INTERP_SCALE = TRUE; // FALSE integer EMISSIVE = TRUE; // FALSE string TEXTURE = ""; // "" // START/END: refers to the birth and death time of each particle. // SCALE: particle height/width, from 0.04 to 4.0. (no depth) // ALPHA: sets transparency, from invis = 0.0 to opaque = 1.0 // START_ALPHA is ignored if it is less than END_ALPHA // COLOR: vectors <Red,Green,Blue>, each 0.00 to 1.00 // INTERP_COLOR: enables/disables END_COLOR and END_ALPHA // INTERP_SCALE: enables/disables END_SCALE // EMISSIVE: enables/diables particle 'glow' // TEXTURE: name of a texture in the emitter-prim's inventory // or the asset id key of any texture // Part-2 - FLOW - These settings affect how Many, how Quickly, // and for how Long particles are present float AGE = 1.00; // 10.00 float RATE = 0.0; // 0.10 integer COUNT = 2; // 1 float LIFE = 0.0; // 0.0 // AGE: How many seconds each particle lives, 0.1 to 60 // RATE: Seconds between particle bursts, 0.0 to 60 // COUNT: Number of particles per burst, 1 to 4096 // LIFE Number of seconds to wait before shutting off 0.1 to 60 // 0.0 never stops // Part-3 - 3 PLACEMENT -- Where are new particles created, and what // direction are they facing? integer PATTERN = PSYS_SRC_PATTERN_DROP; // PSYS_SRC_PATTERN_DROP float RADIUS = 0.00; // 0.00 float ANGLE_BEGIN = 0.10; // 0.00 float ANGLE_END = 0.10; // 0.00 vector OMEGA = < 0.00, 0.00, 0.00 >; // < 0.00, 0.00, 0.00 > //float INNERANGLE = 0.00; // 0.00 //float OUTERANGLE = 0.00; // 0.00 // PATTERN: must be set to one of the following: // PSYS_SRC_PATTERN_EXPLODE sends particles in all directions // PSYS_SRC_PATTERN_DROP ignores minSpeed and maxSpeed. // PSYS_SRC_PATTERN_ANGLE_CONE use ANGLE settings to make rings/cones // PSYS_SRC_PATTERN_ANGLE use innerangle/outerangle to make flat // wedges // RADIUS: distance between emitter and each new particle, 0.0 to 64? // ANGLE_BEGIN: for both ANGLE patterns, 0 to PI(3.14159) // ANGLE_END: for both for ANGLE patterns, 0 to PI. // OMEGA: How much to rotate the emitter around the <X,Y,Z> axises // after each burst. Set OMEGA to all 0's to reset/disable it. // INNER/OUTER ANGLE: Depreciated. Old versions of ANGLE_BEGIN/_END. // Can still be used to make lop-sided angle displays though.
// Part-4 - MOVEMENT - How do the particles move once they're created? integer FOLLOW_SRC = FALSE; // FALSE integer FOLLOW_VELOCITY = TRUE; // FALSE integer WIND = FALSE; // FALSE integer BOUNCE = TRUE; // FALSE float SPEED_MIN = 0.00; // 1.00 float SPEED_MAX = 0.00; // 1.00 vector ACCEL = < 0.00, 0.00, 0.20 >; // < 0.00, 0.00, 0.00 > integer TARGET_POS = FALSE; // FALSE key TARGET = llGetKey(); // llGetKey(); // FOLLOW_SRC: moves particles when emitter moves. It will disable RADIUS! // FOLLOW_VELOCITY: Particles rotate towards their heading // WIND: Sim's Wind will push particles // BOUNCE: Make particles bounce above the Z altitude of emitter // SPEED_MIN: 0.01 to ?, slowest speed of new particles, 1.0(*) // SPEED_MAX: 0.01 to ?, fastest speed of new particle, 1.0(*) // SPEED_ is ignored for the DROP pattern. // ACCEL: a continuous force pushed on particles, // use SMALL settings for long lived particles // TARGET_POS: If FALSE(*), TARGET value is ignored. // TARGET: Select a target for particles to arrive at when they die // key TARGET = llGetKey(); // particles return to the emitter // key TARGET = llGetOwner(); // particles home in on owner // You can have another object llSay(999,llGetKey); // and grab the key with this object by using the listen() // event handler. list particle_parameters = [ PSYS_PART_FLAGS, ( ( EMISSIVE * PSYS_PART_EMISSIVE_MASK ) | ( BOUNCE * PSYS_PART_BOUNCE_MASK ) | ( INTERP_COLOR * PSYS_PART_INTERP_COLOR_MASK ) | ( INTERP_SCALE * PSYS_PART_INTERP_SCALE_MASK ) | ( WIND * PSYS_PART_WIND_MASK ) | ( FOLLOW_SRC * PSYS_PART_FOLLOW_SRC_MASK ) | ( FOLLOW_VELOCITY * PSYS_PART_FOLLOW_VELOCITY_MASK ) | ( TARGET_POS * PSYS_PART_TARGET_POS_MASK ) ), PSYS_PART_START_COLOR, START_COLOR, PSYS_PART_END_COLOR, END_COLOR, PSYS_PART_START_ALPHA, START_ALPHA, PSYS_PART_END_ALPHA, END_ALPHA, PSYS_PART_START_SCALE, START_SCALE, PSYS_PART_END_SCALE, END_SCALE, PSYS_SRC_PATTERN, PATTERN, PSYS_SRC_BURST_PART_COUNT, COUNT, PSYS_SRC_BURST_RATE, RATE, PSYS_PART_MAX_AGE, AGE, PSYS_SRC_ACCEL, ACCEL, PSYS_SRC_BURST_RADIUS, RADIUS, PSYS_SRC_BURST_SPEED_MIN, SPEED_MIN, PSYS_SRC_BURST_SPEED_MAX, SPEED_MAX, PSYS_SRC_TARGET_KEY, TARGET, PSYS_SRC_ANGLE_BEGIN, ANGLE_BEGIN, PSYS_SRC_ANGLE_END, ANGLE_END, //PSYS_SRC_INNERANGLE, INNERANGLE, //PSYS_SRC_OUTERANGLE, OUTERANGLE, PSYS_SRC_OMEGA, OMEGA, PSYS_SRC_MAX_AGE, LIFE, PSYS_SRC_TEXTURE, TEXTURE ]; llParticleSystem( particle_parameters ); }
CancelParticles() { llParticleSystem( [ PSYS_SRC_BURST_PART_COUNT, 0 ] ); llParticleSystem( [ ] ); }
default { on_rez(integer num) { llResetScript(); } state_entry() { CancelParticles(); } link_message(integer sender_num, integer num, string str, key id) { if(TRUE == num) SetParticles(); else if(FALSE == num) CancelParticles(); }
}
|
Talthybius Brevity
Headshop Proprietor
Join date: 14 Nov 2006
Posts: 76
|
03-24-2007 14:18
Thanks Newg. For some reason i didn't get an email notification about your last post even though I'm still subscribed. But I needed a break from it anyway, was driving me nuts (or was that the steering wheel in my pants?)
Anyway, I built two raw cube prims, named one "root" and dropped everything (script posted above, animations etc) from the bong's root prim into that cube. i named the other cube child and dropped the particle script from the bong's exhale prim into it. It works perfectly.
So perhaps i'm making incorrect assumptions about linking order?
Isn't root the last prim shift-clicked before linking? Isn't 'child' any of the other prims in the object, regardless of order selected?
Once linked, is it enough to simply use 'edit linked parts' when editing the scripts thereafter or do they have to be delinked while editing and then relinked?
Going back to try unlink/relink etc...
|
Talthybius Brevity
Headshop Proprietor
Join date: 14 Nov 2006
Posts: 76
|
03-24-2007 15:14
well one or both of two things worked.  i noticed prims in the bong all had a group applied so i unlinked, went through and set them all to group 'none.' then i deleted the contents of the root prim and the child prim. then i dragged the contents from the inventory back to the prims. then i relinked with the exhale child prim being the next to last selected and the root being the last selected. took a hit and it worked. then my client crashed and i got the 'being logged out, you can log in again in [10 mins from now]. oy. thanks guys!
|
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
|
03-24-2007 15:19
Yup... last selected is the parent. (If the last selected is already a linked object then the parent of that set is the over-all parent of the new set, at least in my experience.) Linking/relinking *shouldn't* matter.... though with VWR-126 in jira (the particle shut-off bug on child prims) I recently found cases (on the beta grid, not the main grid) where linking in an unscripted object and then adding a script to it could result in a different behavior than just linking in an already scripted prim. Anyway, when in doubt, go back to the basics, create new prims instead of copying existing prims... cut'n'paste code into new scripts, link the whole new object fresh from scratch. If you get the same behavior then you can be sure it's not some residual prim properties that are causing you grief at least. If your smoke isn't appearing, I would almost think you might have another script in the prim that could be responding to the link message... which is shutting off or setting an invisible particle display on the prim that's stomping on the effect you're trying to make visible. I've tried your particle effect by itself and saw smoke... so at least that part works!  Again... Good luck... by the time you get this functional you'll definitely be in need of putting it to use. 
_____________________
* The Particle Laboratory * - One of SecondLife's Oldest Learning Resources. Free particle, control and targetting scripts. Numerous in-depth visual demonstrations, and multiple sandbox areas. - Stop by and try out Jopsy's new "Porgan 1800" an advanced steampunk styled 'particle organ' and the new particle texture store!
|
Talthybius Brevity
Headshop Proprietor
Join date: 14 Nov 2006
Posts: 76
|
03-25-2007 00:08
From: Jopsy Pendragon Again... Good luck... by the time you get this functional you'll definitely be in need of putting it to use.   Well i've got the smoke flowing and the placement nailed down at last. The only trouble I'm having is that my smoke always blows northward, regardless of which way the AV (and therefore the smoke prim) are facing. wind = false. In the previous version in which i was rezzing the exhale prim i solved the directional thing like this: rotation x_60 = llEuler2Rot( <60 * DEG_TO_RAD, 90 * DEG_TO_RAD, 90 * DEG_TO_RAD> ); rotation new_rot = x_60 * llGetRot(); // compute local rotation llRezObject("ExhalePrim", llGetPos() + <0.02, 0.12, 0.95>, ZERO_VECTOR, new_rot, 42); // orient the object accordingly The exhale prim is a tiny invisible pyramid tilted on its x axis. How do i make the smoke always travel in the direction the tip of the pyramid is pointing? is there a way to do it without setting a target for it? I keep thinking that the answer is in this chunk, but with my various tweakages so far i find not the joy i seek: integer FOLLOW_SRC = FALSE; // FALSE integer FOLLOW_VELOCITY = FALSE; // FALSE integer WIND = FALSE; // FALSE integer BOUNCE = TRUE; // FALSE float SPEED_MIN = 0.30; // 1.00 float SPEED_MAX = 0.90; // 1.00 vector ACCEL = < 1.25, 4.00, -0.50 >; // < 0.00, 0.00, 0.00 > integer TARGET_POS = FALSE; // FALSE
|
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
|
03-25-2007 12:15
change pattern from DROP to ANGLE_CONE set ACCEL to <0.0,0.0,0.0> Rotate prim so that it's "top" points in the direction you want the particles to blow... Adjust MIN_SPEED and MAX_SPEED to taste. your ANGLE_BEGIN and ANGLE_END look to be fine as they are. ACCEL always pushes particles according to global directions, not relative to the prim or avatar directions. So <0,-1,0> is always "north" like <0,0,-1> is always "down"... Up/down may still be desirable... say <0,0,.01> for a slightly smokey "upward drift", but you don't want to push it along the X or Y axis. Hope that helps! 
_____________________
* The Particle Laboratory * - One of SecondLife's Oldest Learning Resources. Free particle, control and targetting scripts. Numerous in-depth visual demonstrations, and multiple sandbox areas. - Stop by and try out Jopsy's new "Porgan 1800" an advanced steampunk styled 'particle organ' and the new particle texture store!
|