Posts: 9
Threads: 2
Joined: Apr 2020
Reputation:
0
Hey, I'm looking for help.
I found one thread bout loot dropping/sorting but it didnt work for me. Im probably doing something wrong.
So Im looking for 2 scripts.
First is simple I think - its moving items from backpack A to backpack B(picking up items from lootbag in depot) to sell.
Tried to do it with looter but it doesnt work in my own backpacks.
Its kinda exhausting to pick up about 100k oz items.
Second is dropping loot at hunt but to backpack on the floor.
I managed to drop items on the floor on specific SQMs in cavebot, but i have no idea how to make it drop all the items to backpack on the ground. Id like bot to open next bps during drops.
Anyone can help? |Only Registered members can see download links. | Click here to buy subscription or here to register.|Only Registered members can see download links. | Click here to buy subscription or here to register.alt="Smile" title="Smile" class="smilie smilie_1" />
Greetings
Posts: 2,948
Threads: 492
Joined: Jul 2018
Reputation:
84
Hello.
Sort items from backpack A to other backpacks B/C/D/...
local OpenNextBPs = true
local ITEMS_FROM_CONTAINER = 0 -- Index or container name. I recommend to use index because you may have many backpacks.
local ITEMS_DROP = {
{ Id = 2148, Destination = '1' }, -- Index or container name. I recommend to use index because you may have many backpacks.
{ Id = 1234, Destination = 'red backpack' },
{ Id = 4321, Destination = 'green backpack' },
}
local player_z = posz()
for _, item in ipairs(ITEMS_DROP) do
while itemcount(item.Id, ITEMS_FROM_CONTAINER) > 0 do
moveitems(item.Id, item.Destination, ITEMS_FROM_CONTAINER, 100)
end
end
if OpenNextBPs then
local containers = getcontainers()
local container_from_name = ''
local container_from_index = -1
if type(ITEMS_FROM_CONTAINER) == 'number' then
container_from_index = ITEMS_FROM_CONTAINER
elseif type(ITEMS_FROM_CONTAINER) == 'string' then
local temp_num = tonumber(ITEMS_FROM_CONTAINER)
if temp_num ~= nil then
container_from_index = temp_num
else
container_from_name = ITEMS_FROM_CONTAINER
end
end
for i = 1, #containers do
local container = containers[i]
if container.open and container.usedslots > 0 and (container.name == container_from_name or container.index == container_from_index) then
for j = 1, #container.items do
local item = container.items[j]
if item ~= nil then
if itemhasflags(item.id, 4) then
openitemslot(item.index, container.index, false)
wait(800, 1200)
break
end
end
end
elseif container.open and container.usedslots == 1 then
local item = container.items[1]
if item ~= nil then
if itemhasflags(item.id, 4) then
openitemslot(item.index, container.index, false)
wait(800, 1200)
break
end
end
end
end
end
Drop items inside a bag/backpack on the floor.
local ItemsDrop = { 'fish', 'battle shield', 'wooden shield' } -- Items that you wanna drop inside the container.
local BackpackLoot = 'Red Backpack' -- Backpack that you are carrying to keep loots, it will drop FROM this backpack.
local DropBagPosition = { X = 12345, Y = 54321, Z = 7 } -- Container's location that you wanna open and drop items inside.
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ CREDITS TO ARKILYS --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
local startWindowsCount = windowcount()
local currentWindowsCount = -1
for i = 0, 5 do
openitem(0, ground(DropBagPosition.X, DropBagPosition.Y, DropBagPosition.Z), true)
wait(1000)
currentWindowsCount = windowcount()
if currentWindowsCount > startWindowsCount then
break
end
end
if currentWindowsCount > startWindowsCount then
table.id(ItemsDrop)
local bagIndex = currentWindowsCount - 1
local bagContainer = getcontainer(bagIndex)
function tempOpenNextContainer(bagContainer)
local emptyLeft = bagContainer.maxslots - bagContainer.usedslots
while emptyLeft == 0 do
for _, bagItem in ipairs(bagContainer.items) do
if itemhasflags(bagItem.id, 4) then
openitem(bagItem.id, bagContainer.index)
wait(1000)
bagContainer = getcontainer(bagContainer.index)
if bagContainer ~= nil and bagContainer.maxslots ~= nil then
emptyLeft = bagContainer.maxslots - bagContainer.usedslots
break
else
return
end
end
emptyLeft = -1
end
end
if emptyLeft > 0 then
return bagContainer
else
return nil
end
end
bagContainer = tempOpenNextContainer(bagContainer)
if bagContainer ~= nil and bagContainer.maxslots ~= nil then
emptyLeft = bagContainer.maxslots - bagContainer.usedslots
if emptyLeft > 0 then
for i,j in ipairs(ItemsDrop) do
if table.find(ItemsDrop, j) ~= nil then
while itemcount(j, BackpackLoot) > 0 do
if emptyLeft == 0 then
bagContainer = tempOpenNextContainer(bagContainer)
if bagContainer ~= nil and bagContainer.maxslots ~= nil then
emptyLeft = bagContainer.maxslots - bagContainer.usedslots
end
end
moveitems(j, bagContainer.index, BackpackLoot, 100)
wait(300)
emptyLeft = emptyLeft - 1
end
end
end
end
end
end
Posts: 9
Threads: 2
Joined: Apr 2020
Reputation:
0
05-02-2020, 08:45 PM
(This post was last modified: 05-02-2020, 09:50 PM by Nyraens.)
I hadnt time yet to test first script, focused one second one.
It works great, thanks for help, but there's one little problem.
I edited script you sent, added it as "action" in cavebot and it drops all items to backpack on the ground except "longsword".
Any ideas why?
Below is script edited by me.
@EDIT
From time to time this script get stuck while tries to drop items to backpack on the ground. Most of times it happens while it has to open next backpack(there are 19 items in backpack and 20th is next, the same backpack to open). It opens backpack and gets stuck - doesnt continue to drop rest of items.
local ItemsDrop = { 'longsword', 'steel shield', 'serpent sword', 'steel helmet', 'double axe', 'crossbow', 'broadsword', 'plate legs' } -- Items that you wanna drop inside the container.
local BackpackLoot = 'Blue backpack', 'Blue backpack' -- Backpack that you are carrying to keep loots, it will drop FROM this backpack.
local DropBagPosition = { X = 32811, Y = 32155, Z = 7 } -- Container's location that you wanna open and drop items inside.
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ CREDITS TO ARKILYS --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
local startWindowsCount = windowcount()
local currentWindowsCount = -1
for i = 0, 5 do
openitem(0, ground(DropBagPosition.X, DropBagPosition.Y, DropBagPosition.Z), true)
wait(1000)
currentWindowsCount = windowcount()
if currentWindowsCount > startWindowsCount then
break
end
end
if currentWindowsCount > startWindowsCount then
table.id(ItemsDrop)
local bagIndex = currentWindowsCount - 1
local bagContainer = getcontainer(bagIndex)
function tempOpenNextContainer(bagContainer)
local emptyLeft = bagContainer.maxslots - bagContainer.usedslots
while emptyLeft == 0 do
for _, bagItem in ipairs(bagContainer.items) do
if itemhasflags(bagItem.id, 4) then
openitem(bagItem.id, bagContainer.index)
wait(1000)
bagContainer = getcontainer(bagContainer.index)
if bagContainer ~= nil and bagContainer.maxslots ~= nil then
emptyLeft = bagContainer.maxslots - bagContainer.usedslots
break
else
return
end
end
emptyLeft = -1
end
end
if emptyLeft > 0 then
return bagContainer
else
return nil
end
end
bagContainer = tempOpenNextContainer(bagContainer)
if bagContainer ~= nil and bagContainer.maxslots ~= nil then
emptyLeft = bagContainer.maxslots - bagContainer.usedslots
if emptyLeft > 0 then
for i,j in ipairs(ItemsDrop) do
if table.find(ItemsDrop, j) ~= nil then
while itemcount(j, BackpackLoot) > 0 do
if emptyLeft == 0 then
bagContainer = tempOpenNextContainer(bagContainer)
if bagContainer ~= nil and bagContainer.maxslots ~= nil then
emptyLeft = bagContainer.maxslots - bagContainer.usedslots
end
end
moveitems(j, bagContainer.index, BackpackLoot, 100)
wait(300)
emptyLeft = emptyLeft - 1
end
end
end
end
end
end
Posts: 2,948
Threads: 492
Joined: Jul 2018
Reputation:
84
Hello.
Try using longsword's id instead: 3285
I've applied some changes on code, but i didn't tested it at all.
local ItemsDrop = { 'fish', 'battle shield', 'wooden shield' } -- Items that you wanna drop inside the container.
local BackpackLoot = 'Red Backpack' -- Backpack that you are carrying to keep loots, it will drop FROM this backpack.
local DropBagPosition = { X = 12345, Y = 54321, Z = 7 } -- Container's location that you wanna open and drop items inside.
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ CREDITS TO ARKILYS --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
local startWindowsCount = windowcount()
local currentWindowsCount = -1
for i = 0, 5 do
openitem(0, ground(DropBagPosition.X, DropBagPosition.Y, DropBagPosition.Z), true)
wait(1000, 1200)
currentWindowsCount = windowcount()
if currentWindowsCount > startWindowsCount then
break
end
end
if currentWindowsCount > startWindowsCount then
table.id(ItemsDrop)
local bagIndex = currentWindowsCount - 1
local bagContainer = getcontainer(bagIndex)
if tempOpenNextContainer == nil then
function tempOpenNextContainer(bagContainer)
if bagContainer ~= nil and bagContainer.maxslots > 0 then
while (bagContainer.maxslots - bagContainer.usedslots) == 0 and bagContainer.maxslots > 0 do
local foundContainer = false
for _, bagItem in ipairs(bagContainer.items) do
if itemhasflags(bagItem.id, 4) then
foundContainer = true
openitem(bagItem.id, bagContainer.index)
wait(1200, 1500)
bagContainer = getcontainer(bagContainer.index)
end
end
if foundContainer == false then
break
end
end
end
return bagContainer
end
end
bagContainer = tempOpenNextContainer(bagContainer)
if bagContainer ~= nil and bagContainer.maxslots ~= nil then
emptyLeft = bagContainer.maxslots - bagContainer.usedslots
if emptyLeft > 0 then
for _, item in ipairs(ItemsDrop) do
while itemcount(item, BackpackLoot) > 0 do
if emptyLeft == 0 then
bagContainer = tempOpenNextContainer(bagContainer)
if bagContainer ~= nil and bagContainer.maxslots ~= nil then
emptyLeft = bagContainer.maxslots - bagContainer.usedslots
if emptyLeft == 0 then
break
end
end
end
moveitems(item, bagContainer.index, BackpackLoot, 100)
wait(300)
emptyLeft = emptyLeft - 1
end
if emptyLeft == 0 then
break
end
end
end
end
end
Posts: 9
Threads: 2
Joined: Apr 2020
Reputation:
0
I've just tried new code but its not working. It opens bp on the ground, but when its full it doesnt open next inside so it doesnt drop there anything.
I hope we find solution, its really important for me.
Greetings
Posts: 9
Threads: 2
Joined: Apr 2020
Reputation:
0
05-04-2020, 10:49 AM
Hey Arkilys,
Could you analize please what is wrong? I really need script like that so bad. |Only Registered members can see download links. | Click here to buy subscription or here to register.|Only Registered members can see download links. | Click here to buy subscription or here to register.alt="Confused" title="Confused" class="smilie smilie_13" />
Posts: 2,948
Threads: 492
Joined: Jul 2018
Reputation:
84
Hello.
I just fixed and tried this code, it worked.
local ItemsDrop = { 'dwarven shield', 'battle shield', 'halberd', 'wooden shield' } -- Items that you wanna drop inside the container.
local BackpackLoot = 'Red Backpack' -- Backpack that you are carrying to keep loots, it will drop FROM this backpack.
local DropBagPosition = { X = 12345, Y = 54321, Z = 6 } -- Container's location that you wanna open and drop items inside.
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ CREDITS TO ARKILYS --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
local startWindowsCount = windowcount()
local currentWindowsCount = -1
for i = 0, 5 do
openitem(0, ground(DropBagPosition.X, DropBagPosition.Y, DropBagPosition.Z), true)
wait(1000, 1200)
currentWindowsCount = windowcount()
if currentWindowsCount > startWindowsCount then
break
end
end
if currentWindowsCount > startWindowsCount then
table.id(ItemsDrop)
local bagIndex = currentWindowsCount - 1
local bagContainer = getcontainer(bagIndex)
if tempOpenNextContainer == nil then
function tempOpenNextContainer(bagContainer)
if bagContainer ~= nil and bagContainer.maxslots > 0 then
while bagContainer.maxslots == bagContainer.usedslots and bagContainer.maxslots > 0 do
local foundContainer = false
for _, bagItem in ipairs(bagContainer.items) do
if itemhasflags(bagItem.id, 4) then
foundContainer = true
openitem(bagItem.id, bagContainer.index)
wait(1200, 1500)
bagContainer = getcontainer(bagContainer.index)
break
end
end
if foundContainer == false then
break
end
end
end
return bagContainer
end
end
bagContainer = tempOpenNextContainer(bagContainer)
if bagContainer ~= nil and bagContainer.maxslots ~= nil then
emptyLeft = bagContainer.maxslots - bagContainer.usedslots
if emptyLeft > 0 then
for _, item in ipairs(ItemsDrop) do
while itemcount(item, BackpackLoot) > 0 do
if emptyLeft == 0 then
bagContainer = tempOpenNextContainer(getcontainer(bagContainer.index))
if bagContainer ~= nil and bagContainer.maxslots ~= nil then
emptyLeft = bagContainer.maxslots - bagContainer.usedslots
if emptyLeft == 0 then
break
end
end
end
moveitems(item, bagContainer.index, BackpackLoot, 100)
wait(300)
emptyLeft = emptyLeft - 1
end
end
end
end
end
Posts: 9
Threads: 2
Joined: Apr 2020
Reputation:
0
Great to hear. I'll test it as soon as possible ! |Only Registered members can see download links. | Click here to buy subscription or here to register.|Only Registered members can see download links. | Click here to buy subscription or here to register.alt="Smile" title="Smile" class="smilie smilie_1" />
Posts: 9
Threads: 2
Joined: Apr 2020
Reputation:
0
Awesome, it's working fine ! |Only Registered members can see download links. | Click here to buy subscription or here to register.|Only Registered members can see download links. | Click here to buy subscription or here to register.alt="Smile" title="Smile" class="smilie smilie_1" />
But still have one more question. During hunt I have opened brown backpack as main, 2 blue backpacks(for lootbag items), red backpack for gold, and another 8 brown backpacks on extra right panel with UHS to heal.
When bot used one bp of uhs i just manually threw it away on the ground, but since I did bot stopped dropping loot in backpack.
After i took it back and opened same as before it started working again.
Question - I guess I cant move my opened backpacks even if empty before i quit hunt? |Only Registered members can see download links. | Click here to buy subscription or here to register.|Only Registered members can see download links. | Click here to buy subscription or here to register.alt="Tongue" title="Tongue" class="smilie smilie_5" />
Posts: 9
Threads: 2
Joined: Apr 2020
Reputation:
0
Hey, I've just tried to test loot sorting script and it doesnt work. Can you look what is wrong?
|