Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

a simple question

Tristesse Fair
Registered User
Join date: 19 Jun 2008
Posts: 4
10-12-2008 19:52
I am trying to make a particle link between two objects. Something like a chain to hang a chandelier that would be a chain from the support on the ceiling to the actual chandelier but not actual prims. Ive found the leash scripts and sadly that isnt quite what I need though a prim following me around the sim was kinda funny I admit. Ive looked at the scripting tips and just find myself baffled at the moment. Ive tried to IM several people who sell items with such scripting but havent gotten any replies yet. Any suggestions? All help appreciated
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
10-12-2008 20:51
The leash scripts probably use the UUID (key) of an avatar or attachment for the particle target. You'll want to use the key of an in-world prim instead (part of your chandelier). The llGetKey() function gives you the key of the prim the script is in. The llGetLinkKey() function gives you the key of a prim in the same link set as the prim the script is in. The 'listen' event handler gets the key of the speaker (avatar or object) for any chat message it receives, and the llDetectedKey() function gives you the key of any avatar or object detected (that'd be the key of a root prim). Hope that helps.

http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetKey
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetLinkKey
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llDetectedKey
http://www.lslwiki.net/lslwiki/wakka.php?wakka=listen
Tristesse Fair
Registered User
Join date: 19 Jun 2008
Posts: 4
10-12-2008 21:54
ok..i followed your links but im not that great a scripter ive got a idea of one but im still fuzzy on a lot of the functions of scripting ive gone through a helper course and still am seeing greek at the moment
Ravanne Sullivan
Pole Dancer Extraordinair
Join date: 10 Dec 2005
Posts: 674
10-12-2008 22:46
Check out the Particle Lab inworld. You should see some examples there that are what you are looking for.
_____________________
Ravanne's Dance Poles and Animations

Available at my Superstore and Showroom on Insula de Somni
http://slurl.com/secondlife/Insula de Somni/94/194/27/
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
10-12-2008 23:13
The idea is that you want to identify the place the particles should be heading for. You can only do that by telling them to aim at an avatar or a prim. You need the "key" of the avatar/prim you want the particles to aim at. That is the value you give for the PSYS_SRC_TARGET_KEY parameter to llParticleSystem() when you also give it the PSYS_PART_TARGET_POS_MASK flag. If you examine your leash scripts again you should see those being used somewhere. Instead of the dom or one of the dom's attachments, you are going to want to point the particles at a prim in your chandelier.

Complicating this is the fact that, any time a new instance of an object is rezzed, all of its prims get new keys, so you can't usually just get a fixed key and use it in your script. Instead you have to do something like grab the key of the Nth prim in the object just after the object is rezzed, and restart your llParticleSystem() with that target.

I hope that helps a bit. If you understand that, and get the rest from the Particle Lab as mentioned above, you should be a good deal of the way toward understanding how to build your project.
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
10-13-2008 00:52
I second the suggestion to go over to The Particle Lab. Besides being a very interesting place to visit, with lots of hands on displays that explain -- for non-scripters -- what all the items in the intimidating lists of flags that comprise a particle script are for and how to manipulate them to achieve the effects you want, you'll find it's got a scripting section with a large range of completely free sample scripts, including ones that will both give you a chain effect to tweak and set a target for it.

If you want any help with this, please IM me and I'll happily give you a hand. My first experiment with particles, as it happens, involved chains, too. While setting the target is, once you've got hold of the scripts from The Particle Lab, pretty straightforward, you may find you want to tweak some of the visual settings in the particle definition itself -- most chain scripts are for chains with a bit of slack in them rather than for something running straight down and appearing to support a heavy weight.

You probably realise this, but I mention it anyway because I didn't, at first -- the particle chain is just a visual effect; the functions that actually constrain my movement when my Master has me chained to something are completely different from the ones that generate the chain.
Tristesse Fair
Registered User
Join date: 19 Jun 2008
Posts: 4
10-13-2008 01:57
i went to the lab and looked around and ive gone through the whole thing but im still missing some key things...like how do i get a key for the object i want to link to or the ID number of the prim?

this is what i have so far: its a template thanks to the Particle Laboratory

//// "Chain" PARTICLE TEMPLATE v1 -- by Jopsy Pendragon - 4/8/2008
//// You are free to use this script as you please, so long as you include this line:
//** The original 'free' version of this script came from THE PARTICLE LABORATORY. **//

// SETUP: Drop one optional particle texture and this script into a prim.
// Particles should start automatically. (Reset) the script if you insert a
// particle texture later on. Add one or more CONTROLLER TEMPLATES to any
// prims in the linked object to control when particles turn ON and OFF.
// Use in conjunction with TARGET TEMPLATES to link the chain somewhere else.

// Customize the particle_parameter values below to create your unique
// particle effect and click SAVE. Values are explained along with their
// min/max and default values further down in this script.


string CONTROLLER_ID = "A"; // See comments at end regarding CONTROLLERS.
integer AUTO_START = TRUE; // Optionally FALSE only if using CONTROLLERS.

list particle_parameters=[]; // stores your custom particle effect, defined below.
list target_parameters=[]; // remembers targets found using TARGET TEMPLATE scripts.

default {
state_entry() {
particle_parameters = [ // start of particle settings
// Texture Parameters:
PSYS_SRC_TEXTURE, llGetInventoryName(INVENTORY_TEXTURE, 0),
PSYS_PART_START_SCALE, <0.1, 0.1, FALSE>, PSYS_PART_END_SCALE, <0.1, 0.1, FALSE>,
PSYS_PART_START_COLOR, <1.00,1.00,1.00>, PSYS_PART_END_COLOR, <1.00,1.00,1.00>,
PSYS_PART_START_ALPHA, (float) 1.0, PSYS_PART_END_ALPHA, (float) 1.0,

// Production Parameters:
PSYS_SRC_BURST_PART_COUNT, (integer) 2,
PSYS_SRC_BURST_RATE, (float) 0.01,
PSYS_PART_MAX_AGE, (float) 10.0,
// PSYS_SRC_MAX_AGE, (float) 0.00,

// Placement Parameters:
PSYS_SRC_PATTERN, (integer) 1, // 1=DROP, 2=EXPLODE, 4=ANGLE, 8=CONE,

// Placement Parameters (for any non-DROP pattern):
// PSYS_SRC_BURST_SPEED_MIN, (float) 00.0, PSYS_SRC_BURST_SPEED_MAX, (float) 00.0,
// PSYS_SRC_BURST_RADIUS, (float) 00.0,

// Placement Parameters (only for ANGLE & CONE patterns):
// PSYS_SRC_ANGLE_BEGIN, (float) 0.50 * PI, PSYS_SRC_ANGLE_END, (float) 0.50 * PI,
// PSYS_SRC_OMEGA, <00.00, 00.00, 01.00>,

// After-Effect & Influence Parameters:
PSYS_SRC_ACCEL, < 00.00, 00.00, -00.1>,
// PSYS_SRC_TARGET_KEY, (key) llGetLinkKey(llGetLinkNum() + 1),

PSYS_PART_FLAGS, (integer) ( 0 // Texture Options:
| PSYS_PART_INTERP_COLOR_MASK
| PSYS_PART_INTERP_SCALE_MASK
| PSYS_PART_EMISSIVE_MASK
| PSYS_PART_FOLLOW_VELOCITY_MASK
// After-effect & Influence Options:
| PSYS_PART_WIND_MASK
// | PSYS_PART_BOUNCE_MASK
// | PSYS_PART_FOLLOW_SRC_MASK
| PSYS_PART_TARGET_POS_MASK
// | PSYS_PART_TARGET_LINEAR_MASK
)
//end of particle settings
];

if ( AUTO_START ) llParticleSystem( particle_parameters );

}

link_message( integer sibling, integer num, string mesg, key target_key ) {
if ( mesg != CONTROLLER_ID ) { // this message isn't for me. Bail out.
return;
} else if ( num == 0 ) { // Message says to turn particles OFF:
llParticleSystem( [ ] );
} else if ( num == 1 ) { // Message says to turn particles ON:
llParticleSystem( particle_parameters + target_parameters );
} else if ( num == 2 ) { // Turn on, and remember and use the key sent us as a target:
target_parameters = [ PSYS_SRC_TARGET_KEY, target_key ];
llParticleSystem( particle_parameters + target_parameters );
} else { // bad instruction number
// do nothing.
}
}

}


//============================= About Parameters =============================
// There are 22-ish NAMED attributes that affect a particle display.
// To customize a display you give each a VALUE.
// For example: PSYS_PART_START_COLOR is a named attribute,
// and <1.0, 0.5, 0.0> is a color VALUE (orange, in this case).
//
// As long as your 'names' and 'values' are paired up properly, they can
// be in any order! Any you omit a pair, it reverts to a default value.

//============================= Texture Parameters =============================
//
// TEXTURE, can be an "Asset UUID" key copied from a texture
// that you have full permissions to, or the name of
// a texture in the prim's inventory.
//
// SCALE, (size) 0.0 to 4.0 meters wide, by 0.0 to 4.0 meters tall. (default 1x1)
// Textures are FLAT, so the 'z' part of the vector is ignored.
// Values smaller than 0.04x0.04 may not get rendered at all.
// Tiny particles vanish if the viewer is not near them.
//
// BEGIN_SCALE sets particle start size.
// END_SCALE (end size) is ignored, if the INTERP_SCALE_MASK option is disabled.
//
// COLOR, < RED, GREEN, BLUE > from <0.00,0.00,0.00> (black) to <1.00,1.00,1.00> (white/default)
// ALPHA, 1.0 = 100% visible(default), 0.0 = invisible. Less than 0.1 might not get seen.
// START_COLOR and START_ALPHA set the color and transparency of newly created particles.
// END_COLOR and END_ALPHA are ignored, if the INTERP_COLOR_MASK option is disabled.


//============================= Production Parameters =============================
//
// BURST_PART_COUNT: quantity of particles per burst, 1 to 4096 (default 1),
//
// BURST_RATE: seconds to delay between particle bursts. 0.0 to 30.0 (default 0.1)
//
// PART_MAX_AGE: particle lifespan in seconds, 0.00 to 30.0 (default=10.0)
// PART_MAX_AGE less than 0.5 might not be visible.
//
// The default total number of particles that can be seen is 4096, if one or more
// emitters try to create more than that, many will not be seen, and it may cause
// viewer lag. Use as few particles as you can for your effect:
// AGE/RATE * COUNT will tell you approximately how many particles your emitter creates.
//
// SRC_MAX_AGE: emitter auto shut-off timer. 1.0 to 60.0 seconds. 0.0 = never stop. (default)


//============================= Placement Parameters =============================
//
// PATTERN:
// DROP, ignores all other placement settings.
// EXPLODE, spray particles in all directions
// ANGLE, sprays a flat "fan" shape defined by ANGLE_BEGIN and END values
// CONE, sprays "ring" or "cone" shapes defined by ANGLE_BEGIN and END values
//
// RADIUS: 0.0 to 50.0? distance from emitter to create new particles
// (RADIUS is disabled with DROP pattern and the FOLLOW_SRC & TARGET_LINEAR options)
//
// SPEED: 0.00 to 50.0? Sets min/max starting velocities for non-drop patterns. (default: 1.0)
//
// ANGLE_BEGIN & END: 0.00*PI (up) to 1.00*PI (down), (Only for ANGLE & CONE patterns)
// (Values work much like the Sphere-prim's DIMPLE attributes.) (defaults: 0.0)
//
// OMEGA: <x,y,z> Sets how much to rotate angle/cone spray direction after
// every burst. 0.0 to PI? (default: <0,0,0>;)

//======================== After-Effects & Influence Parameters ================
//
// ACCEL, x,y,z 0.0 to 50.0? sets a constant force, (affects all patterns)
// Causes particles to drift up/down or in a compass direction.
// Use ACCEL to create the illusion of (anti-)gravity or a directional wind.
// (ineffective with TARGET_LINEAR option)
//
// TARGET_KEY, "key", (requires the TARGET option be enabled).
// "key" can be a variety of many different things:
// llGetOwner()
// llGetKey() target self
// llGetLinkKey(1) target parent prim
// llGetLinkKey(llGetLinkNum() + 1) target next prim in link set
//
// WARNING: New copies of objects get new keys, you can't simply paste
// a prim's key into your script and expect it to always work. Visit
// the Particle Laboratory's section on TARGETS for a variety of ways
// to dynamically find your target's key. There are different 'best ways'
// depending on if your target is linked to your emitter or not.


//============================= About Options =============================
//
// Each option may be ON/ENABLED (no leading // )
// or OFF/DISABLED (by putting a // in front of it.)
// Options are combined together in a special way, (using the | symbol).
// This creates one single Parameter for PSYS_PART_FLAGS.


//============================= Texture Options =============================
//
// EMISSIVE: identical to "full bright" setting on prims
//
// FOLLOW_VELOCITY: particle texture 'tilts' towards the direction it's moving
//
// INTERP_COLOR: causes particle COLOR and ALPHA(transparency) to change over it's lifespan
//
// INTERP_SCALE: causes particle SCALE(size) to change over it's lifespan


//======================== After-Effects & Influences Options ================
//
// BOUNCE: particles bounce up from the z-altitude of emitter, and cannot fall below it.
//
// WIND: the sim's wind will push particles around
//
// FOLLOW_SRC: makes particles move (but not rotate) if their emitter moves, (disables RADIUS)
//
// TARGET_POS: causes particles to arrive at a some target at end of of their lifespan.
//
// TARGET_LINEAR: forces particles to form into an even line from emitter to target
// and forces a DROP-like pattern and disables effects of WIND and ACCEL



//========================================================================
//======================== USING CONTROL TEMPLATES =======================
//
// Want to control when your particles turn ON and OFF? You can!
//
// Drop one (or more) of the CONTROL TEMPLATES from the particle laboratory
// into your object containing this script. That's it!

// Your controls should be effective immediately. (Some controllers can be
// adjusted and tuned, open them and read the USAGE notes to see.)
//
// One control template can control several particle templates in the
// same object. (keep in mind that each prim can only have ONE
// particle effect active at a time).
//
// The 'particle_effect_name' value must be the same in both the control
// and particle template to work. You can change that value and have
// a controller for one effect, and a different controller for a different
// effect in the same object.
//


//======================================== END ===============================

i figure something in here tells me what im looking for and im just not quite at the level you guys are to see it?
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
10-13-2008 06:42
there is a targeting section at the lab too. i believe on the lower floor if i remember correctly
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
10-13-2008 10:05
From: someone


i figure something in here tells me what im looking for and im just not quite at the level you guys are to see it?


Yeah...you need to go back to The Particle Lab and pick up some of the Target Template scripts from the same place you got the chain template (on the opposite wall, from memory). For your project, you've really got two choices here. You can either use the"Listening" TARGET TEMPLATE and the "Speaking" TARGET TEMPLATE together, or the "Sensor" TARGET TEMPLATE on its own.

The comments in the scripts themselves tell you how to use them, but basically you position your emitter and target prims and then apply the scripts. If you are using the Speaking and and the Listening ones, put the Listener script in the emitter and the Speaking one in the target. Then touch the speaker. In short, it then says to anything that's listening, "Here I am and here's the magic word" (in case anything else is using the same channel) and the listener then takes the uuid of the prim that's just said that and passes it to the emitter script.

It then shuts down (as it does anyway after a couple of minutes if it doesn't hear anything interesting) so you don't need to worry about the lag caused by keeping listeners open unnecessary.

The Sensor is a different script and works differently. You just tell it the name of the prim it's looking for -- by default it's "My Sample Target Name" but you can make it anything you want. Name your target prim accordingly, drop the Sensor in the emitter prim and it does a quick scan. When it finds the prim it's interested in, it makes a note of its uuid and passes it to the emitter.

Normally you wouldn't have separate scripts grabbing the data and passing to the emitter in the same prim -- you would include that in the particle script itself (well, I would) but this is considerably easier for a beginning scripter to use.
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
10-13-2008 10:36
those 2 methods above work ok if it's seperate objects, but if it's a prim within the same object, you would need to use llGetLinkKey, but objects create new keys each time it's rezzed, (even no copy objects i believe) so if it's a chain you always want to have one, you'll need to add a script reset in the on rez event. if it's something that's switched on/off, the reset isn't necessary unless it's something that needs to listen to the owner only(and you're selling/giving it away)
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
10-13-2008 12:09
From: Ruthven Willenov
those 2 methods above work ok if it's seperate objects, but if it's a prim within the same object, you would need to use llGetLinkKey, but objects create new keys each time it's rezzed, (even no copy objects i believe) so if it's a chain you always want to have one, you'll need to add a script reset in the on rez event. if it's something that's switched on/off, the reset isn't necessary unless it's something that needs to listen to the owner only(and you're selling/giving it away)

Indeed so. The Particle Lab's "Linked" TARGET TEMPLATE provides an example of how to do this.
Tristesse Fair
Registered User
Join date: 19 Jun 2008
Posts: 4
10-13-2008 12:39
aha i figured i might of missed something ^ ^ building i got down but scripting is all new to me i will do my best :) thank you so much for the advice

::EDIT::

WOO HOO! it works! ^ ^ thank you so much
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
03-07-2009 09:16
Pardon the necro-posting... I was sifting through the forums and stumbled across this.

Particle chains can suffer if there's a lot of particles nearby competing with them... For stationary objects I tend to use pairs of slender flexi prims with wind set to 0.0, and a fair bit of anti-gravity.

Then I join the two flexi prims together like this:

wigglyside---stationaryside | stationaryside----wigglyside

Then I move them until the floating ends of the chain are at their correct anchor points. =)

Pros: no streaming animated chains or gaps
Cons: The chains flail around for a brief moment as the object comes into view. Depending on your situation you may be able to use cut torus prims or cylindars to simulate dangling chains as well. =)

(You're probably long onto the next project anyway.)

There are also serveral new target templates in the particle lab now, some that rez a prim to target with particles, some that target linked prims by name, and such. =)
_____________________
* 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!