Terrible noob needs help with HiEv's UInv

Hello Twine community,

A short preface for context: I’ve completed a couple of IF projects in Twine, the first one a straight CYOA and the second a CYOA with a few variables. My current work in progress, however, is a much more ambitious gamebook adventure sporting a simple RPG-style engine where the PC is endowed with a few skills, an inventory and status effects. This presents a certain challenge to me since I’m sadly a bit of a chronic coding illiterate.

Now, for the inventory system I’ve looked into Chapel’s and HiEv’s graciously provided premade solutions and elected to go with HiEv’s Uinv since it seems to offer the functionality I’m looking for (as well as a lot, lot more) – the problem being that even after reading the documentation, doing some web searches and fiddling about with the code, I have a really hard time understanding how to get it to do what I want. To wit:

  • Having one bottomless player inventory into which a limitless number of ‘small’ type items can go

  • Also having one backpack, of which only one can be carried at the time, which can carry a limited number of ‘large’ items – this backpack is to be exchangeable, so that the PC starts with a small one and later can find bigger ones

  • A few items are to have charges which can be used and refilled at certain points in the story

  • All items are to be discardable (individually) at will

  • Some items are to passively confer modifications to certain rolls, mainly skill checks

The second point is what’s giving me trouble so far (I’ve only just begun). For starters, am I to put these backpacks in the BagData or the ItemData section of the code? Sorry if it seems I’m too hasty in reaching out for assistance, but I’ve spent a good chunk of time trying to wrap my poor non-technical head around the code with little to show for it.

Preferentially, there will be no GUI elements but I’m not dogmatic on that account; neither am I married to the idea of using UInv but it certainly seems like it’s the most expedient option for what I’m trying to do. (Thank you, HiEv!)

On a related note, is it possible to break out pieces of the JavaScript code and have it somewhere else in module form? After having placed the UInv code as well as some other stuff there it’s rather clunky, especially since there’s no function for searching inside it (unless I’ve missed it). What I mostly would like to do would be to have my own UInv-mediated items in a separate Twine passage, or a separate file. Could that be arranged?

Twine Version: 2.3.9
Story Format: Sugarcube 2.33.4
HiEv UInv