1
2
3
Example using same parameter from screenshots, to fill function, be creative to make ur own.
example 1:
store items and withdraw items at same time
depotbox({'store',{'lootbp',{'depot1', 'i', 'depot2', 's'}}}, {'withdraw', {'depot2',{'supplybp','rp', 'mainbp','f'}}})
example 2:
only store items
depotbox({'store',{'lootbp',{'depot1', 'i', 'depot2', 's'}}})
example 3:
only withdraw items
depotbox({'withdraw', {'depot2',{'supplybp','rp', 'mainbp','f'}}})
default example:
depotbox({'store', {'bpToTakeItems', {'DepotNumber', 'CategoryOfItems', ...}}})
depotbox({'withdraw',{'DepotNumber',{'bpToPutItems', 'CategoryItems', ...}}})
depotbox({'store', {'bpToTakeItems', {'DepotNumber', 'CategoryOfItems', ...}}}, {'withdraw',{'DepotNumber',{'bpToPutItems', 'CategoryItems', ...}}})
depotbox({'withdraw',{'DepotNumber',{'bpToPutItems', 'CategoryItems', ...}}}, {'store', {'bpToTakeItems', {'DepotNumber', 'CategoryOfItems', ...}}})
main function:
function depotbox(...)
local function depotidnumber(num)
local num = tonumber(num)
if type(num) == 'number' and (num <= 17 and num > 0) then
return (22796 + num)
else
printerror('please provide valid number')
return false
end
end
local function nextpagesupplt(splycat, bpsupply)
foreach supplyitem m splycat do
if itemcount(iteminfo(m.id).name, bpsupply) < m.uptocount then
return true
end
end
return false
end
--{'lootbp', {'depoNumber', 'category', ...}}
local function storedepot(frombp, depotnumberandcategory)
local lootbp = getlootingdestination(frombp)
local tablesecond = depotnumberandcategory
if lootbp == ('' or nil) or not iteminfo(lootbp).iscontainer then
printerror('go google correct backpacks names, ffs store')
return false
elseif windowcount(frombp) == 0 then
printerror('tard or retard, from where am i suppost to take itemsw bp')
return false
elseif (#tablesecond % 2) == 1 then
printerror('am i speaking to wall, provide even number of elements, store')
return false
else
for i = 1, #tablesecond, 2 do
if type(tablesecond[i]) ~= 'string' or type(tablesecond[i+1]) ~= 'string' then
printerror('ask forum admit why u\'re dump, only strings, store')
return false
end
end
end
local id = itemid(lootbp)
for i = 0, 15 do
local cont = getcontainer(i)
if cont.itemid == id and cont.isopen then
while cont.itemid == id and cont.isopen do
for j = 1, #tablesecond, 2 do
local depotbox = depotidnumber(getlootingdestination(tablesecond[j]))
local category = tablesecond[j+1]
foreach lootingitem m category do
local itemdata = iteminfo(m.id)
local dstindex = 0
if not itemdata.iscumulative then
dstindex = $lastonto
end
setlifetime(30000)
moveitemsonto(m.id, depotbox, dstindex, '')
end
end
if cont.hashigher then
higherwindows(i, true) waitping(2,5)
end
end
repeat
openitem(id, i, false)
until cont.itemid == id or not cont.isopen or itemcount(id,i) == 0
return true
end
end
end
--'depot box number',{'otherbp', 'category', ...}})
local function withdrawdepot(depotnum, otherbpandcategory)
local depotnum = depotidnumber(getlootingdestination(depotnum))
local tablesecond = otherbpandcategory
if depotnum == ('' or nil) then
printerror('1+1 isn\'t 10 so learn basic elementary numbers, withdraw')
return false
elseif (#tablesecond % 2) == 1 then
printerror('am i speaking to wall, provide even number of elements, withdraw')
return false
else
for i = 1, #tablesecond, 2 do
if type(tablesecond[i]) ~= 'string' or type(tablesecond[i+1]) ~= 'string' then
printerror('ask forum admit why u\'re dump, only strings, store')
return false
end
end
end
local openbox = iteminfo(depotnum)
local depotchest = iteminfo(3502)
local depotbox = getcontainer(depotchest.name)
repeat
openitem(openbox.name, depotbox.index, false)
until depotbox.itemid == openbox.id or not depotbox.isopen or itemcount(openbox.name) == 0
for i = 0, 15 do
local cont = getcontainer(i)
if cont.itemid == openbox.id and cont.isopen then
while cont.itemid == openbox.id and cont.isopen do
for j = 1, #tablesecond, 2 do
local otherbp = getcontainer(getlootingdestination(tablesecond[j]))
local category = tablesecond[j+1]
if not otherbp.isopen then
printerror('tard or retard, from where am i suppost to put items, keep it open, withdraw')
return false
end
for k = 1, cont.lastpage do
foreach supplyitem m category do
local itemdata = iteminfo(m.id)
while otherbp.emptycount and itemcount(itemdata.name, otherbp.name) < m.uptocount and itemcount(itemdata.name, cont.name) > 0 do
quantity = m.uptocount - itemcount(itemdata.name, otherbp.name)
moveitems(itemdata.name, otherbp.name, cont.name, quantity) waitping(2,5)
end
end
if cont.ispage and cont.lastpage > cont.curpage and nextpagesupplt(category, otherbp.name) then
nextpage(cont.name) waitping(2,5)
else
changepage(cont.name, 1) waitping(2,5)
end
end
end
if cont.hashigher then
higherwindows(cont.name, true) waitping(2,5)
end
end
return true
end
end
end
local args = {...}
if #args == 0 then
printerror('You didn\'t provide valid number of actions.')
return false
end
local oldopenbp = getsetting('Looting/OpenNextBP')
setsetting('Looting/OpenNextBP', 'no')
repeat
opendepot(true) waitping(2,5)
openitem(3502, 'Locker', false) waitping(2,5)
until windowcount(iteminfo(3502).name) > 0
for i = 1, #args do
for j = 1, #args[i], 2 do
if args[i][1] == 'store' then
storedepot(args[i][2][j], args[i][2][j+1])
elseif args[i][1] == 'withdraw' then
withdrawdepot(args[i][2][j], args[i][2][j+1])
else
printerror('invalid command for depot')
return false
end
end
end
setsetting('Looting/OpenNextBP', oldopenbp)
end
have fun