@Dehan
Action Dehan --> https://forums.tibiawindbot.com/show...Box-Withdrawer
Credits continue to Dehan for doing this great deed. I just simplified it to be used in a cavebot action (if you put the function in the persistent cavebot action will be very simple).
I made this function with the purpose of taking as many different items as I want from the depot box, without having to rewrite the action several times or modify it.
You can take several different items and from any depot box, just write a new line and configure it correctly.
Function information...
withdrawDP(item,numberItem, locationMove, numberDP)
(name item, amount item, place that will move the item, number of the depot box you want to remove the item from)
There are 2 ways to use it...
--==Options 1 ==--
--All in 1 action cavebot--
1- create action cavebot then paste all action in action cavebot.
Example in use, line 49 in action.
getlootingdestination('Destination Name'), Looting > Seetings > Looting Destinations...
example:
-Destination Name: mainbp
+
Destination: green backpack
=
getlootingdestination('mainbp'), will move the item to the green backpack.
--[[DO NOT EDIT LINE 2-47]]--
function withdrawDP(item, numberItem, locationMove, numberDP)
local checkDpOpened = true
if checkDpOpened then
closewindows('locker', true)
waitping()
closewindows('depot chest', true)
waitping()
closewindows('depot', true)
waitping()
end
local ItemName = item
local ItemMax = numberItem
local BptoMove = locationMove
local depotBoxNumber = numberDP
--[[DO NOT EDIT BELOW THIS LINE]]--
while windowcount("Depot Chest") == 0 do
opendepot(true)
wait(1000)
openitem(3502)
wait(1000)
end
local BpFrom = "depot chest"
local depotId = 22796
local itemDepotId = depotId + depotBoxNumber
while itemcount(22797) > 0 do
openitem(itemDepotId, "depot chest", false)
wait(1000)
end
for i = 1, getcontainer("depot chest").lastpage do
moveTry = 0
while moveTry < 10 and (ItemMax - itemcount(ItemName,BptoMove) > 0) and (itemcount(ItemName, BpFrom) > 0) and getcontainer(BptoMove).emptycount > 1 do
moveitems(ItemName, BptoMove, BpFrom,ItemMax - itemcount(ItemName,BptoMove))
wait(200)
moveTry = moveTry + 1
end
if getcontainer("depot chest").itemcount > 32 then
nextpage("depot chest")
wait(200,400)
end
end
end
--[[DO EDIT LINE 2-47]]--
reachgrounditem("depot")
withdrawDP('crystalline arrow', 1000, getlootingdestination('supplybp'), 1)
withdrawDP('brown mushroom', 100, getlootingdestination('mainbp'), 1)
--==Option 2==--
--Function Persistent--
1- Create a Persistent, any name.
2- Paste in Persistent function.
--[[DO NOT EDIT LINE 2-47]]--
function withdrawDP(item, numberItem, locationMove, numberDP)
local checkDpOpened = true
if checkDpOpened then
closewindows('locker', true)
waitping()
closewindows('depot chest', true)
waitping()
closewindows('depot', true)
waitping()
end
local ItemName = item
local ItemMax = numberItem
local BptoMove = locationMove
local depotBoxNumber = numberDP
--[[DO NOT EDIT BELOW THIS LINE]]--
while windowcount("Depot Chest") == 0 do
opendepot(true)
wait(1000)
openitem(3502)
wait(1000)
end
local BpFrom = "depot chest"
local depotId = 22796
local itemDepotId = depotId + depotBoxNumber
while itemcount(22797) > 0 do
openitem(itemDepotId, "depot chest", false)
wait(1000)
end
for i = 1, getcontainer("depot chest").lastpage do
moveTry = 0
while moveTry < 10 and (ItemMax - itemcount(ItemName,BptoMove) > 0) and (itemcount(ItemName, BpFrom) > 0) and getcontainer(BptoMove).emptycount > 1 do
moveitems(ItemName, BptoMove, BpFrom,ItemMax - itemcount(ItemName,BptoMove))
wait(200)
moveTry = moveTry + 1
end
if getcontainer("depot chest").itemcount > 32 then
nextpage("depot chest")
wait(200,400)
end
end
end
3- Activate this persistent, changing to "yes".
4- Your action cavebot.
reachgrounditem("depot")
withdrawDP('crystalline arrow', 1000, getlootingdestination('supplybp'), 1)
withdrawDP('brown mushroom', 100, getlootingdestination('mainbp'), 1)