What are you doing with the strings after you get them? It looks like you just cycle through the inventories of every chest without ever actually doing anything with the information.
Is it going to be used to populate a database?
Also, what exactly is the issue you're having? TMI error would seem likely if you have quite a few chests and/or items.
Edit: I did a quick test, 8 barrels tagged appropriately, 2 items in each barrell, and it cycled through all of them properly. I assigned the routine to a PC to test and added a debug line to make sure.
The only change I made, aside from cosmetic ones, was to remove the check before nChestNum ++; .
It was unneeded, since it would only get to there once oInv was invalid to begin with.
void PrimeLootitems()
{
int nChestNum = 1;
string sItemResref, sItemTag, sItemName, sItemValue;
object oInv;
string sChestTag = "ss_t_chest_" + IntToString (nChestNum);
object oChest = GetObjectByTag (sChestTag);
while (GetIsObjectValid (oChest))
{
oInv = GetFirstItemInInventory(oChest);
while (GetIsObjectValid (oInv))
{
sItemResref = GetResRef(oInv);
sItemTag = GetTag(oInv);
sItemName = GetName(oInv, FALSE);
sItemValue = IntToString(GetGoldPieceValue(oInv));
// Debug Line
SpeakString (sItemResref + ":" + sItemTag + ":" + sItemName + ":" + sItemValue);
oInv = GetNextItemInInventory(oChest);
}
nChestNum ++;
oChest = GetObjectByTag("ss_t_chest_" + IntToString(nChestNum));
}
}
Modifié par Failed.Bard, 16 juillet 2011 - 05:00 .