How to display an inventory in a dialog box with HiEv universal inventory?

Hello guys,

Sugarcube v2.29.0
UInv v0.9.7

I created a passage called bagInventory that displays the player’s inventory.

:: bagInventory

<div data-uinv='table'
    class='inventory-table'
    id='playerBag'
    data-rowclass='inventory-row'
    data-cellclass='inventory-cell'
    data-itemclass='inventory-item'
    data-iconclass='inventory-icon'
    data-textclass='inventory-text'
    data-cellrows='3'
    data-cellcolumns='3'
    data-cellmargin='5'
    data-bordermargin='4'>
</div>

It’s working fine. But when I try to open it in a dialog box, the inventory is not displayed.

Here’s how I open the dialog box.

setup.openBag = function () {
	Dialog.setup("Your inventory");
	Dialog.wiki(Story.get("bagInventory").processText());
	Dialog.open();
};

The dialog box opens, but the inventory is not displayed. However, when I look at the html code in the dialog box, I can see the piece of code to display the inventory.

Could someone help me display the inventory in a dialog box?
Thanks!

By default, UInv just watches for new passages loading. If you’re doing something yourself, like opening a dialog box, then you’ll need to call the UInv.UpdateDisplay() function after the table’s <div> element is displayed.

To put it simply, if you add UInv.UpdateDisplay(); after the Dialog.open(); line, then that should do the trick.

Please let me know if you need any further help with this. :slight_smile:

1 Like

It’s working. Thanks again HiEv !! :smiling_face_with_three_hearts: