Initial commit
Initial commit.
This commit is contained in:
35
_module/nss/store_cleaner.nss
Normal file
35
_module/nss/store_cleaner.nss
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
Original code by Mojo and his ATS.
|
||||
He was a great scripter and his presence will be missed.
|
||||
Code tweaked for generic use in all merchants by:
|
||||
Chris Morris
|
||||
*/
|
||||
|
||||
void main()
|
||||
{
|
||||
object oCurrentItem = GetFirstItemInInventory();
|
||||
string sItemTag;
|
||||
int iItemCount = 0;
|
||||
|
||||
//this while does the trimming
|
||||
while(oCurrentItem != OBJECT_INVALID){
|
||||
|
||||
sItemTag = GetResRef(oCurrentItem);
|
||||
iItemCount = GetLocalInt(OBJECT_SELF, "count_" + sItemTag);
|
||||
|
||||
if(iItemCount >= 1){ //set this number to amount of duplicates
|
||||
DestroyObject(oCurrentItem);//that are acceptable
|
||||
}else{
|
||||
++iItemCount; //incrementing number in inventory
|
||||
SetLocalInt(OBJECT_SELF, "count_" + sItemTag ,iItemCount );
|
||||
}
|
||||
oCurrentItem = GetNextItemInInventory(); //do next item
|
||||
}//end while
|
||||
|
||||
oCurrentItem = GetFirstItemInInventory();
|
||||
//this while resets for next onOpen
|
||||
while(oCurrentItem != OBJECT_INVALID){
|
||||
SetLocalInt(OBJECT_SELF, "count_" + GetResRef(oCurrentItem) , 0);
|
||||
oCurrentItem = GetNextItemInInventory();
|
||||
}//end while
|
||||
}//end main()
|
Reference in New Issue
Block a user