Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Delete all of something in an object

Aliasi Stonebender
Return of Catbread
Join date: 30 Jan 2005
Posts: 1,858
09-21-2005 19:25
This script was made in response to Psyra Extraordinaire's request for a script that would copy itself to all of the prims in a multi-prim linked object and delete one specific item (a debug script in this case) and itself.

USE:

edit the line in the script with the name of the thing you wish to delete. drop this script into the root prim of the object, and wait as it spreads itself throughout. (llGiveInventory has a 3-second delay, so for objects containing many prims this can take awhile). Once the script says it's done, select your object and "recompile all scripts in selection". (You may also have to set all scripts to running.)

It should be fairly trivial to modify this to eliminate all objects contained within the prims of an objects, but I'll leave that as an exercise for the student. ;)

CODE

//Delete all of an item script. Deletes all of an item from a linked object!
//Script by Aliasi Stonebender. Do with this what you like.


default

{
state_entry()
{
if ((llGetLinkNumber() < 2) && (llGetLinkNumber() != 0))// are we in a linked root prim?
{
integer number_of_linked_objects = llGetNumberOfPrims();
integer currentprim;
llWhisper(0, "Copying script throughout object - this may take a little time!");
for (currentprim = 2; currentprim <= number_of_linked_objects; currentprim++)
{
key currentprim_key = llGetLinkKey(currentprim);
llGiveInventory(currentprim_key, llGetScriptName());
}
llWhisper(0, "Done. Deleting self. Reset all scripts now.");
llRemoveInventory(llGetScriptName());
}
else //If our Link number is not 0, and is 2 or greater, then we're in a linked child prim!
{
llWhisper(0, "Deleting scripts...");
llRemoveInventory("debug script");//put the name of the thing you wish to delete here
llRemoveInventory(llGetScriptName());
}
}
}
_____________________
Red Mary says, softly, “How a man grows aggressive when his enemy displays propriety. He thinks: I will use this good behavior to enforce my advantage over her. Is it any wonder people hold good behavior in such disregard?”
Anything Surplus Home to the "Nuke the Crap Out of..." series of games and other stuff
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
09-23-2005 07:50
/15/67/62506/1.html
_____________________
i've got nothing. ;)