Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- macro(300, "Backpack Sorting", function()
- local lootbpitems = {3349, 3425}
- local mainBp = 5801
- local lootBp = 2869
- --Don't edit below this line
- --If backpack is full, this will open next backpack of same type
- --For every container open, get information on open containers
- for i, container in pairs(getContainers()) do
- --Get the IDs of every open container
- containerItemId = container:getContainerItem():getId()
- --If the containerItemID is equal to lootBp ID then
- if containerItemId == lootBp then
- --If the amount of items in the container is equal to the max capacity of the container then
- if container:getItemsCount() == container:getCapacity() then
- --Search every item ID in the container
- for _, item in ipairs(container:getItems()) do
- --If one of the items in the container is equal to your backpack id, then
- if item:isContainer() then
- --Open up the backpack
- g_game.open(item, container)
- end
- end
- end
- end
- end
- --For every container open, get information on open containers
- for i, container in pairs(getContainers()) do
- --Get the IDs of every open container
- containerItemId = container:getContainerItem():getId()
- --If the containerItemId is equal to mainBp ID then
- if containerItemId == mainBp then
- --For every item in you mainBP do
- for j, item in ipairs(container:getItems()) do
- --Get item ID of every item in mainBP
- local itemValue = item:getId()
- --If you find an ID in your mainBP that matches lootbpitems then
- if table.find(lootbpitems, item:getId()) then
- local foundItem = item
- --loop through open containers to look for lootBp
- for i, depotcontainer in pairs(getContainers()) do
- containerItemId = depotcontainer:getContainerItem():getId()
- --If you find lootBP then
- if containerItemId == lootBp then
- --loop through the item IDs in your mainBP
- for l, depotbox in ipairs(depotcontainer:getItems()) do
- --Move found item ID to 19th slot of loot backpack, this is to avoid moving items into backpack within lootbackpack
- g_game.move(foundItem, depotcontainer:getSlotPosition(19), foundItem:getCount())
- return
- end
- end
- end
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement