View Full Version : Open backpack failure
Flummer
09-17-2012, 06:45 AM
Hello! =)
i have trouble with this, sometimes the backpacks not resets, the bot only open the main backpack for me.
This is the script i use
dofile("Forgee.lua")
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
if (labelName == "ResetBackpacks") then
setWalkerEnabled(false)
resetBackpacks()
setWalkerEnabled(true)
end
end
Bushu
09-17-2012, 10:32 AM
Check this one:
GoldBP = 2871 -- id of gold backpack(2nd bp in looter)
loot1 = 9602 -- id of first loot backpack(3rd bp in looter)
loot2 = 2870 --id of second loot backpack(4th bp in looter)
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
if (labelName == "ResetBP") then
setWalkerEnabled(false)
closeBackpacks()
wait(500)
openBackpacks({GoldBP, 0}, {loot1, 0}, {loot2, 0})
setWalkerEnabled(true)
wait(2000)
end
end
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
Credits to Forgee
Yasje
09-17-2012, 01:09 PM
dofile("Forgee.lua")
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
if (labelName == "ResetBackpacks") then
setWalkerEnabled(false)
resetBackpacks()
setWalkerEnabled(true)
end
put in in script with the other codes
it should be fine actually, and use onlu 1x dofile forgee.lua and update the forgee library
Flummer
09-17-2012, 01:47 PM
dofile("Forgee.lua")
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
if (labelName == "ResetBackpacks") then
setWalkerEnabled(false)
resetBackpacks()
setWalkerEnabled(true)
end
put in in script with the other codes
it should be fine actually, and use onlu 1x dofile forgee.lua and update the forgee library
using this one right now and it only open the main backback for me... really don't know whats the problem is :/ maybe cus i dont open tibia as admin ?
Luque
09-17-2012, 02:03 PM
using this one right now and it only open the main backback for me... really don't know whats the problem is :/ maybe cus i dont open tibia as admin ?
You should open it as admin, and maby you have to change some id's in your .lua cause he might open wrong backpack and read scripts carefully cause some scripts you need different kind of backpacks.
Flummer
09-17-2012, 02:16 PM
with the forgee lua i don't have to use the id's or do i ? :o
Forgee
09-17-2012, 03:14 PM
Nope, you don't need to use ids with resetBackpacks(). Make sure that backpacks which are stacked inside each other is all the same color.
Here is an example (click for larger image):
3937
Crown Royal
09-17-2012, 04:22 PM
Also, this is not needed...
elseif (labelName == "ResetBP") then
setWalkerEnabled(false)
resetBackpacks()
setWalkerEnabled(true)
Use this instead.. Will save time, Forgee already implimented this stuff into his library, so you dont need to use waits, or set your walker false/true.
elseif (labelName == "ResetBP") then
resetBackpacks()
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.