Duchy of Darkmere

Blingtardia Delenda Est


It is currently Wed Dec 23, 2009 2:10 pm

All times are UTC



Welcome
Welcome to <strong>Duchy of Darkmere</strong>.

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. Registration is fast, simple, and absolutely free, so please, <a href="/profile.php?mode=register">join our community today</a>!


Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Script Library. Share stuff.
PostPosted: Sun Sep 09, 2007 9:20 am 
Offline
Darkmerese

Joined: Fri Aug 17, 2007 3:17 pm
Posts: 2242
Slow, inelegant, but relatively failsafe duplicate deleter. Use at your own risk, of course.

Replace the inventory type with the appropriate one for your purposes. A list of types is available at: http://rpgstats.com/wiki/index.php?title=Inventory

//start code
integer type = INVENTORY_ANIMATION;
integer numitems;
string name1;
string name2;
integer namelen;
string lastchar;
list nums = ["1","2","3","4","5","6","7","8","9","0"];

default
{
state_entry()
{
numitems = llGetInventoryNumber(type);
//llWhisper(0,(string)numitems);
integer i;
for(i=0;i<(numitems-1);++i)
{
name1 = llGetInventoryName(type, i) +" ";
name2 = llGetInventoryName(type, (i+1));
namelen = llStringLength(name2);
lastchar = llGetSubString(name2,(namelen-1),(namelen-1));
if(llSubStringIndex(name2,name1) != -1 && llListFindList(nums,[lastchar]) != -1)
{
llRemoveInventory(name2);
llWhisper(0,"Removing: "+name2);
llResetScript();

}
}

}
}
//end code

A word of warning -- there is a risk of losing "sets" of items if the creator numbered them with space and then a number, but only if the first item isn't numbered. For example, this would be treated as duplicates:

dance
dance 1
dance 2
dance 3

but this should be safe:

dance 0
dance 1
dance 2
dance 3

_________________
-~-Beezle-~-

Though this be madness, yet there is method in't.
-- William Shakespeare

Warburton's Whimsies:
In SL
Apez.biz


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron