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());
}
}