can list containers but not their contents

Discussion in 'Wishlist Requests' started by Archer, Feb 15, 2020.

  1. Archer

    Archer Avatar

    Messages:
    234
    Likes Received:
    162
    Trophy Points:
    18
    Location:
    UK, EU, Terra
    Iterating over the result from ShroudGetInventory() does not include the contents of containers, or allow us to iterate over a container object recursively.
     
    Last edited: Mar 30, 2020
  2. Ravalox

    Ravalox Dev At Large Moderator SOTA Developer

    Messages:
    761
    Likes Received:
    1,778
    Trophy Points:
    105
    Gender:
    Male
    Location:
    Austin, TX
    Can you post source and output?
     
  3. Archer

    Archer Avatar

    Messages:
    234
    Likes Received:
    162
    Trophy Points:
    18
    Location:
    UK, EU, Terra
    function ShroudOnConsoleInput(channel, sender, message)
    end

    function ShroudOnGUI()
    end

    function ShroudOnStart()
    inventory = ShroudGetInventory();
    inventorySort()

    ShroudConsoleLog('Listing Inventory...')
    for _, item in ipairs(inventory) do
    local name, durability, primaryDurability, maxDurability, weight, quantity, value = item
    ShroudConsoleLog(string.format("Item: %s", name))​
    end​
    end

    function ShroudOnUpdate()
    end


    [​IMG]
     
    Last edited: Apr 9, 2020
  4. Archer

    Archer Avatar

    Messages:
    234
    Likes Received:
    162
    Trophy Points:
    18
    Location:
    UK, EU, Terra
    As can be seen in the inventory window, this avatar has three bags containing many items. However, only the items at the inventory's root level (including the bags) are enumerated by the script.
     
  5. Toular

    Toular Avatar

    Messages:
    322
    Likes Received:
    331
    Trophy Points:
    43
    Yup. Always been like this. There's no access to container contents - or any way to determine - other than by name - if a particular item in the inventory is a container.

    It would be useful if there was an additional property on inventory items returned by ShroudGetInventory() to indicate the type of item. And an optional parameter for ShroudGetInventory:
    ShroudGetInventory( Container item ), where if "item" is a container it returns the contents of that container. Or maybe "ShroudGetContainerInventory( item )".​
     
  6. Ravalox

    Ravalox Dev At Large Moderator SOTA Developer

    Messages:
    761
    Likes Received:
    1,778
    Trophy Points:
    105
    Gender:
    Male
    Location:
    Austin, TX
    Yes, this is intended as currently implemented.

    To make this happen, the game code would need to be changed to allow recursion into nested containers (as such in the case of the Decoration Pallet, Containers with items in them on Player Vendors and Inventory). All this would need to be modified before the Lua hook would function correctly.

    Moving this to the Wishlist...
     
    Anpu likes this.
  7. Archer

    Archer Avatar

    Messages:
    234
    Likes Received:
    162
    Trophy Points:
    18
    Location:
    UK, EU, Terra
    I don't understand what you are saying. The code already exists (e.g. in Player Vendors) but would need to be changed for Lua to access it, is that correct?