Particles`
|
thecoolguy Melody
Registered User
Join date: 15 Jan 2009
Posts: 16
|
09-02-2009 19:55
Hi I am new into the world of SL.
How to write the script to emit particles in a striaght line from one prim to other only if the user touches the prim.
I wrote the code for emiting the particles but it emits continously and doesnt stop. i want the object to emit particles to another oobject in a straight line only when it is clicked.
Its very urgent.
Thanx
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
09-02-2009 20:05
To stop, use llParticleSystem([]);
To learn how to handle particles VERY well, visit the Particle Laboratory. You'll find loads of tutorial exercises and a reasonably large collection of sample script modules for making a range of particle effects.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|
thecoolguy Melody
Registered User
Join date: 15 Jan 2009
Posts: 16
|
09-03-2009 07:31
I referred to the particles lab and was able to emit particles in a straight line but it emits continously . I need the object to emit particles only when it is clicked. I wrote the code inside the touch_start(integer num_detected) but it emits the particles as soon as I save it not when I click the object.
Please give me some advice on how to emit particles only when the object is clicked.
Thanx in advance.
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
09-03-2009 07:44
I think if you return to the particle lab and take a look at the "control templates," as I think they are called, you'll find ones to help you turn the particle system on when you touch it. In brief, I would start the particle system in the touch_start event and either use the flag, PSYS_SRC_MAX_AGE ( see, though http://wiki.secondlife.com/wiki/LlParticleSystem -- this one is a bit tricky and doesn't behave quite the way you -- well, I, anyway -- expect it to all the time). Or, which will probably give you more predictable results, include in your main code something like this snippet touch_start(integer n){ llSetTimerEvent(30.0); // how long you want the particles to fire for llParticleSytem(my_particle_definition); }
timer(){ llParticleSystem([]); //switches off the particles llSetTimerEvent(); //turns off the timer }
|
thecoolguy Melody
Registered User
Join date: 15 Jan 2009
Posts: 16
|
09-03-2009 08:58
Thanx a lot. That snippet really worked for me. Also, how to get the key of the target prim.
In emitting the particles in a straight line from one prim to other we need to give the key of the target prim. How can we get the key of the target prim so as to set the key value in the source prim code?
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
09-03-2009 10:30
From: thecoolguy Melody Thanx a lot. That snippet really worked for me. Also, how to get the key of the target prim.
In emitting the particles in a straight line from one prim to other we need to give the key of the target prim. How can we get the key of the target prim so as to set the key value in the source prim code? One way to do it would be to define a function like this: string target_name = "target"; // name of the prim for which you want to get the key key my_target; find_link(string name){ integer p = llGetNumberOfPrims(); integer i; for (i=p; i>0;--i){ // loop through the linkset looking for a prim called "target" if (llGetLinkName(i)==name){ // when you find it my_target = llGetLinkKey(i); //record its key } } } Then just put find_link(target_name); in the state_entry, on_rez, and changed events -- so that you can sure to update the value of my_target whenever it's in danger of changing -- and tell your emitter to direct the particle stream at my_target.
|
thecoolguy Melody
Registered User
Join date: 15 Jan 2009
Posts: 16
|
Zig-zag manner
09-04-2009 11:29
Can anyone know how to send particles from point A to point B in a zig-zag manner(I mean not in a linear manner it should make some turns to reach the point B)
|
Vance Adder
Registered User
Join date: 29 Jan 2009
Posts: 402
|
09-04-2009 12:11
From: thecoolguy Melody Can anyone know how to send particles from point A to point B in a zig-zag manner(I mean not in a linear manner it should make some turns to reach the point B) Maybe do something like rez an invisible prim that travels from point A to point B, give it a particle "Trail" and have *it* do your zig-zagging.
|
thecoolguy Melody
Registered User
Join date: 15 Jan 2009
Posts: 16
|
09-09-2009 14:01
I am finding it difficult to send particles from point A to point B. Unable to get the corrt key of the target prim. llGetInventroyKey(name)(key of the target prim) is the function I used to send the particles to the target prim. But the particles are not flowing fro source to destination.
Can anyone tell me is it the right function to use. Please throw some light on it .
Thanx in advance.
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
09-09-2009 14:38
When you rez an object into the world it is a completely new object, with a new key.
If you're rezzing the object from the prim that contains the particle script, look at the "object_rez" event. It will be called with the (new) key of the object once it has rezzed in-world.
|
thecoolguy Melody
Registered User
Join date: 15 Jan 2009
Posts: 16
|
partciles
09-28-2009 13:18
How to send the particles from 1 object to another object through a third object. For example. If I want to send particles from object A to object B. How can send the particles fro A to B through C. The particle must go from A to C and then from C to B. I able to send th aprticles from A to c but not from C to B. How to change the source of the particle (i.e from A to C A is the source and from C to B C is the source i wanna know how to change the source in the script so that it send the particles from C to B.)
Thanx
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
09-28-2009 13:23
You have to have two particle systems configured to operate in sync. You can see an example of this at the Rocket City sim.
|
thecoolguy Melody
Registered User
Join date: 15 Jan 2009
Posts: 16
|
09-30-2009 14:21
Hey an u tell me how to sync two particle emiiters I am new in second life so dont hav much background abt this one If u can tell how to do it it will be very helpful. I needed it urgently . Thanx
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
09-30-2009 14:29
The guy who did the fountains in Rocket City is, I believe, Bunny Halberd. I think he did it by twiddling the timing by hand.
|
thecoolguy Melody
Registered User
Join date: 15 Jan 2009
Posts: 16
|
09-30-2009 21:00
How can we get the key of an object when it is rezzed in world so that we can get the targetkey to send the particles from a source to this object. ( to get the targey key so that we can use to send particles to it with llParticleSystem).
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
09-30-2009 21:55
Ask it. (Seems like I just had this conversation in another thread in this same forum this week.  ) In the target prim... default { on_rez(integer hello) { llRegionSay(99,"","",(string)llGetKey()); } }
The script for the object that's listening looks like this.... key targetKey; default { state_entry() { llListen(99,"","",""); }
listen(integer channel, string name, key id, string message) { if(llStringLength(message) == 36) { targetKey = (key)message; // Then use the targetKey any way you like..... } }
}
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
10-01-2009 08:32
Or look for it.. key my_target; string NAME_OF_TARGET = "My Target"; float SCAN_DISTANCE = 25.0; // how far to scan integer NUMBER_OF_RETRIES = 10; // how many times to try before we give up float RETRY_INTERVAL = 5.0; //how often to try -- every 5 seconds
default { on_rez(integer n) { llResetScript(); } attach(key id) { llResetScript(); }
state_entry() { llSleep(1.0); llSensorRepeat( NAME_OF_TARGET, "", PASSIVE | ACTIVE ,SCAN_DISTANCE, TWO_PI, RETRY_INTERVAL );//active or passive object llSetTimerEvent( NUMBER_OF_RETRIES * RETRY_INTERVAL ); }
touch_start(integer n) { llSensorRepeat( NAME_OF_TARGET, "", PASSIVE | ACTIVE , SCAN_DISTANCE, TWO_PI, RETRY_INTERVAL ); llSetTimerEvent( NUMBER_OF_RETRIES * RETRY_INTERVAL ); } sensor(integer number_of_matches) {// found it! my_target = llDetectedKey(0); // if there's more than one thing called, "My Target," we'll use the first one we find llSensorRemove(); llSetTimerEvent(0.0); //do particle stuff using my_target as your target } timer() { // time to give up. llSensorRemove(); llSetTimerEvent(0.0); llOwnerSay("can't find anything called "+NAME_OF_TARGET+" in "+(string)SCAN_DISTANCE); }
}
This is based on one of the many free sample scripts you can find at The Particle Lab, http://slurl.com/secondlife/Teal/180/74/21, where the OP would find so many useful scripts, interactive displays and examples.
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
10-01-2009 09:25
The trick to synchronizing particle systems with multiple objects is to have the first object send a message to the second object when it emits its particles, and have the second object start its emitters JUST as the particles from the first object reaches it.
Which is why timing is crucial.
|
thecoolguy Melody
Registered User
Join date: 15 Jan 2009
Posts: 16
|
10-01-2009 13:53
How to invoke a script from another script?Like if if there r two objects A and B I want to invoke script o B from the Script of A
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
10-01-2009 13:58
If they're in the same object you can use link messages, otherwise you have to use chat. http://wiki.secondlife.com/wiki/Message_linkedhttp://wiki.secondlife.com/wiki/LlSay
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
10-01-2009 13:59
What do you mean "invoke?" If you mean, "communicate," we showed you a couple of ways. If you can communicate, then you can have one script tell the other one what to do. Did you have something specific in mind?
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|