Remove all scripts from a linkset
This simple script removes all scripts contained in a linkset. I had found one on the Internet but for an unknown reason, it moves the linkset ?! This one is simple, and works for attachments and rezzed objects. Just drop the script in the linkset (so in the root prim). If the linkset is one single prim, there is nothing else to do. Otherwise, when the script tells you that it is ready, unrez/re-rez the object and set all scripts to running using the menu of the viewer. That's all. An hovertext shows the number of remaining scripts to be cleaned up. This script is very useful for example for Firestorm's users: indeed when this page is being written down, the feature is still missing in Firestorm.
<lsl> // Script eraser by Dahlia Orfan (2012) // Drop this script in a linkset (rezzed on the ground or attachment) // When the script tells that it is ready, unrez and rerez the linkset // Set all scripts to running using the menu of the viewer // Wait until it is done. http://pastebin.com/gqi7mKFE
integer prims; integer DELETE;
erase() {
integer n = llGetInventoryNumber(INVENTORY_SCRIPT); while(n) { --n; if (llGetInventoryName(INVENTORY_SCRIPT,n) != llGetScriptName()) llRemoveInventory(llGetInventoryName(INVENTORY_SCRIPT,n)); }
}
default { link_message(integer sender_num, integer num, string str, key id) { if (num == DELETE) { --prims; llSetText((string)prims + " prims to clean up.",<1.0,1.0,1.0>,1.0); if (prims == 1) { erase(); llOwnerSay("done."); llSetText("",<1.0,1.0,1.0>,1.0); llRemoveInventory(llGetScriptName()); } } }
state_entry() { DELETE = (integer)("0x"+llGetSubString(llMD5String((string)llGetOwner(),31415),0,6)); if (llGetLinkNumber() <= 1) { prims = llGetNumberOfPrims(); if(1 < prims) while(llGetAgentSize(llGetLinkKey(prims))) --prims; if (prims >= 2) { llOwnerSay("Duplication of the script in all child prims."); integer n = prims; while(n > 1) { llGiveInventory(llGetLinkKey(n),llGetScriptName()); --n; } llSetText((string)prims + " prims to clean up.",<1.0,1.0,1.0>,1.0); llOwnerSay("Unrez and rerez the linkset; set scripts to running using the menu of the viewer to erase all scripts in child prims."); } else { erase(); llOwnerSay("done."); llSetText("",<1.0,1.0,1.0>,1.0); llRemoveInventory(llGetScriptName()); } } else { erase(); llMessageLinked(LINK_ROOT,DELETE,"",NULL_KEY); llRemoveInventory(llGetScriptName()); } } }
</lsl>