How to make a sugarcube 2 inventory system with quantity

I’m wanting to make a survival game. Inventory can hold items, such as food, water, tools, etc. of varying amounts. I’m not sure how to implement this though.

You’ll probably want to look at either:

That HiEvs one looks huge on the Java script quantity!

If you have any questions on UInv, feel free to ask. :slight_smile:

Is that link I posted the correct code for an inventory?

Use the link I gave earlier (this one), it will take you to the page where you can always find the latest version of all of the UInv files you need in one simple ZIP file download.

How do you actually use UInv? I can’t find any tutorials.

It comes with a preliminary version of the help file (UInv_Help_File.html) and some basic sample code (UInv_Sample_Code.html). You should read through the “Introduction to UInv Concepts”, “Getting Started”, and the (partially written) “Basic UInv Functions” sections in the help file, and you can import the sample code HTML file into Twine to see exactly how it works (instructions included in that file).

I’m waiting to flesh those out until I’m sure the design is completely finalized, but what’s there now should be enough to get you started.

And, if you have any questions after looking those over, like I said earlier, feel free to ask. :slight_smile:

@HiEv, I checked out your page of amazing Sugarcube code tricks, and you almost have convinced me to pick up Twine!

Heh… Thanks. Twine’s pretty great if you want to learn HTML, CSS, and/or JavaScript, but some people just want to make a game, so I try to make that easier for them. Anytime I help someone out and end up with a neat bit of code, I try to add it to my Twine/SugarCube sample code collection. If you check it out later on, there’ll likely be even more tips and tricks added.

2 Likes

Do you have an estimate for full release? The tutorial is kind of hard to read. If it will be awhile, any alternatives?

I’m afraid not, though I can say that it won’t be soon.

If you have any questions, feel free to ask.

I have downloaded the zip.
What do I do next?

I have downloaded the zip.
What do I do next?

Extract the files somewhere, then open the UInv_Help_File.html file in a browser, take a look at the “Getting Started” and some of the other parts of the “General UInv Topics” section, and that should help explain a few things and get you started. You should also import the UInv_Sample_Code.html file into Twine so that you can take a look at the code there to see how it can be used.

UInv still isn’t at v1.0, so the help file is still incomplete in a bunch of spots, but there should be enough there to use it.

Feel free to contact me if you have any questions.