Jump to content

Script Remover for Linksets


Dora Gustafson
 Share

You are about to reply to a thread that has been inactive for 4772 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

New Forum Edition

Run this script in a linkset/object and it will remove all scripts in the linkset.

  1. Put the script in the linkset
  2. Take the linkset into Inventory
  3. Rezz it back into the world
  4. Select it and 'Set Scripts to Running in Selection'
  • The script will guide you through these steps
  • When rezzed back into the world the linkset will snap to the position where it was taken,
    if that position isn't more than 10 meters away
// SCRIPT REMOVER by Dora Gustafson, Studio Dora 2010
// Based on 'Script eraser v1.2' Script by Dora Gustafson 2008
// Place script in the root of the object you want to clean for scripts and follow the instructions
// v1.01 monitor number of scripts started
// v1.02 child count down

vector position_original;
integer primNo;
integer childcount;
float eb_delay = 0.03125; // seconds to hold script. Defeat event buffer limit (64 events)

eraser()
{ // erase all scripts from prim
integer i = 0;
string s;
string thisScript = llGetScriptName();
do
{ s = llGetInventoryName( INVENTORY_SCRIPT, i );
if ( s != thisScript ) llRemoveInventory( s );
else ++i; // don't erase skip it
}
while ( llGetInventoryNumber( INVENTORY_SCRIPT ) > 1 );
if ( primNo == 1 )
{
llOwnerSay("All scripts have been removed from this object");
llSetText("", <1.0, 1.0, 1.0>, 1.0);
}
llRemoveInventory( thisScript ); // remove this as the last
}

default
{
state_entry()
{
integer dg;
primNo = llGetLinkNumber();
if ( primNo == 1 )
{
childcount = llGetNumberOfPrims()-1;
position_original = llGetPos();
for ( dg = 2; dg <= llGetNumberOfPrims(); dg++ ) llGiveInventory( llGetLinkKey( dg ), llGetScriptName());
llOwnerSay("\n1. Take this object into Inventory!\n2. Rezz it back into the world!\n(will snap in position if less than 10m from where it was)");
}
else if (primNo > 1)
{
llSleep( eb_delay*primNo );
llMessageLinked( LINK_ROOT, FALSE, "child running", NULL_KEY);
}
}
on_rez( integer parm )
{
if ( !primNo )
{ // if linkset is just one prim, probably the box it is sold in
llOwnerSay("\nOpen prim and save script in inventory before use:\nPlace script in the object you want to clean and follow the instructions\nCongratulations with this SCRIPT REMOVER by Dora Gustafson, Studio Dora");
}
else if ( primNo == 1 )
{
llSetPos( position_original );
llOwnerSay( "\n3. Select and 'Set Scripts to Running in Selection'");
}
}
link_message(integer targ, integer num, string instruct, key id)
{
if ( instruct == "Erase Only" ) eraser();
else if ( instruct == "child running" )
{
if ( --childcount < 1 ) llMessageLinked( LINK_SET, FALSE, "Erase Only", NULL_KEY);
llSetText( (string)childcount+" scripts are NOT running", <1.0, 1.0, 1.0>, 1.0);
}
}
}

Note 1: In viewer 2 the menu function:"Set Scripts to Running in Selection" is changed to:"Set scripts to running".

Note 2: Now the script shows the progress by displaying the number of remaining scripts not running. This gives very much the same feel as we had in viewer 1.xx

Link to old Forum

 

 

 

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4772 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...