Mellberg93
09-26-2012, 10:36 PM
Hello Xenobot forum and ya'll out there. I'm really new at xenobot and botin' over all, i've been using easy scripts only. But when my bot goes back to deposit cash, (gold coins) it opens a new backpack so it wont go back < so it keeps open new gold bp so i can loot, but in the end i can only loot 2k gold max. Is it possible to make the loot backpack close and re open from start after i deposited the gold /items? Thanks.
/ Mellberg93
Bushu
09-27-2012, 12:07 PM
Hello Xenobot forum and ya'll out there. I'm really new at xenobot and botin' over all, i've been using easy scripts only. But when my bot goes back to deposit cash, (gold coins) it opens a new backpack so it wont go back < so it keeps open new gold bp so i can loot, but in the end i can only loot 2k gold max. Is it possible to make the loot backpack close and re open from start after i deposited the gold /items? Thanks.
/ Mellberg93
Sure man, you just need to put a label in your script:
id's of backpacks(gold backpack combed, no need id of main bp but it have to be diffrent):
GoldBP = 9602 -- id of gold backpack
loot1 = 2854 -- id of first loot backpack
label:
elseif (labelName == "ResetBP") then
setWalkerEnabled(false)
closeBackpacks()
wait(500)
openBackpacks({GoldBP, 0}, {loot1, 0})
setWalkerEnabled(true)
wait(2000)
and at the very end of your script, after all ends:
function closeBackpacks(...)
local tmpBP = Container.GetFirst()
local cascaded = {...}
while tmpBP:isOpen() do
for spot = 0, tmpBP:ItemCount() do
local item = tmpBP:GetItemData(spot)
if item.id == tmpBP:ID() then
table.insert(cascaded, tmpBP:ID())
tmpBP = tmpBP:GetNext()
end
end
tmpBP = Container.GetFirst()
if not table.contains(cascaded, tmpBP:ID()) or tmpBP:ItemCount() == 0 then -- Backpack is main or last cascaded. Closing...
Self.UseItem(tmpBP:ID())
wait(500, 900)
end
if #cascaded > 0 then -- Any cascaded backpacks?
for i = 1, #cascaded do
if tmpBP:ID() == cascaded[i] then -- Found cascaded backpack.
if tmpBP:ItemCount() > 0 then -- Backpack contains atleast one item, check for anoter bp.
for spot = 0, tmpBP:ItemCount() do
local item = tmpBP:GetItemData(spot)
if item.id == tmpBP:ID() then -- Found anoter cascade bp, opening...
tmpBP:UseItem(spot)
break
end
end
end
end
end
end
wait(500, 900)
tmpBP = Container.GetFirst() -- Get a new bp to check.
if tmpBP:ID() == 0 then -- No more open backpacks.
print("All backpacks were successfully closed.")
end
end
return true
end
function openBackpacks(...) -- openBackpacks(id1, id2, id3)
Self.UseItem(Self.Backpack().id)
wait(1900, 3700)
for _, input in ipairs(arg) do
local Bp = Container.GetFromIndex(input[2])
for spot = 0, Bp:ItemCount() do
local item = Bp:GetItemData(spot)
if(item.id == input[1]) then
Bp:UseItem(spot)
break
end
end
wait(900, 1700)
end
end
Mellberg93
09-27-2012, 01:30 PM
Oh , i just tested it out and it worked very nice! Thanks alot man. :>
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.