XenoBot Forums - Powered by vBulletin

User Tag List

Results 1 to 7 of 7

Thread: Loop in New Depot

  1. #1

    Join Date
    Nov 2014
    Posts
    9
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Loop in New Depot

    Hello,

    I know that new depots are like backpacks and can be accessed by any depot... Anyway I need access a backpack inside a depot box, because I send a backpack with items to another character to be sold(green djin, blue djin, rafzan, yasir)

    Code:
    local IDDepot = 22797
    
    Self.CloseContainers()
    
    local Depot = Self.OpenDepot()
    
    for i = 0, Depot:ItemCount()-1 do
    	if (Depot:GetItemData(i).id == IDDepot) then
    		Depot:UseItem(i, true)
    
    		--local dpBox = Container.New('depot box I')         return 17 item
    		--local dpBox = Container.New(IDDepot)		     return 0
    		--local dpBox = Container.GetLast() 		     return 17 item
    		--local dpBox = Container:Index()                    return nil
    		--local dpBox = Container:ItemCount()		     return 17 item
    		--Container:ItemCount() 			     return 17 item
    		--local dpBox = Container:OpenChildren('depot box I')return nil
    		--local dpBox = Container.GetByName('depot box I')   return 0
    		--local dpBox = Container.GetByName(IDDepot)         return 0
    		print(dpBox:ItemCount())
    
    		break;
    	end
    end
    That's the small script that I have been using to test... It opens depot chest wich has 17 items(depot box) then open depot box I(wich has only one item a brocade backpack).

    In my test it just shows me 17 items that means depot box or nil or return 0.

    Anyway, someone would have any suggestions for how to loop inside the depot box?

  2. #2

    Join Date
    Nov 2014
    Posts
    9
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    In all my tries I figured out that when I use the ID of depot box(code below) xeno opens the depot box...

    Code:
    local itemData = Depot:GetItemData(i)
    if (itemData.id == IDDepot) then
     Depot:UseItem(i, true)
    But, when I use the depot box name it doesn't open nothing..
    Code:
    Code:
    local itemData = Depot:GetItemData(i)
    if (Item.GetName(itemData.id) == 'depot box I') then
      Depot:UseItem(i, true)
    What I would like to know is, the fact xeno do not recognize the name means that it can not return any instance of a container when using Container.GetLast(),Container.New('depot box I')? Because when I trying do it, just return the depot chest with 17 items(depot box)

  3. #3

    Join Date
    Nov 2014
    Posts
    9
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Someone??

  4. #4
    Lifetime Subscriber L!p3's Avatar
    Join Date
    Dec 2011
    Location
    Brazil
    Posts
    157
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    If you are with the Depot Box opened and use Container.GetLast():Name() u will see that the right way to type this containers names are: "Depot Box Number", and capital letters does matter.
    As the Depot Box have IDs 22797, 22798, 22799 and so on, you can make a function to do like: Container.OpenDPBox(num), or UseItem(22796 + num, true) and the 'num' you just do 22796 + 'num'.

  5. #5

    Join Date
    Nov 2014
    Posts
    9
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Using this small code I get those results:

    - With depot chest opened it returns: unknown x17

    - With depot box I opened it returns: brocade backpack (that's what I want, but must be automatic...Self.OpenDepot()...)

    Code:
    local container = Container.GetLast()
    
    for i=0, container:ItemCount()-1 do
    	local itemData = container:GetItemData(slot)
    	print(Item.GetName(itemData.id) )
    end

    That's the code I've been using to access a backpack inside Depot Box
    Code:
    local IDDepot = 22797
    Self.CloseContainers()
    
    local DepotChest = Self.OpenDepot()
    
    
    for i = 0, DepotChest:ItemCount()-1 do
    	if (DepotChest:GetItemData(i).id == IDDepot) then
    		DepotChest:UseItem(i, true)-- until here it's open depot box I, after that nothing happens...
    		
    		local depotBox = Container.GetLast()   --return unknown
    		--local depotBox = Container.New('Depot Box I') --return nothimg
    		--local depotBox = Container.New(Item.GetName(IDDepot))  --return nothing
    		--local depotBox = Container.New(IDDepot)  --return nothing
    
    		for j = 0, depotBox:ItemCount()-1 do
    			local itemData = depotBox:GetItemData(j)
    			print(Item.GetName(itemData.id))	
    		end
    		
    		break
    	end
    end
    It needs to open(automatic) a backpack inside a depot... because I need move items from inbox for that bp...

  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 blah88 View Post
    Using this small code I get those results:

    - With depot chest opened it returns: unknown x17

    - With depot box I opened it returns: brocade backpack (that's what I want, but must be automatic...Self.OpenDepot()...)

    Code:
    local container = Container.GetLast()
    
    for i=0, container:ItemCount()-1 do
    	local itemData = container:GetItemData(slot)
    	print(Item.GetName(itemData.id) )
    end

    That's the code I've been using to access a backpack inside Depot Box
    Code:
    local IDDepot = 22797
    Self.CloseContainers()
    
    local DepotChest = Self.OpenDepot()
    
    
    for i = 0, DepotChest:ItemCount()-1 do
    	if (DepotChest:GetItemData(i).id == IDDepot) then
    		DepotChest:UseItem(i, true)-- until here it's open depot box I, after that nothing happens...
    		
    		local depotBox = Container.GetLast()   --return unknown
    		--local depotBox = Container.New('Depot Box I') --return nothimg
    		--local depotBox = Container.New(Item.GetName(IDDepot))  --return nothing
    		--local depotBox = Container.New(IDDepot)  --return nothing
    
    		for j = 0, depotBox:ItemCount()-1 do
    			local itemData = depotBox:GetItemData(j)
    			print(Item.GetName(itemData.id))	
    		end
    		
    		break
    	end
    end
    It needs to open(automatic) a backpack inside a depot... because I need move items from inbox for that bp...
    lua code:
    local DPBox = 1 -- From 1 to 17.
    local BPName = "Brocade Backpack"

    Self.CloseContainers()
    Self.OpenDepot()

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

    for j = 0, DPChest:ItemCount()-1 do
    if (DPChest:GetItemData(j).id == Item.GetID(BPName)) then
    DPChest:UseItem(j, true) wait(Self.Ping() * 2, Self.Ping() * 3)
    end
    end
    end
    end

  7. #7

    Join Date
    Nov 2014
    Posts
    9
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    worked perfectly, thank you.

Posting Permissions

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