Clearing Junk Accumulated At Merchants
ColinK
Member Posts: 6
I'm looking at the ClearMerchant() proc in the Rhun persistent world.
It appears to me to delete only non-infinite objects worth more than 4000 gold.
Either that or it fails to delete objects at all, because my merchants' collections of urchin rags, daggers, leather armor and empty wine bottles only continue to grow.
Before I begin committing codicide it seems reasonable to ask if anybody can recommend a relatively safe way to cause this procedure to delete objects with values as little as 1 gold?
Better yet, maybe there is a different, well-tested script somewhere that does the job?
I suspect I can simply change the 4000 to a 1, but then I look at that GetInfiniteFlag(oItem)==FALSE clause and wonder. I'm really tempted to archive a backup copy of ClearMerchant() and in my own copy entirely eliminate the Infinite Flag condition.
void main()
{
//Remove all sold items in merchant's inventory after 1 hour.
DelayCommand(HoursToSeconds(1), ClearMerchant());
}
void ClearMerchant()
{
object oItem=OBJECT_INVALID;
// Clear the merchants inventory
oItem = GetFirstItemInInventory();
while(oItem!=OBJECT_INVALID)
{
//Make sure people don't stuff <span class="highlight">chest</span> with plot items and break it
if(GetInfiniteFlag(oItem)==FALSE && !GetGoldPieceValue(oItem)>=4000)
{SetPlotFlag(oItem, FALSE);
DestroyObject(oItem, 0.0);}
oItem = GetNextItemInInventory();
}
}
It appears to me to delete only non-infinite objects worth more than 4000 gold.
Either that or it fails to delete objects at all, because my merchants' collections of urchin rags, daggers, leather armor and empty wine bottles only continue to grow.
Before I begin committing codicide it seems reasonable to ask if anybody can recommend a relatively safe way to cause this procedure to delete objects with values as little as 1 gold?
Better yet, maybe there is a different, well-tested script somewhere that does the job?
I suspect I can simply change the 4000 to a 1, but then I look at that GetInfiniteFlag(oItem)==FALSE clause and wonder. I'm really tempted to archive a backup copy of ClearMerchant() and in my own copy entirely eliminate the Infinite Flag condition.
void main()
{
//Remove all sold items in merchant's inventory after 1 hour.
DelayCommand(HoursToSeconds(1), ClearMerchant());
}
void ClearMerchant()
{
object oItem=OBJECT_INVALID;
// Clear the merchants inventory
oItem = GetFirstItemInInventory();
while(oItem!=OBJECT_INVALID)
{
//Make sure people don't stuff <span class="highlight">chest</span> with plot items and break it
if(GetInfiniteFlag(oItem)==FALSE && !GetGoldPieceValue(oItem)>=4000)
{SetPlotFlag(oItem, FALSE);
DestroyObject(oItem, 0.0);}
oItem = GetNextItemInInventory();
}
}
0
Comments
I would keep the infinite flag checking, as there needs to be some way to differentiate the items normally sold by the vendor vs everything else. If you remove the infinite flag check, it will just delete every item in the shop over 1 gold.