Results 1 to 5 of 5

Thread: How to write a depositer for multiple (nested) loot backpacks?

  1. #1
    Normal User Boget's Avatar
    Join Date
    Nov 2012
    Posts
    152
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    1 Post(s)
    Reputation
    22
    Rep Power
    5

    Question How to write a depositer for multiple (nested) loot backpacks?

    Let's say I more than one loot backpack, nested inside of each other, and I want to write a depositer that starts with the first backpack, deposits loot, and then keeps opening the other loot backpacks + depositing the loot within them until none are left.

    How do I do this?

    I found a script here but it doesn't work: http://www.tibiaibot.com/forum/showt...l=1#post170370 Reading the code it seems it simply keeps opening the backpacks while putting the loot in the depot, i.e. it doesn't check wait for the first loot backpack to be empty before opening the next one.

    Then I tried to write my own script, as follows:

    Code:
    function depositAll (eqBP, depotBP, loot)
      print('putting loot from ' .. eqBP .. ' (first bp) in ' .. depotBP)
      depotdeposit(depotBP, unpack(loot))
      wait(800, 1000)
      while itemcount(eqBP) > 1 do
        print('putting loot from ' .. eqBP .. ' (extra bp) in ' .. depotBP)
        openitem(eqBP, eqBP)
        wait(800, 1000)
        depotdeposit(depotBP, unpack(loot))
        wait(800, 1000)
      end
    end
    
    -- example usage: deposit all stackable loot (from more than 1 nested bp)
    depositAll(StackLootBP, StackLootDPBP, StackLoot)
    -- which boils down to something like:
    depositAll('Red Backpack', 'Blue Backpack', { 'ghoul snack', 'brown piece of cloth' })
    This seems to deposit the loot of the top-level backpack just fine, and it opens the next backpack correctly too, but for some reason it doesn't deposit the loot anymore after the first backpack.

    Any ideas why this happens? How can it be fixed?

  2. #2
    iBot User pink_panther's Avatar
    Join Date
    May 2012
    Location
    Australia
    Posts
    4,075
    Mentioned
    49 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    178 Post(s)
    Reputation
    309
    Rep Power
    10
    I use "nested" loot bps in all of my paid scripts...

    Some of my free scripts have it to.

    The way i do it is by having 1 action wpt before it deposits that disables open next bp then closes and reopens your loot bp then 1 action wpt for depositing items, then an action wpt right after it that goes "If itemcount(lootBp, lootBp) > 0 then openitem(lootBp, lootBp, true, 1) gotolabel(wpt.id - 1) end"

    That way it deposits items, then IF a bp of the same kind is found inside your loot bp, opens it, then jumps back 1 wpt to do the deposit action again, that way you can have as many or few loot bps as you like and it will still deposit all items

    if you need help setting this up you can check out my Mountain Tomb script (link to free scripts in my sig) or add me on skype - pink_panth3r

  3. #3
    Normal User Boget's Avatar
    Join Date
    Nov 2012
    Posts
    152
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    1 Post(s)
    Reputation
    22
    Rep Power
    5
    Thanks, pink_panther! You're right, the key was to use separate Action waypoints instead of a loop in LUA.

  4. #4
    Normal User dragonicevo's Avatar
    Join Date
    May 2012
    Location
    canada
    Posts
    1,600
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    3 Post(s)
    Reputation
    65
    Rep Power
    8
    Quote Originally Posted by Boget View Post
    Thanks, pink_panther! You're right, the key was to use separate Action waypoints instead of a loop in LUA.
    my loop has worked fine in some scripts and bugged in others i am sure this well come in handy to others as well.
    http://www.tibiaibot.com/forum/showt...2925#post42925 for basic setup for knight

    If i helped or you liked my scripts rep + me

    trusted free scripts by pink_panther and 3173654 and acid alchamy and marlhex and spens13

  5. #5
    iBot User pink_panther's Avatar
    Join Date
    May 2012
    Location
    Australia
    Posts
    4,075
    Mentioned
    49 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    178 Post(s)
    Reputation
    309
    Rep Power
    10
    glad i could help.

Tags for this Thread

Posting Permissions

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