// calculate team resources
void main()
{
   object oPC=GetPCSpeaker();
   string sID=GetLocalString(oPC,"sTeamID");
   object oChest=GetObjectByTag(sID+"_CHEST");
   int nGold=GetGold(oPC);
   int nMana=GetLocalInt(oPC,"nManaStore");
   int nSouls=GetLocalInt(oPC,"nSoulStore");
   string sMsg=IntToString(nMana)+" mana, "+IntToString(nSouls)+" souls, and ";
   object oItem=GetFirstItemInInventory(oChest);
   while(oItem!=OBJECT_INVALID)
   { // check inventory
     if (GetResRef(oItem)=="nw_it_gold001")
     { // gold
       nGold=nGold+GetItemStackSize(oItem);
     } // gold
     oItem=GetNextItemInInventory(oChest);
   } // check inventory
   sMsg=sMsg+IntToString(nGold)+" gold";
   SetCustomToken(92000,sMsg);
}