Log in

View Full Version : help please



gondacki
12-23-2012, 01:35 AM
need help with funtionably backpack reset like that: it's error


registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(BP)
local func = loadstring(Bp)
if(func)then func()
end
end

--BACKPACK OPENER--

function closeBackpacks(...) -- CREDITS TO FORGEE
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(2869, 5949, 2871)
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

function bpOpen()
setWalkerEnabled(false)
closeBackpacks()
wait(500)
openBackpacks({Blue Backpack, 0}, {Golden Backpack, 0}, {Grey Backpack, 0}) -- brocade Backpack, Brocade Backpack
setWalkerEnabled(true)
end

gondacki
12-23-2012, 03:09 PM
please, someone can help with this? I need a working "Reset Backpack"

Infernal Bolt
12-23-2012, 03:29 PM
wtf are you doing? XD
what do you want it to do?

soul4soul
12-23-2012, 03:38 PM
in the bpOpen function you need to use itemids not item names replace blue, golden, grey bp with their item ids. Make sure your label is called bpOpen. For the future you might as well use dofile("forgee.lua") instead of copy pasting his functions. Keep in mind if your using an item name you need to use "" quotes which you didnt do either "blue backpack" not blue backpack.

Bomasz
12-23-2012, 05:12 PM
Or just use:

dofile("Forgee.lua)
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

if (labelName == "Reset") then
setWalkerEnabled(false)
wait(300,500)
resetBackpacks()
wait(300,500)
setWalkerEnabled(true)
end

Xeromex
12-23-2012, 05:19 PM
Or use this one, because I don't like resetBackpacks()

-- BP Opener
local GoldBP = "Red Backpack" -- Name of Gold Backpack
local LootBP = "Blue Backpack" -- Name of Loot Backpack
And label;

elseif (labelName == "bpOpen") then
setWalkerEnabled(false)
Self.CloseContainers()
repeat
wait(900)
until (Self.UseItemFromEquipment("backpack") > 0)
wait (1000)
Container.GetFirst():OpenChildren(Item.GetID(GoldB P), Item.GetID(LootBP))
setWalkerEnabled(true)