Jeweliette Darkfold Posted May 13, 2016 Share Posted May 13, 2016 I'm not a scripter at all, but I'm working on a project and I've used a particle generator to create particles the way I want them. However it has no on/off on touch. I would love, and really appreciate help in turning this script into a touch on/off particle script. Thank you in advance. The script is inside the root prim (which is fully transparent) but it is inside another prim, I don't know if this imprtant to know (as you can't touch the actual prim housing the script) so I'm mentioning it in case it is important. Anyway here's the script.Thank you :)~Jewel default{state_entry(){llLinkParticleSystem(LINK_THIS,[PSYS_PART_FLAGS,PSYS_PART_BOUNCE_MASK,PSYS_PART_START_COLOR,<.47451,.70588,.78431>,PSYS_PART_START_ALPHA,.0,PSYS_PART_END_COLOR,<.47451,.70588,.78431>,PSYS_PART_END_ALPHA,.0,PSYS_PART_START_SCALE,<.03125,.03125,.03125>,PSYS_PART_END_SCALE,<.03125,.03125,.03125>,PSYS_PART_MAX_AGE,4.5,PSYS_SRC_PATTERN,PSYS_SRC_PATTERN_EXPLODE,PSYS_SRC_TEXTURE,(key)"9e0385e4-934e-6bc1-6adf-ed5354849d7a",PSYS_SRC_BURST_RATE,.15,PSYS_SRC_BURST_PART_COUNT,2,PSYS_SRC_BURST_RADIUS,.055,PSYS_SRC_BURST_SPEED_MIN,.007,PSYS_SRC_BURST_SPEED_MAX,.009,PSYS_PART_BLEND_FUNC_SOURCE,PSYS_PART_BF_ONE,PSYS_PART_BLEND_FUNC_DEST,PSYS_PART_BF_ONE,PSYS_PART_END_GLOW,.02]);}} Link to comment Share on other sites More sharing options...
sndbad Ghost Posted May 13, 2016 Share Posted May 13, 2016 // touch to toggle particle on/off integer isOn = 1; startParticle() { llParticleSystem ( [ // PUT YOUR PARTICLE PARAMETERS HERE ] ); } default { state_entry() { startParticle(); isOn = 1; } touch_start(integer num_detected) { if (isOn == 1) { llParticleSystem([]); isOn = 0; } else { startParticle(); isOn = 1; } } } 2 Link to comment Share on other sites More sharing options...
Jeweliette Darkfold Posted May 13, 2016 Author Share Posted May 13, 2016 Thank You SO much! It works perfectly You made my day. I spent 3 hours trying to fiddle with other particle scripts, trying to piece things together, and wanted to pull out my hair. I truly appreciate your help! *hugs* ~Jewel Link to comment Share on other sites More sharing options...
LAHIN Milo Posted September 8, 2018 Share Posted September 8, 2018 Hello, scripters ! Like Jewel, i have a particle script and i'd like to add a touch on/off , i've been trying what sndbad Ghost said , but i've a syntax error (44.0). Im not a scripter at all ... if someone could help me by correcting the error it would help me alot ! This is the script : // touch to toggle particle on/off integer isOn = 1; startParticle() { llParticleSystem ( [ PSYS_PART_FLAGS,( 0 |PSYS_PART_WIND_MASK |PSYS_PART_FOLLOW_VELOCITY_MASK ), PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE , PSYS_PART_START_ALPHA,1, PSYS_PART_END_ALPHA,1, PSYS_PART_START_COLOR,<1,1,1> , PSYS_PART_END_COLOR,<1,1,1> , PSYS_PART_START_SCALE,<4,4,0>, PSYS_PART_END_SCALE,<4,4,0>, PSYS_PART_MAX_AGE,5, PSYS_SRC_MAX_AGE,0, PSYS_SRC_ACCEL,<0,0,-5>, PSYS_SRC_BURST_PART_COUNT,2, PSYS_SRC_BURST_RADIUS,15, PSYS_SRC_BURST_RATE,0.01, PSYS_SRC_BURST_SPEED_MIN,0, PSYS_SRC_BURST_SPEED_MAX,0, PSYS_SRC_ANGLE_BEGIN,1, PSYS_SRC_ANGLE_END,1, PSYS_SRC_OMEGA,<0,0,0>, PSYS_SRC_TEXTURE, (key)"6918812d-8e7f-b347-4732-456e7918624b", PSYS_SRC_TARGET_KEY, (key)"00000000-0000-0000-0000-000000000000" ]); } } ] ); } default { state_entry() { startParticle(); isOn = 1; } touch_start(integer num_detected) { if (isOn == 1) { llParticleSystem([]); isOn = 0; } else { startParticle(); isOn = 1; } } } Link to comment Share on other sites More sharing options...
Xiija Posted September 8, 2018 Share Posted September 8, 2018 Try formatting your code mebbe?.. it helps you see errors more clearly. an online site that may work is ... http://jsbeautifier.org/ // touch to toggle particle on/off integer isOn = 1; startParticle() { llParticleSystem ([ PSYS_PART_FLAGS, (0 | PSYS_PART_WIND_MASK | PSYS_PART_FOLLOW_VELOCITY_MASK), PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE, PSYS_PART_START_ALPHA, 1, PSYS_PART_END_ALPHA, 1, PSYS_PART_START_COLOR, < 1, 1, 1 > , PSYS_PART_END_COLOR, < 1, 1, 1 > , PSYS_PART_START_SCALE, < 4, 4, 0 > , PSYS_PART_END_SCALE, < 4, 4, 0 > , PSYS_PART_MAX_AGE, 5, PSYS_SRC_MAX_AGE, 0, PSYS_SRC_ACCEL, < 0, 0, -5 > , PSYS_SRC_BURST_PART_COUNT, 2, PSYS_SRC_BURST_RADIUS, 15, PSYS_SRC_BURST_RATE, 0.01, PSYS_SRC_BURST_SPEED_MIN, 0, PSYS_SRC_BURST_SPEED_MAX, 0, PSYS_SRC_ANGLE_BEGIN, 1, PSYS_SRC_ANGLE_END, 1, PSYS_SRC_OMEGA, < 0, 0, 0 > , PSYS_SRC_TEXTURE, (key) "6918812d-8e7f-b347-4732-456e7918624b", PSYS_SRC_TARGET_KEY, (key) "00000000-0000-0000-0000-000000000000" ]); } default { state_entry() { startParticle(); isOn = 1; } touch_start(integer num_detected) { if (isOn == 1) { llParticleSystem([]); isOn = 0; } else { startParticle(); isOn = 1; } } } 1 Link to comment Share on other sites More sharing options...
LAHIN Milo Posted September 8, 2018 Share Posted September 8, 2018 Thank you very much for your reply Xiija ! 1 Link to comment Share on other sites More sharing options...
Rachel1206 Posted September 8, 2018 Share Posted September 8, 2018 Ohh Xiija beated me... anyway, always be sure the curly braces are pairwise. Further no need for state changes, just handle the simple rain on/off in the touch event. integer bRain= TRUE; Particles( integer bState ) { if (bState) { llParticleSystem( [ PSYS_PART_FLAGS,( PSYS_PART_WIND_MASK| PSYS_PART_FOLLOW_VELOCITY_MASK ), PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE, PSYS_PART_START_ALPHA, 1, PSYS_PART_END_ALPHA, 1, PSYS_PART_START_COLOR, <1,1,1> , PSYS_PART_END_COLOR, <1,1,1> , PSYS_PART_START_SCALE, <4,4,0>, PSYS_PART_END_SCALE, <4,4,0>, PSYS_PART_MAX_AGE, 5, PSYS_SRC_MAX_AGE, 0, PSYS_SRC_ACCEL, <0,0,-5>, PSYS_SRC_BURST_PART_COUNT, 2, PSYS_SRC_BURST_RADIUS, 15, PSYS_SRC_BURST_RATE, 0.01, PSYS_SRC_BURST_SPEED_MIN, 0, PSYS_SRC_BURST_SPEED_MAX, 0, PSYS_SRC_ANGLE_BEGIN, 1, PSYS_SRC_ANGLE_END, 1, PSYS_SRC_OMEGA, <0,0,0>, PSYS_SRC_TEXTURE, "6918812d-8e7f-b347-4732-456e7918624b" ] ); } else llParticleSystem([]); } default { state_entry() { bRain= TRUE; Particles( bRain); } touch_start(integer num_detected) { // toggle the boolean FALSE/TRUE bRain= !bRain; Particles( bRain ); } } 1 Link to comment Share on other sites More sharing options...
Myrmidon Hasp Posted September 8, 2018 Share Posted September 8, 2018 Just to clarify the specific error; there's a block of bracket and brace garbage between the end of your startParticle() function and the default state. ]); } } ] ) ; } should be: ]); } 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now