Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Passing a delete request

Wyatt Weatherwax
Registered User
Join date: 23 Oct 2007
Posts: 59
03-10-2009 10:40
Not sure how to start on this one so it may be a product request but here goes:

I have several creations that when touched rez another part which (in most cases) is within the originally rezzed Prim. When the user is done with it they have to delete the main Prim and the additional Prim-rezzed prim. Is there a way to pass the delete requested received by the original Prim to the secondary prim as well so that both are deleted in one request?

Thanks as always.
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
03-10-2009 11:53
From: Wyatt Weatherwax
Is there a way to pass the delete requested received by the original Prim to the secondary prim as well so that both are deleted in one request?
A prim can only be deleted from a script within it(or an Avatar), so it all depends on the script to what request it will respond by deleting the prim. All your prims could have a script for that purpose. It would listen on a specific channel for a specific command.
_____________________
From Studio Dora
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
03-10-2009 11:58
Well, if they are linked, just use llDie. See --> 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."

If the prims aren't linked, then you could either link them and then delete, or you could take the long route and put a tiny script in each rezzed object that listens for the original prim to send a llDie message.
Wyatt Weatherwax
Registered User
Join date: 23 Oct 2007
Posts: 59
03-10-2009 12:07
The objects are not linked and the internal one is actually constructed of multiple prims and rotates so I don't think I want them linked. The Listening thing sounds interesting but I have not worked with that function yet so I will have to investigate. Does it involve getting UUIDs?
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
03-10-2009 12:36
Nope. Just write a pair of scripts. In the original object, it should look something like this ....

CODE


gChannel = -3456; // Or whatever negative number strikes your fancy
default
{
touch_start(num_detected)
{
if(llGetOwner() == llDetectedKey(0)) // Don't pay attention to anyone else
{
llSay(gChannel, "Die! DIE! DIE!"); // Tell the other prims to die.
llSleep(3.0); // Take a deep breath and then ...
llDie(); // Farewell ..... poof!
}
}
}



And in each of the other objects, it should look like this ...

CODE


gChannel = -3456; // Same as in the parent script
default
{
state_entry
{
llListen(gChannel,"",NULL_KEY,""); // Listen only to messages on channel -3456
}
listen( integer channel, string name, key id, string message )
{
if(message == "Die! DIE! DIE!") // Only obey this specific message ...
{
llDie(); // And then vanish .....
}
}
}



If you really get paranoid about some other object yelling the DIE message on gChannel, you can always replace NULL_KEY in the listen event with the UUID of your parent object, but that's such an unlikely possibility that it's not worth the trouble.

EDIT: Ah.... I forgot that you want to delete the original object as well. I have just added that llDie() to the first script. ;)
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
03-10-2009 13:21
And remember to use llRegionSay instead of llSay because it involves less processing for the sim.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
03-10-2009 13:38
I would prefer llRegionSay() for llSay() in the parent script and I would prefer the message as a filter like this:
CODE
gChannel = -3456; // Same as in the parent script
default
{
state_entry
{
llListen(gChannel,"",NULL_KEY,"Die! DIE! DIE!"); // Listen only for the exact messages on channel -3456
}
listen( integer channel, string name, key id, string message )
{
llDie(); // And then vanish .....
}
}
:)
_____________________
From Studio Dora
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
03-10-2009 15:38
If you can have the child object find out the key of its parent object (e.g. have the parent announce that it is the child prim's parent on an agreed-upon channel), you could also use sensors or (preferably) llGetObjectDetails() to detect when the parent object is no longer around and call llDie().
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
03-10-2009 18:20
two suggestions for listen driven prim killing.

one) have the rezzor (when it is initially rezzed itself) generate a higher negative number to use as the kill channel, and pass it to all the prims it creates via the start parameter.
[this reduces crosstalk between multiple rezzors of the same type)

two) filter with (llGetOwnerId( Id ) == llGetOwner)
this prevents someone elses rezzor from affecting yours.

if the user isn't using some kind of scripted kill, just a pie menu delete, you'll need one of the rezzed objects to run a sensor for the rezzor, and then pass it's message of death (don't put sensors in all the rezzed objects. if all the secondary objects are the same, just add a copy of the first one and insert the sensor script, and use an onRez variable in the rezzor script to make sure that one gets rezzed first, and the ones after it are the normal ones.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Wyatt Weatherwax
Registered User
Join date: 23 Oct 2007
Posts: 59
03-11-2009 18:15
Ahhh, I think Void hit this one on the head, yes, the person deleting the main object will be using the Pie menu. This mean that your suggested solution is a bit beyond my abilities. So it looks like this may be a "for pay" job. If anyone wants to tackle it, please let me know.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
03-12-2009 13:36
I'd offer but I can't concentrate on my own work atm.

@wyatt:
just remember that the sensing prim should be interior to the rezzing prim (or otherwise blocked) so that it doesn't get deleted first. otherwise you need at least 2 sensing prims just in case
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Maggy Chestnut
Registered User
Join date: 7 Dec 2006
Posts: 3
Syntax error
06-14-2009 09:00
HI,
I tried to paste that into a script, but it gives me an error.

[/php]

gChannel = 100; // Same as in the parent script
default
{
state_entry
{
llListen(gChannel,"",NULL_KEY,"Clean";); // Listen only to messages on channel 100
}
listen( integer channel, string name, key id, string message )

{
llDie(); // And then vanish .....
}
}
[/php]

Can someone help me with this (very newbee at scripting).
Thanx!!!
Maggy
Maggy Chestnut
Registered User
Join date: 7 Dec 2006
Posts: 3
06-14-2009 09:14
Dora helped me:

state_entry()

does the job.