Skip to content
Universal Inventory System (UInv) for Twine 2 / SugarCube 2
Branch: master
Clone or download
Latest commit 6a86d24 Dec 30, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
webfonts Added Font Awesome "brands" fonts Oct 24, 2018
FA_Icons_base64.html Updated HTML examples and added missing files Oct 24, 2018
LICENSE Initial commit Apr 7, 2018 Added donation links Dec 30, 2018
UInv_Sample_Code.html Update to UInv v0.9.7 Dec 29, 2018
UInv_Unit+Regression_Tester.html Update to UInv v0.9.7 Dec 29, 2018
UniversalInventorySystem.js Update to UInv v0.9.7 Dec 29, 2018
Universal_Inventory_System.txt Update to pre-release v0.9.7 Dec 29, 2018
all-b64.css Updated HTML examples and added missing files Oct 24, 2018
all-b64.min.css Updated HTML examples and added missing files Oct 24, 2018
all.css Updated HTML examples and added missing files Oct 24, 2018
jquery-ui.css Add files via upload Sep 26, 2018
pre-release_changelog.txt typo fix Dec 29, 2018

Universal Inventory System (UInv) for Twine 2/SugarCube 2

The "Universal Inventory System" (UInv) is an inventory system for Twine 2 / SugarCube 2 written in JavaScript which is meant to simpify handling inventories for new Twine users.

The way UInv works is that there are two objects, "bags" and "items". "Bags" are containers which have their own properties that you can customize. Bags can also contain "items", which are collections of properties that you can pre-define in the code and then easily create, move from bag to bag, delete, etc...

So, for example, you could have a "bag" which represents the player's backpack, another "bag" which represents what they're holding, and a bunch of other "bags" which represent the various rooms the player will travel to. You could then populate those room "bags" with items. Then, when the player travels to that room they could see all of the items there, and the items' properties could be used by the code to determine how the player can interact with those items. You could even make the player's description a "bag" and have the "items" in it represent the player's various stats, skills, and physical descriptions.

"Items" can also have "pockets" (which are "bags" attached to that "item"), and "bags" can have "containers" (which are "items" that are connected to that "bag"). UInv will automatically maintain the relationship between these "containers" and their "pockets". For example, a "suit" item/container could have a "suit pocket" bag/pocket, where other items could be stored.

There are also "tags", which are basically arrays of values on a property of a bag or item. If you have a property that uses an array of values, you will be able to use the various "tag" functions to group items by whether they have particular "tags" in that property's array. This way you could, for example, get a list of all of the items in a bag that have the tag of "crafting material" in their "Type" property.

Then there is the display layer, which will make it easy for you to add inventory tables, pop-up radial menus, health bars, a "clothing mannequin" (for dressing and equipping characters), a "shop" interface (to make buying and selling items easier), styelable drop-down menus with pictures, and more.

For more information, you can take a look at an early version of the help file at the link below: (work in progress)

and some simple introductory sample code can be found at the following link: (work in progress)

Those are also included in the .ZIP file available here. You can import those into Twine 2 to see how they work.

Current progress (as of December 29, '18):

  • ~98% done on the base coding by function (280 out of 286+ currently proposed functions).
  • Very little sample code done yet.
  • Preliminary testing begun (37 out of 280 functions fully tested, plus many partial tests).
  • Documentation skeleton written. Additional details and examples to be added later.
  • Item and Table "builders" mostly written (see help file), other builders to come.

If you would like to support this project, you can do so via Patreon or PayPal.

-- HiEv

You can’t perform that action at this time.