So i just make this action for my friend but seems like many people still have problems with withdrawing so I'm giving it to public
Let me know if you will find anything wrong.
The things you need to do to make it work are:
1. Go to supply tab
2. Add all needed supplies that you would like to withdraw.
3. Setup to each of them a category rule value and destination. (if you wish taking item directly to your equipment slot just put it's object string representation like: 'rhand')
(rules available are UpToCount or DownToCap)
After doing all mentioned above you can paste the script and setup it's variables which are:
- category: category of item from supply list (you can combine multiple categories i.e: 'abc')
- depotNumber: as the name says, number of depot from where you're gonna take the stuff
-- SCRIPT VERSION: 1.0.1
local category = 'a'
local depotNumber = 3
-- DO NOT EDIT ANYTHING BELOW
local function isDepotBoxOpen(index) -- little workaround.. (depots are still bugged)
local name, cont = itemname(depotindextoid(index)):lower()
for i = 15, 0, -1 do
cont = getcontainer(i)
if cont.name:lower() == name and cont.isopen then
return true
end
end
return false
end
local depotName = itemname(depotindextoid(depotNumber))
while not isDepotBoxOpen(depotNumber) do
if windowcount('depot chest') > 0 then
openitem(depotName)
waitping()
else
opendepot(depotNumber)
waitping()
end
end
local RULE_DOWN_TO_CAP = 2
local function getAmountNeeded(s)
local amount = s.uptocount - itemcount(s.id, s.destination)
if s.rule == RULE_DOWN_TO_CAP then
amount = math.floor(($cap - s.rulevalue) / s.weight)
end
return amount
end
local needMoreItems = false
while true do
foreach supplyitem s category do
local amount = getAmountNeeded(s)
while amount > 0 and itemcount(s.id, depotName) > 0 do
moveitems(s.id, s.destination, depotName, amount)
waitping()
amount = getAmountNeeded(s)
end
needMoreItems = amount > 0
end
local depotCont = getcontainer(depotName)
local hasNextPage = depotCont.itemcount >= depotCont.maxcount
if needMoreItems and hasNextPage then
nextpage(depotCont.name)
waitping()
else
break
end
waitping()
end