1. Threads will remain in the main wishlist section while being discussed. After being reviewed by the Devs for initial feasibility, and depending on thread activity, the thread may be moved into one of the two subsections
    How to post your idea:
    Create a thread with a clear title that describes what the idea is about. Only one idea per thread!
    Please specify either in the title of the thread (if there is space) or at the very top of your post, what type of idea it is, For example: Housing (Houses, Lots, etc)
    Example title: Housing: Epic Keep and Castle Size Homes other than Pirate Ships
    Be sure to include details about your idea. Devs, and or players may reply to your thread asking additional questions, so please be willing to provide more details.
    Please see the sticky thread marked **READ FIRST** for more details...

can list containers but not their contents

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

Thread Status:
Not open for further replies.
  1. Archer

    Archer Avatar

    Messages:
    285
    Likes Received:
    196
    Trophy Points:
    40
    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 Chief Cook and Bottle Washer Moderator SOTA Developer

    Messages:
    1,731
    Likes Received:
    4,954
    Trophy Points:
    125
    Gender:
    Male
    Location:
    Dallas, TX
    Can you post source and output?
     
  3. Archer

    Archer Avatar

    Messages:
    285
    Likes Received:
    196
    Trophy Points:
    40
    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:
    285
    Likes Received:
    196
    Trophy Points:
    40
    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:
    661
    Likes Received:
    631
    Trophy Points:
    93
    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 Chief Cook and Bottle Washer Moderator SOTA Developer

    Messages:
    1,731
    Likes Received:
    4,954
    Trophy Points:
    125
    Gender:
    Male
    Location:
    Dallas, 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:
    285
    Likes Received:
    196
    Trophy Points:
    40
    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?
     
Thread Status:
Not open for further replies.