Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Which one is the root prim...?

Adman Drake
Registered User
Join date: 9 Feb 2006
Posts: 96
02-13-2006 10:08
Imagine creating a small sphere (call it s1), and then a second sphere near to it, about a meter away (call it s2).

Now, link them together to create an object o.

I created a script to start a particle effect on the object when touched. The particles appear on one of the spheres or the other. How do I control this?

Are the particles created on the root prim?
When joining one prim to another, which one is the root?
If I had two complex (>1 prim) objects and I joined them together, what would the root be?)
Does it matter where the script goes?

Thanks for your help! I'm brand new to SL, but very intrigued!

Adman
Metawraith Mistral
Ghost in the Machine
Join date: 26 Sep 2005
Posts: 166
02-13-2006 10:23
The ROOT prim is the last one linked.
It is also highlighted with a blue wireframe as opposed to the normal yellow wireframe.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
02-13-2006 11:35
Particles are created in the prim the script is in.

If you want them both to generate particles, have them both contain the script.

The root prim is the last prim added to the link set. It glows gold in the editor.

In this case, you don't actually need to know which is the root prim, because you can use the same script in both...

CODE

start_particles()
{
// insert favorite particle generator code here
}

state default
{
state_entry()
{
if(llGetLinkNumber() <= 1) state root_off;
else state child_off;
}
}

state root_off
{
touch(integer num)
{
llMessageLinked(LINK_SET,1,"","");
start_particles();
state root_on;
}
}


state root_on
{
touch(integer num)
{
llMessageLinked(LINK_SET,0,"","");
llParticleSystem([]);
state root_off;
}
}


state child_off
{
link_message(integer from, integer num, string str, key id)
{
if(num)
{
start_particles();
state child_on;
}
}
}


state child_on
{
link_message(integer from, integer num, string str, key id)
{
if(!num)
{
llParticleSystem([]);
state child_off;
}
}
}

This works because the root prim always gets the touch event.