Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How do I make linked objects die?

Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
08-22-2006 11:51
I use the sitontarget TP system in my house. Inside the house I have buttons with a dif location in each button and the prims are set to "sit on target" when touched. This "TPs me instantly (Iknow it is not true TP). But on the ground, on my patio and one other location I do not want buttons permanently so I do not have to worry about allowed users etc. I have a set of five buttons linked together that I can rez and that is set as "temp on rez". I touch my bottun and off I go. The left behind set of buttons dies in a minute or two. Is there any way I can change the whole linked set to "die" as soon as I touch one of the buttons????????? ANd would I have to modify the following script which is in each button or put a new script in the linked set?

vector targetPos = <0.0, 0.0, 0.0>; //The target location

reset()
{
vector target;

target = (targetPos- llGetPos()) * (ZERO_ROTATION / llGetRot());
llSitTarget(target, ZERO_ROTATION);
llSetSitText("Teleport";);
}
default
{
state_entry()
{
reset();
}

on_rez(integer startup_param)
{
reset();
}

changed(integer change)
{
llUnSit(llAvatarOnSitTarget());
reset();
}
}
Baron Hauptmann
Just Designs / Scripter
Join date: 29 Oct 2005
Posts: 358
08-22-2006 12:15
From the wiki:

llDie();

Deletes the object that contains the script. That means if the prim containing this script is part of a linkset, all the prims will be deleted, regardless of whether or not the prim is the root or a child in the linkset. To delete just one prim from a linkset, first detach it with llBreakLink.


Basically, if you put this in a touch_start(...) event, everything linked to it (and the prim it is in) will die on touch. The code you posted did not have a touch_start(...) event, though you made reference to touching it.

Also, since when you touch a child prim that does NOT have a touch-receiving event, all touches are passed on to the root prim, this would only need to go into the root (if, indeed none of the child prims have touch events).

Hope that helps. Ask if you need clarification.

Baron H.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
08-22-2006 21:13
Ah TY for the response Baron and it did help. To clarify the "touch event" is set in the primitive properties. A left click will sit me on prim which starts it. After running it through my mind I finally realized that I do not have to call or initiate !!Die. The program is already running after I touch/sit. All I had to do was insert !!Die into the program before reset and it works perfectly:

vector targetPos = <0.0, 0.0, 0.0>; //The target location

reset()
{
vector target;

target = (targetPos- llGetPos()) * (ZERO_ROTATION / llGetRot());
llSitTarget(target, ZERO_ROTATION);
llSetSitText("Teleport";);
}
default
{
state_entry()
{
reset();
}

on_rez(integer startup_param)
{
reset();
}

changed(integer change)
{
llUnSit(llAvatarOnSitTarget());
llDie(); <<<<<<<<<
reset();
}
}