----------------------------------------------------------------------------------- Put an item into a free bag slot---------------------------------------------------------------------------------function BagItem(freeBagSpacesUsed, backwards) if (not freeBagSpacesUsed) then freeBagSpacesUsed = {}; end local firstBag, lastBag, inc; if (backwards) then firstBag = 4 lastBag = 1; inc = -1; else firstBag = 0 lastBag = 4; inc = 1; end -- for each bag and slot for theBag = firstBag, lastBag, inc do local numSlot = GetContainerNumSlots(theBag); for theSlot = 1, numSlot do -- get info about the item here local texture, itemCount, locked = GetContainerItemInfo(theBag, theSlot); -- if we found nothing, add us to the list of free bag slots if (not texture and not Wardrobe.UsedThisSlot(freeBagSpacesUsed, theBag, theSlot)) then PickupContainerItem(theBag,theSlot); table.insert(freeBagSpacesUsed, {theBag, theSlot}); return true, freeBagSpacesUsed; end end end AutoEquipCursorItem(); return false, freeBagSpacesUsed;end