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