Hello,
For my needs i changed this script to fit my needs: To pass array of backpacks and deposit all items at once.
Here is my script feel free to use
Core Credits @Dehan
In this script i also use my backpacks reseter - it works really well so also feel free to use. It was also core-changing from someone from here, if Ill found from where i got this I'll edit and add credits to author.
Here is the code:
PHP Code:
-----------------------------------------------------------------------------------
-- Restarts backpacks passed in 'backpacks' parameter.
-- param backpacks: array of backpacks names from settings.
-- @example: restart_backpacks({'rare', 'stackable', 'gold', 'supplies'})
function restart_backpacks(backpacks)
local main_backpack
closewindows()
main_backpack = openitem(0, 'back') wait(500,1000)
resizewindows(0, '0') wait(500,1000)
for index, backpack in ipairs(backpacks) do
openitem(getlootingdestination(backpack), main_backpack, true) wait(500,1000)
resizewindows(0, string.format("%s", index)) wait(500,1000)
end
end
-----------------------------------------------------------------------------------
-- Deposits loot items from backpacks passed in 'bp_destination_names' param.
-- param bp_destination_names: array of backpacks names from settings.
-- param stackable: Depot Index for stackables - if not passed function will set 1 as default.
-- param non_stackable: Depot Index for non stackables - if not passed function will set 2 as default.
-- @example: deposit_loot_items({'rare', 'stackable', 'another_backpack'}, 3, 4)
function deposit_loot_items(bp_destination_names, stackable, non_stackable)
local depot_id = 22796
local stackable = stackable or 1
local non_stackable = non_stackable or 2
local stackable_id = depot_id + stackable
local nonstackable_id = depot_id + non_stackable
local settings_backup = getsetting('Looting/OpenNextBP')
-- If OpenNextBP is on turn it off.
setsetting('Looting/OpenNextBP', 'no') waitping()
restart_backpacks(bp_destination_names)
-- Reach and open depot.
while windowcount("Depot Chest") == 0 do
opendepot(true) wait(300)
openitem(3502) wait(500)
end
for _, backpack in ipairs(bp_destination_names) do
-- Retrieve backpack object.
backpack = getlootingdestination(backpack)
while true do
foreach lootingitem item do
-- When found looting object in current backpack move it.
while itemcount(item.id, backpack) > 0 do
chosen_destination = itemproperty(item.id, ITEM_STACKABLE) and stackable_id or nonstackable_id
-- Move items to chosen destination.
moveitemsonto(item.id, chosen_destination, 1, 'depot chest', backpack, 100)
end
end
-- If found cascaded backpack inside - open it.
if (itemcount(backpack, backpack) > 0) then
openitem(backpack, backpack, false)
waitcontainer(backpack, false)
else
break
end
end
end
-- Revert Looting/OpenNextBP settings.
setsetting('Looting/OpenNextBP', settings_backup)
end