Log in

View Full Version : Scripting help :)



Mony
03-04-2016, 03:37 PM
Hey all,

I was wondering if I could ask for a little scripting help. I am trying to withdraw items from the Depot Box I to my backpack until i hit 100 cap and then i would like it to start walking again. I've mashed the following together from quite a few scripts others work. I've forgotten the names but would like to say right now thanks and I'm not trying to claim your work as my own :).

I have three issues, in bold, it opens up the depot on screen and you get to locker, it then opens depot chest but not the depot box I. This works and then doesnt, works and then doesnt.
The MinCap doesnt seem to be working. (FIXED)
When it does actually start to withdraw items, it stops half way for no reason like i have 900 cap left.
This has worked once and then just stopped again for no reason, I have no clue how or why that happened as i noted down all changes before and after.


function withdraw()
Walker.Stop()
Self.CloseContainers()
wait(300, 1200)
Self.OpenMainBackpack(true):OpenChildren({"Golden Backpack", true})
wait(300, 1200)
Container.GetFirst():Minimize()
wait(300, 1200)
Self.OpenLocker()
wait(300, 1200)
local contfrom = Container.New('Depot Box I')
local contto = Container.New(container)
while not contfrom:isOpen() do
contfrom = Container.New('Depot Box I')
local dp = Container.New('Locker')
for mailspot, touse in dp:iItems() do
if touse.id == 3502 then
dp:UseItem(mailspot, true)
wait(100, 150)
end
end
end
print("do sprawdzenia".. contfrom:ItemCount())
local DestinationBp = Container.GetByName("Golden Backpack")
for spot = 0, contfrom:ItemCount() do
local item = contfrom:GetItemData(spot)
if Self.Cap() < MinCap then
Walker.Start()
break
end
if(DestinationBp:ItemCount() == DestinationBp:ItemCapacity()) then --opens the next container
local openAt = DestinationBp:ItemCount() - 1
if (Item.isContainer(DestinationBp:GetItemData(openAt ).id)) then
DestinationBp:UseItem(openAt, true)
wait(500)
else
Walker.Start()
break
end
end
print("Dodany: "..spot.. " "..DestinationBp:Index().. " ".. DestinationBp:ItemCapacity() -1)
wait(250,400)
contfrom:MoveItemToContainer(spot, DestinationBp:Index(), DestinationBp:ItemCapacity() - 1)
wait(500,550)
end
Walker.Start()
end


Thanks a lot.

marcosfilho
03-31-2016, 03:06 AM
https://mega.nz/#F!mscxwSbK

albaxin
04-06-2016, 10:16 AM
Ban marcosfilho I think he's posting virus links

yompa93
05-03-2016, 02:37 PM
This might work, cooked somethin together :confused:



mPots = Item.GetID("mana potion")
bp = "blue backpack"

registerEventListener(WALKER_SELECTLABEL, "onLabel")
function onLabel(label)
if (label == "Withdraw") then
WeightWithdraw(0, bp, mPots, 10, 50)
-- withdrawing from dp slot 0 - into blue backpack - items being withdrawn is mana pots -
-- amount to withdraw each time is 10 - and finally it will withdraw until the cap is 50 or below.
end
end

function WeightWithdraw(DepoSlot, toCont, item, amount, cap)
while Self.Cap() > cap do
local depot = Self.OpenDepot()
depot:Minimize()
if (Item.isContainer(depot:GetItemData(DepoSlot).id)) then
while (depot:UseItem(DepoSlot) ~= 1) do
wait(100)
end
wait(Self.Ping() + 300)
end
local c = Container.GetLast()
Container.Minimize(c)
if c:isOpen() then
while Self.Cap() > cap do
if c:CountItemsOfID(item) > 0 then
local toContainer = Container.New(toCont)
if c:GetItemData(spot).id == item then
fromSpot = c:GetItemData(spot).id == item
c:MoveItemToContainer(fromSpot, toContainer:Index(), toContainer:ItemCapacity()-1, amount)
wait(800, 1200)
end
end
end
end
end
end