SHARE
TWEET

Script Eraser

a guest Jan 14th, 2012 218 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Script eraser by Dahlia Orfan (2012)
  2. // Drop this script in a linkset (rez on the ground or attachment)
  3. // When the script tells that it is ready, unrez and rerez the linkset
  4. // Set all scripts to running using the menu of the viewer
  5. // Wait until it is done.
  6.  
  7. integer prims;
  8. integer DELETE;
  9.  
  10. erase()
  11. {
  12.     integer n = llGetInventoryNumber(INVENTORY_SCRIPT);
  13.     while(n)
  14.     {
  15.         --n;
  16.         if (llGetInventoryName(INVENTORY_SCRIPT,n) != llGetScriptName())
  17.             llRemoveInventory(llGetInventoryName(INVENTORY_SCRIPT,n));
  18.     }
  19. }
  20.  
  21.  
  22.  default
  23.  {
  24.      link_message(integer sender_num, integer num, string str, key id)
  25.      {
  26.          if (num == DELETE)
  27.          {
  28.              --prims;
  29.              llSetText((string)prims + " prims to clean up.",<1.0,1.0,1.0>,1.0);
  30.              if (prims == 1)
  31.              {
  32.                  erase();
  33.                  llOwnerSay("done.");
  34.                  llSetText("",<1.0,1.0,1.0>,1.0);
  35.                  llRemoveInventory(llGetScriptName());
  36.              }
  37.          }
  38.      }
  39.  
  40.      state_entry()
  41.      {
  42.          DELETE = (integer)("0x"+llGetSubString(llMD5String((string)llGetOwner(),31415),0,6));
  43.          if (llGetLinkNumber() <= 1)
  44.          {
  45.              prims = llGetNumberOfPrims();
  46.              if(1 < prims)
  47.                  while(llGetAgentSize(llGetLinkKey(prims)))
  48.                      --prims;
  49.              
  50.              if (prims >= 2)
  51.              {
  52.                  llOwnerSay("Duplication of the script in all child prims.");
  53.                  integer n = prims;
  54.                  while(n > 1)
  55.                  {
  56.                      llGiveInventory(llGetLinkKey(n),llGetScriptName());
  57.                      --n;
  58.                  }
  59.                  llSetText((string)prims + " prims to clean up.",<1.0,1.0,1.0>,1.0);
  60.                  llOwnerSay("Unrez and rerez the linkset; set scripts to running using the menu of the viewer to erase all scripts in child prims.");
  61.              }
  62.              else
  63.              {
  64.                  erase();
  65.                  llOwnerSay("done.");
  66.                  llSetText("",<1.0,1.0,1.0>,1.0);
  67.                  llRemoveInventory(llGetScriptName());
  68.              }
  69.          }
  70.          else
  71.          {
  72.              erase();
  73.              llMessageLinked(LINK_ROOT,DELETE,"",NULL_KEY);
  74.              llRemoveInventory(llGetScriptName());
  75.          }
  76.      }
  77.  }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top