XenoBot Forums - Powered by vBulletin

User Tag List

Results 1 to 6 of 6

Thread: [REQUEST] New Depo Script

  1. #1

    Join Date
    Sep 2013
    Posts
    89
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    [REQUEST] New Depo Script

    Hello!!

    Anybody got script which still I need backpacks? For example bot open first depo box, they try to find out backpacks?

    I really need it ^^
    @DarkstaR, @Joshwa534, I think it is good idea to make those, for example: Self.DepositItems2(NumberToWhichDepoItShouldGo, {3079, 1}, {8084, 2} ...)
    Last edited by IKillYou; 01-31-2016 at 08:22 PM.

  2. #2

    Join Date
    Sep 2013
    Posts
    89
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Bump ....

  3. #3

    Join Date
    Sep 2013
    Posts
    89
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Sory for double post, but I don't know if by doing @shadowart my mention will be effective.
    @shadowart, Can you make new depo scripter, which I mention above? You make some good script and changing this little thing shouldn't be hard for you. Even you can make it simplier for example set that on first depo it will be depositing items, that's all. Thanks in advance )

  4. #4
    Lifetime Subscriber L!p3's Avatar
    Join Date
    Dec 2011
    Location
    Brazil
    Posts
    157
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    lua code:
    function Self.DepositItems2(DPBox, ...)
    if (#arg > 0) then setBotEnabled(false) end
    local depositInfo = {}

    function makeDepositInfo(input)
    local ret = {}
    for i = 1, #input do
    local data = input[i]
    local spot = 0
    local id = 0
    if (type(data) == 'table') then
    spot = data[2]
    id = Item.GetItemIDFromDualInput(data[1])
    else
    spot = 0
    id = Item.GetItemIDFromDualInput(data)
    end

    if (not ret[spot]) then
    ret[spot] = {}
    ret[spot].realIndex = -1
    ret[spot].items = {}
    end
    table.insert(ret[spot].items, id)
    end
    return ret
    end

    if (#arg > 0) then
    depositInfo = makeDepositInfo(arg)
    else
    local _input = getDepositorList()
    local _realInput = {}
    for i = 1, #_input, 2 do
    local tempInput = {}
    tempInput[1] = _input[i]
    tempInput[2] = _input[i+1]
    table.insert(_realInput, tempInput)
    end
    depositInfo = makeDepositInfo(_realInput)
    end


    local indexes = Container.GetAll() -- list of containers open before we start depositing
    local depot = Self.OpenDepot()
    local badIndexes = #indexes == 0
    if (badIndexes or not depot) then
    if (badIndexes) then
    print("XenoBot: Unable to find open backpacks to deposit from.")
    else
    print("XenoBot: Depositor failed to open depot.")
    end
    if (#arg > 0) then setBotEnabled(true) end
    return false
    end

    depot:Minimize()

    for i = 0, depot:ItemCount()-1 do
    if (depot:GetItemData(i).id == 22796 + DPBox) then
    depot:UseItem(i, true) wait(Self.Ping() * 2, Self.Ping() * 3)
    end
    end

    for spot, data in pairs(depositInfo) do -- loop to open all the needed backpacks
    local currentSpot = 0
    for i = 0, depot:ItemCount() - 1 do -- search all items in the depot
    if (Item.isContainer(depot:GetItemData(i).id)) then -- only consider containers
    if (currentSpot == spot) then -- should we open this?
    data.realIndex = Container.GetFreeSlot()
    while (depot:UseItem(spot) ~= 1) do
    wait(100)
    end
    wait(Self.Ping() + 300)
    Container.Minimize(data.realIndex)
    end
    currentSpot = currentSpot + 1 -- increment
    end
    end
    end
    local tempDepositInfo = {} -- warn about and get rid of all depot backpacks which cant be opened
    for spot, data in pairs(depositInfo) do
    if (data.realIndex ~= -1) then
    tempDepositInfo[spot] = data
    else
    print("XenoBot: Depositor is missing a container in depot slot #" .. spot .. ". Please place cascading containers at the required slot in your depot.")
    end
    end
    depositInfo = tempDepositInfo
    function depositItem(depositInfo, contFrom, spot) --when this returns true, we skip the item because we cant deposit it
    local currentItem = contFrom:GetItemData(spot)
    for _, data in pairs(depositInfo) do -- loop through all of our deposit items
    if (table.contains(data.items, currentItem.id)) then -- should we deposit this specific one? try
    local depositBp = Container.New(data.realIndex)
    if (not depositBp:isOpen()) then -- dest container not open, skip this item
    return true
    end
    if (depositBp:ItemCount() < depositBp:ItemCapacity()) then -- if the backpack isn't full, let's use the final slot
    contFrom:MoveItemToContainer(spot, data.realIndex, depositBp:ItemCapacity() - 1)
    return false
    elseif (depositBp:ID() >= 22797 and depositBp:ID() <= 22813) then
    contFrom:MoveItemToContainer(spot, data.realIndex, math.random(0, 3))
    return false
    else -- its full, lets either open the next one or find a good spot
    local toSpot = -1 -- fine the best place to put it if we can still fit it
    for sp = 0, depositBp:ItemCount() - 1 do
    local spData = depositBp:GetItemData(sp)
    if (spData.id == currentItem.id and spData.count ~= 100) then
    toSpot = sp
    end
    end
    if (not Item.isStackable(currentItem.id) or toSpot == -1) then -- no room for this, open a new container
    if (not Item.isContainer(depositBp:GetItemData(depositBp:ItemCapacity() - 1).id)) then -- cant open this container, continue to the next item
    if (not data.warned) then
    data.warned = true
    print("XenoBot: Depositor is unable to find room in deposit container #" .. data.realIndex .. ".")
    end
    return true
    end
    depositBp:UseItem(depositBp:ItemCapacity() - 1, true)
    return false
    else -- there's at least some room, lets fill it up
    contFrom:MoveItemToContainer(spot, data.realIndex, toSpot)
    return false
    end
    end
    end
    end
    return true
    end
    function depositItems(depositInfo, indexes)
    local containers = {}
    for _, index in ipairs(indexes) do -- actually deposit now
    local container = Container.New(index)
    if (container:isOpen()) then
    local checkSpot = 0
    while (checkSpot < container:ItemCount()) do -- loop until no more items to deposit
    if (depositItem(depositInfo, container, checkSpot)) then
    checkSpot = checkSpot + 1 -- if we cant deposit this, skip it
    else
    if (containers[index] == nil) then containers[index] = 0 end
    containers[index] = containers[index] + 1
    wait(300, 700)
    end
    end
    end
    end
    return containers
    end
    -- deposit items, cascading into new backpacks
    local cascadedBps = {}
    while (true) do
    local cascades = depositItems(depositInfo, indexes)
    wait(Self.Ping() + 200)

    local opened = false
    for index, count in pairs(cascades) do
    if (count > 0) then
    local cont = Container.New(index)
    local lastItem = cont:GetItemData(cont:ItemCount() - 1)
    if (Item.isContainer(lastItem.id)) then
    if (cascadedBps[index] == nil) then cascadedBps[index] = 0 end
    repeat
    wait(Self.Ping() + 700)
    until (cont:UseItem(cont:ItemCount() - 1, true) ~= 0)
    wait(Self.Ping() + 700)
    cascadedBps[index] = cascadedBps[index] + 1
    opened = true
    end
    end
    end

    if (opened == false) then break end
    end
    -- go back to parent backpacks
    for index, times in pairs(cascadedBps) do
    for i = 1, times do
    Container.GoBack(index)
    wait(300, 700)
    end
    end
    wait(800, 1300)
    -- close everything
    depot:Close()
    wait(300, 600)
    for spot, data in pairs(depositInfo) do
    Container.New(data.realIndex):Close()
    wait(200, 400)
    end
    wait(1500)
    delayWalker(2500)
    if (#arg > 0) then setBotEnabled(true) end
    return true
    end


    Try this and tell me if it's working.

  5. #5

    Join Date
    Sep 2013
    Posts
    89
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    <333333 Going to test it right now!!!

    There is a 'place' where I can paste it to make it work for every lua scripts without dofile or pasting into every script?

  6. #6
    Lifetime Subscriber L!p3's Avatar
    Join Date
    Dec 2011
    Location
    Brazil
    Posts
    157
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by IKillYou View Post
    <333333 Going to test it right now!!!

    There is a 'place' where I can paste it to make it work for every lua scripts without dofile or pasting into every script?
    The Lua File:
    - Your Configs {hpname, minhp, etc...}
    - Your Functions { It should be placed here }
    - The Labels checkers.

    Don't forget to post the results here, please.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •