//////////////////////////////////////////////////////////////////////////////// // rh_pl_bagclose - Close the bag and transfer it's contents // By Deva B. Winblood. November 12th, 2008 //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////// // FUNCTIONS //////////////////////////////////// void fnTransferGoods(object oSource,object oDestination,int bDestroy=FALSE) { // PURPOSE: Transfer goods object oItem; object oCopy; oItem=GetFirstItemInInventory(oSource); while(GetIsObjectValid(oItem)) { // transfer oCopy=CopyItem(oItem,oDestination,TRUE); DelayCommand(0.5,DestroyObject(oItem)); oItem=GetNextItemInInventory(oSource); } // transfer if (bDestroy) DelayCommand(1.0,DestroyObject(oSource)); } // fnTransferGoods() //////////////////////////////////////////////////////////////////////[ MAIN ]// void main() { object oMe=OBJECT_SELF; object oOwner=GetLocalObject(oMe,"oOwner"); object oStorage=GetLocalObject(oMe,"oStorage"); if (!GetIsObjectValid(oStorage)) SendMessageToPC(oOwner,"ERROR rh_pl_bagclose - The Storage object is missing."); SendMessageToPC(oOwner,"Closing Other World Bag of Holding..."); DeleteLocalInt(oOwner,"bBagOpening"); fnTransferGoods(oMe,oStorage,TRUE); }