Can I make an inventory by setting the items to true?


I took a look at CJW’s inventory system but it was mind numbing, so I was wondering if there was a simpler way to do it. Can’t I just set the items to true or false, depending on whether or not you have them?

How do I make an inventory system?
[Tool] Chronicler - ChoiceScript Visual Code Editor

You should be able to. CJW’s method is just one way.



Would it look unruly to the reader? Would it have to be displayed like this, or is there some other way to display it?

True: Staff
True: Master Key
True: 8/8 Iron Shavings
True: 2/2 Salt
True: Master Key


If you can give me a detailed example of your ideal inventory system (functionality, requirements), I could give you a better idea of how to go about it. There are many, each better suited for different games and authors - it all depends on what you want to achieve.

You could do something as simple as a long list of items with true/false to something as complex (or even more so) as my system.


You can display an inventory however you want to. It’s just a bunch of variables. So you could do

Inventory: Staff, Master Key, 8 Iron Shavings, 2 Salt,


I also use only boolean checks for inventory, with line breaks replacing all the commas to help with legibility. The drawback is that the list could run crazy long down the screen as your item count goes up.


Basically I just want to be able to list the default items in your stats, add items when you find them and subtract items if they are used up or destroyed.


When do you want to be able to use these items? Is listing the item names enough or do they need a description? How many items are you planning on having? How do you plan to deal with item stats? Do the items have a weight (so you can carry more of one thing, less of another)? Do you need to be able to manipulate your items from the inventory? Note that you can’t change variables whilst viewing the stats_screen, so if the answer to the above question is yes, you need to code the bulk of the inventory management system outside of it.

It’s not quite as simple “I want a random inventory system” - Why don’t you go away, have a think about exactly what it is you want the inventory to accomplish and then come back to us?


@CJW is there a thread where your (and I use the term very VERY loosely) mind numbing inventory system can be found? (am intrigued thassal!) :smiley:



Have fun :slight_smile:


My book is mainly combat based, so most of the items will be used in most of the choices. (i.e. , How do you attack? 1.) Bind her with your chain
2.) Strike her with your staff
3.) Release a cloud of iron down upon her
Listing them is enough. With the item stats, most of them are default so I figured I could use boolean codes as long as it didn’t look bad. There really isn’t a weight issue, but there are times when I only give you a choice of picking one out of the list of the items. Like if I gave you a choice of bringing a destruction grenade, 3 flash grenades, or 5 smoke grenades, you’d only be able to choose one type. I really don’t need to manipulate them. Basically what I need it to do is discern what you can do or not, if it’s regarding an item. Like you can’t use the destruction grenade unless you have it in your inventory, you can’t bind someone with your chain unless you have it in your inventory, etc. That’s really it.


If it’s that simple you’ll be fine just using a shedload of booleans.
Or, perhaps integers would be better (for items you can have more than one of).

    *if(staff>0) #attack with staff
    *if(potion>0)#use potion


   #Pick up the staff
     *set staff + 1 (or *set staff true)
   #Take the chain
     *set chain + 1 (or *set chain true)


Alright, I’ll try it. And to for the default items, should I just set them all as true? And if so, would I do that in the startup file?



*create staff true

^we have a staff

*create potions 0

^We don’t have any potions (but we still need to create the variable)


Yeah:P and is there any way to put those into the inventory section of the stats? and I’ve noticed that the inventory needs to be word wrapped, and I tried entering it but it broke the code


So in the stats text file you could just have:

*if(potions > 0)
   ${potions} Potions

Two examples that’d print some text like:

6 Potions

Where 6 would be the number you actually have.


It sounds much like my basic inventory system. Feel free to use it if you’d like:


Thanks, everyone!
I took a look at your inventory code, and it makes complete sense to me now. Thanks for your help.


Damn @jimD, that’s a sweet system.


I’m learning a lot reading through this.