Remove all scripts from a linkset

Expired

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 prims 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.

 

 

//  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;
 
//  remove all other scripts, then this one
remove_scripts()
{
    string thisScript = llGetScriptName();
 
    integer index = llGetInventoryNumber(INVENTORY_SCRIPT);
    string scriptName;
 
//  start with last script which has the index (numberOfScripts - 1)
    do
    {
        --index;
        scriptName = llGetInventoryName(INVENTORY_SCRIPT, index);
 
        if (scriptName != thisScript)
           llRemoveInventory(scriptName);
    }
    while (index);
 
//  at last remove this script
    llRemoveInventory(thisScript);
}
 
default
{
    state_entry()
    {
        string ownerMD5string = llMD5String((string)llGetOwner(), 31415);
 
    //  set an ident number code
        DELETE = (integer)("0x" + llGetSubString(ownerMD5string, 0, 6));
 
        integer link = llGetLinkNumber();
 
    //  the root prim has link number 0 for single prim objects and 1 for linksets
        if (link <= 1)
        {
            prims = llGetNumberOfPrims();
 
        //  do not count seated agents
            if(1 < prims)
                while(llGetAgentSize(llGetLinkKey(prims)))
                    --prims;
 
        //  if single prim, else linkset
            if (prims == 1)
            {
            //  PUBLIC_CHANNEL has the integer value 0
                llSay(PUBLIC_CHANNEL, "Done removing scripts.");
                remove_scripts();
            }
            else
            {
                integer n = prims;
                while(n > 1)
                {
                    llGiveInventory(llGetLinkKey(n), llGetScriptName());
                    --n;
                }
            //  PUBLIC_CHANNEL has the integer value 0
                llSay(PUBLIC_CHANNEL, "Please take this object back to your inventory and "
                    + "rez it again. Then edit the object (ctrl+3), go to the menu at the "
                    + "top of your viewer and select BUILD > SCRIPTS > SET SCRIPTS TO RUNNING.");
            }
        }
        else//  not the root prim
        {
            llMessageLinked(LINK_ROOT, DELETE, "", NULL_KEY);
            remove_scripts();
        }
    }
 
    link_message(integer sender_num, integer num, string str, key id)
    {
    //  if the received linkmessage contains the ident number code previously stored...
        if (num == DELETE)
        {
            --prims;
 
            if (prims == 1)
            {
            //  PUBLIC_CHANNEL has the integer value 0
                llSay(PUBLIC_CHANNEL, "Done removing scripts.");
                remove_scripts();
            }
        }
    }
}

 

 

 

Bling Scrubber ( V1 )

Expired

This is specifically for removing particles and the scripts that set them from objects. It will cure link_sets or single prims. If the option to scrub the scripts is chosen (as well as to scrub the particles) ALL the scripts in the whole object will be removed.

 

 

// V1 //
 
string instructions = "";
 
integer channel = -9865443;
 
string scrub = "SCRUB";
 
string no = "NO";
 
integer link_num;
 
Dialog(integer d)
{
    key owner = llGetOwner();
    llListen(channel, "", owner, "");
    if(d)
    llDialog(owner, "\n\n" + instructions + "ARE YOU SURE YOU WANT TO REMOVE ALL SCRIPTS?" + 
                    "CLICKING \"" + no +
                    "\" WILL STILL REMOVE ALL PARTICLES BUT, THEY MIGHT COME BACK.", [scrub, no], channel);
}
 
default
{
    on_rez(integer param)
    {
        Dialog(1);
    }
    state_entry()
    {
        if((link_num = llGetLinkNumber()) == 1)
        {
            integer i = 2;
            do
            llGiveInventory(llGetLinkKey(i), llGetScriptName());
            while((++i) <= llGetNumberOfPrims());
            instructions = "Open an edit on me and goto your viewer \"Tools\" menu.\n" +
                           "Near the bottom of the menu click \"Set Scripts Running in Selection\".\n" +
                           "Once ALL the scripts are set running, click the \"" + scrub + "\" button.\n\n";
            llOwnerSay("Take then rez me. Follow the instructions given on rez.");
        }
        else if(!link_num)
        Dialog(1);
        else
        Dialog(0);
    }
    listen(integer chan, string name, key id, string msg)
    {
        chan = 0;
        if(msg == scrub)
        {
            string name;
            while((llGetInventoryNumber(INVENTORY_SCRIPT) - 1))
            {
                if((name = llGetInventoryName(INVENTORY_SCRIPT, chan)) != llGetScriptName())
                llRemoveInventory(name);
                else
                chan = 1;
            }
        }
        if(((chan = link_num) == 1))
        {
            do
            llLinkParticleSystem(chan, []);
            while((++chan) <= llGetNumberOfPrims());
        }
        else
        llParticleSystem([]);
        if(link_num < 2)
        llOwnerSay("All done!");
        llRemoveInventory(llGetScriptName());
    }
}

 

 

 

Prim Property Scrubber ( V2 )

Expired

Just drop it onto/into the prim you want to clean of a property and choose from the menu which properties to remove either 1 at a time or all at once.

 

 

// V2 //
 
key owner;
 
integer passes = 0;
 
integer channel;
 
list properties = ["All",         // All the properties listed below.
                   "Text",        // Floating text. Used to display text typically above a prim.
                   "Particles",   // Used in "Poofers" for example.
                   "TextureAnim", // Texture Animation. Used to make textures on faces of prims move.
                   "Sit Target",  // Used in seats and poseballs. Sets an alternative sit position than the default.
                   "Mouselook",   // Forced Mouselook. Used to force an agents view to mouselook when sitting on the prim.
                   "Sit Text",    // Text other than the default "Sit Here" shown on the right click pie menu.
                   "Touch Text",  // Text other than the default "Touch" shown on the right click pie menu.
                   "Status's",    // There are many status's that can be set in prims. See the wiki (llSetStatus) for details.
                   "Sound",       // Looping sound emitting from the prim.
                   "Light"];      // Light emitting from the prim.
 
RP(integer i)
{
    ++passes;
    if(i == 1)
    llSetText("", <0.0,0.0,0.0>, 0.0);
    else if(i == 2)
    llParticleSystem([]);
    else if(i == 3)
    llSetTextureAnim(0, -1, 0, 0, 0.0, 0.0, 1.0);
    else if(i == 4)
    llSitTarget(<0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>);
    else if(i == 5)
    llForceMouselook(0);
    else if(i == 6)
    llSetSitText("");
    else if(i == 7)
    llSetTouchText("");
    else if(i == 8)
    {
        llSetStatus(14, 1);
        llSetStatus(251, 0);
    }
    else if(i == 9)
    llStopSound();
    else if(i == 10)
    llSetPrimitiveParams([23, 0, <0.0,0.0,0.0>, 0.0, 0.0, 0.0]);
}
 
RemoveProperty(integer i)
{
    if(!i)
    {
        while(i <10)
        RP(++i);
        RemoveScript();
    }
    else
    RP(i);
    if(passes < 10)
    llDialog(owner, "\nRemove Properties", ["Finished"] +
    (properties = llListReplaceList(properties, ["-"], i, i)), channel);
    else
    RemoveScript();
}
 
RemoveScript()
{
    llRemoveInventory(llGetScriptName());
}
 
default
{
    state_entry()
    {
        owner = llGetOwner();
        llListen((channel = (llRound(llFrand(-10000000)) - 100000)), llKey2Name(owner), owner, "");
        llDialog(owner, "\nRemove Properties", ["Finished"] + properties, channel);
        llSetTimerEvent(60.0);
    }
    listen(integer chan, string name, key id, string msg)
    {
        llSetTimerEvent(60.0);
        integer index = 0;
        if((index = llListFindList(properties, [msg])) != -1)
        {
            if(msg != "-")
            RemoveProperty(index);
            else
            llDialog(owner, "\nRemove Properties", ["Finished"] + properties, channel);
        }
        else if(msg == "Finished")
        RemoveScript();
    }
    timer()
    {
        llOwnerSay("Removing script since you're not using it.");
        RemoveScript();
    }
}

 

 

 

Linked Multi-Prim Drawers (2 scripts) ( V4 )

Expired

Could also be used for doors etc.

 

 

Instructions (Copy to NC or Script)

 

// V4 //

// INSTRUCTIONS FOR USE (there are two scripts that make up the set)

// Make your chest of drawers and link the whole set together with the body (any prim that doesn't move) of the chest as the root.

// Name every prim used as a part of a drawer (include handles, drawer fronts, bases etc.) "drawer " plus a number.

// All the prims of one drawer should now all be named the same. e.g. "drawer 1".

// Name every drawer a different number. e.g. "drawer 1", "drawer 2" etc.

// With all the parts named correctly, edit the object so that all the drawers are closed.

// At this point you might want to take a copy.

// Be sure that no prims are named "drawer (something)" unless they are supposed to be (according to the above).

// Drop both the scripts (at the same time or "Linkypooz" first) into the root of the object.

// You will get further instructions in local chat. Follow them.

 

 

Drawer Script

 

// V4 //
 
// This script needs to be named "Linkypooz".
 
vector open_pos;
 
vector closed_pos;
 
rotation open_rot;
 
rotation closed_rot;
 
integer OPEN;
 
key owner;
 
integer my_response_num;
 
integer my_link_num;
 
Drawer()
{
    if(OPEN)
    llSetPrimitiveParams([PRIM_POSITION, closed_pos, PRIM_ROTATION, (closed_rot / llGetRootRotation())]);
    else
    llSetPrimitiveParams([PRIM_POSITION, open_pos, PRIM_ROTATION, (open_rot / llGetRootRotation())]);
    OPEN = (!OPEN);
}
 
default
{
    state_entry()
    {
        owner = llGetOwner();
        closed_pos = llGetLocalPos();
        closed_rot = llGetLocalRot();
        my_link_num = llGetLinkNumber();
        my_response_num = ((integer)llGetSubString(llGetLinkName(my_link_num), 7, -1));
    }
    touch_start(integer nd)
    {
        if(llDetectedKey(0) == owner)
        {
            if(my_link_num != 1)
            {
                open_pos = llGetLocalPos();
                open_rot = llGetLocalRot();
                llSetLocalRot(closed_rot);
                llSetPos(closed_pos);
                state normal;
            }
            else
            llRemoveInventory(llGetScriptName());
        }
    }
}
state normal
{
    state_entry()
    {
        llOwnerSay("/me is active!");
    }
    touch_start(integer nd)
    {
        llMessageLinked(LINK_SET, my_response_num, "", "");
    }
    link_message(integer sender, integer num, string str, key id)
    {
        if(num == my_response_num)
        Drawer();
    }
}