|
Cherry Hainsworth
Registered User
Join date: 31 Jul 2006
Posts: 125
|
06-11-2007 14:03
I know this is a dozy question - I apologise! Something about particle scripts makes me go all weak in the head  I have three linked emitters, each with Ama Omega/Jopsy's touch-start script inside. Originally I wanted to make a controller that gave the owner a choice of which emitter (or combination) to turn on. I got hopelessly bogged down with that, so decided to settle for a controller that turns them all on/off. I can't do it! I tried using llMessageLinked with a "touched" variable to trigger the particle systems but nothing happened. If that's the right idea, where should I be putting "touched" in the particle script? Or could I use llPassTouches (How?)? Even more confusing is the question of how to realise my original thought. I can get all four scripts to listen to each other, but - well, I've only used link messages for texture-changing and such; I don't know where to start handing out instructions to differing objects. Please help. My uselessness at linking has been holding me back for ages - I've invested the whole day in trying to crack it this time. And I'm stumped! Thanks Cherry.
|
|
Mimo Vacano
Registered User
Join date: 27 Dec 2006
Posts: 54
|
06-11-2007 17:44
Not certain this is exactly what you're looking for, but I've done something very similar I think. I have "art works" that are touch on/off. When touched, there are two invisible balls that emit particles and move according to some trigonometric formulae to place the particles in geometric patterns (kinda like the old spirograph). If anyone is interested, these can be seen in my shop at Puzo 181,27,44.
I've accomplished the communication through linked messages. The two particle balls are 'child' prims and I've modified the particle script to add a link_message event. If the message is to turn them off then I simply call llParticleSystem([]) - otherwise I call updateParticles() which is the particle generation routine in the Ama Omega Script. Here's the simple routine:
link_message(integer sender_num, integer num, string str, key id) { if ((float)str == 0.0) llParticleSystem([]); else updateParticles(); }
For me, passing 0 means, turn the particles off.
The 'root' prim (in my case, a black background to draw on) contains the controller. It's important to understand for those unfamiliar with linking that the 'root' prim is the last one clicked before linking them all together. The meat is simply to keep track of whether I'm currently on or off and send the appropriate message to the child prims...
touch_start(integer total_number) { if (onoff==0) { llMessageLinked(LINK_ALL_CHILDREN,0,"0.02",llGetKey()); onoff=1; } else { llMessageLinked(LINK_ALL_CHILDREN,0,"0.00",llGetKey()); onoff=0; } }
Hope this helps,
Mimo.
|
|
Cherry Hainsworth
Registered User
Join date: 31 Jul 2006
Posts: 125
|
06-12-2007 11:04
Crikey, talk about not seeing the wood for the trees! Thanks, Mimo - that was a massive help  When I've got the contoller properly sorted out I'll post back here. I think I'm not the only one to suffer this particular confusion! Your particle artworks are beautiful. I bought one. Could you use the same algorhythm to make them in real-world LCDs? They knock the socks off a lava lamp! Cheers, Cherry.
|
|
Mimo Vacano
Registered User
Join date: 27 Dec 2006
Posts: 54
|
06-12-2007 15:37
So glad it helped. And thanks for the purchase and kind words about my artwork!
|
|
Cherry Hainsworth
Registered User
Join date: 31 Jul 2006
Posts: 125
|
dialog-controlled particle set
06-18-2007 04:52
OK, I dunnit  I trust somebody will tell me how it can be better done, but this works .... The controller .... touch_start( integer num ) { if ( llDetectedKey(0) == llGetOwner() ) { lkey = llListen( 8192, "", llGetOwner(), "" ); llSetTimerEvent(60); llDialog( llDetectedKey(0), "My Particle Switcher :", [ "All Particles", "Parts 1 & 2", "None", "Part 1", "Part 2", "Part 3" ], 8192 ); } llSay (0, llDetectedName (0)); } timer() { llListenRemove( lkey ); llSetTimerEvent( 0 ); } listen ( integer channel, string name, key id, string message ) { llListenRemove( lkey ); llMessageLinked( LINK_SET, 0 , message , NULL_KEY ); }
}
Each emitter ..... default { // this is the instruction for the "Part 1" emitter link_message(integer sender_num, integer num, string str, key id) { if (str == "Part 1") updateParticles(); else if (str == "Parts 1 & 2") updateParticles(); else if (str == "All Parts") updateParticles(); else llParticleSystem([]); }
}
Suitable for a collection of emitters, using 1 texture each. For varied particles from just one emitter, use a texture-switching script like this one: http://rpgstats.com/wiki/index.php?title=ExampleParticleScript1Cherry
|