Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

can you delete an object that you rez?

Bounder Jimenez
programmer/designer
Join date: 12 Oct 2005
Posts: 45
10-31-2005 08:18
Can an object that creates a new object with llRezObject later delete that object without putting a script in the new object on demand? I see the key for the new object in rez_object.

I created a catapult that rez's part of itself so that it all moves correctly in on_rez. The trick is to delete the part that it created when it is deleted itself.

Or to have a button that creates a room. Have the same button delete that room the next time a user clicks it.

I realize that I can do this with communications and a script that listens in the new object, but I'd prefer not to do that.

The creating part works fine in both examples, just can't figure how to delete them when done.

Thanks
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
10-31-2005 09:27
From: Bounder Jimenez

The creating part works fine in both examples, just can't figure how to delete them when done.


I don't think that's possible.

I suppose you could cheat by making it temp-on-rez and then renewing it at regular intervals if you don't want to delete it - but I think you need modify permission for that, and if you have that, you could just put a "delete now" script inside it.
Bounder Jimenez
programmer/designer
Join date: 12 Oct 2005
Posts: 45
is there a de-rez anything?
10-31-2005 09:54
Ok, so the room problem is solved easily with a kill script in the object. The button just uses sensor to look for the object, if it finds it, it uses llWhisper to tell it to die, otherwise it creates the object.

However, the catapult problem is stumping me. The catapult creates the required pieces when it rez's and somehow, i'd like to delete them when the main object is deleted. I guess I can put a timer/sensor script in that continues to look for the main part and deletes itself when the main object is gone but that will increase server load which i'd rather not do. Is there any event that happens when an item is deleted from the world?

Thanks
Myrilla Vixen
Definitely Bloo
Join date: 11 Jun 2005
Posts: 143
10-31-2005 11:23
why not have it so all peices delete on a single voice command.. or maybe have the main object have a lil script menu with a 'delete function' that whispers the delete command to the other objects created, and then kills itself? It would be much easier than trying to make the main object scream when it dies. ^^'
Bounder Jimenez
programmer/designer
Join date: 12 Oct 2005
Posts: 45
10-31-2005 13:37
don't know if its good or not, but this is the segment that i wrote that does work. this way when the base object "Catapult" is deleted, taken, or otherwize removed, it will delete the part containing the script.

on_rez(integer start)
{
llSensorRepeat("Catapult","",AGENT | ACTIVE | SCRIPTED | PASSIVE,10.0,PI,2);
}

no_sensor()
{
llSensorRemove();
llDie();
}

all those "AGENT....PASSIVE" shouldn't need to be there, but it seemed to be the only way that it worked under all conditions. I could reduce the time so it happened quicker but this is fine.

i still wish there were a "llDeleteChild(key id)" function or something like that.