Hello all, I've been working on a little horror adventure game here as my first project, and I've been wondering how to create an inventory system in Harlowe. I have seen a few videos with examples and tried to find a discussion that may have what I would need, but still not sure. Most importantly, what is better for an inventory, with things like lighter, lockpick, gun, etc. Would it be best to use a datamap, a dataset with an "isCarried" deal, or should I set up an array? And after that, what is the best way to link to your inventory at any time without having to write the passage link on every passage? Thanks.
Comments
I am not good enough yet with arrays and datamaps, so I can't answer your first question.
I can, perhaps, help with your second one.
The two most commons ways of displaying an inventory I have seen so far are either to create a sidebar using CSS, or to use passages tagged as header or footer.
The sidebar method, which can be found at this excellent github page (the whole page has several great tricks), is the following:
PassageName: Stats / Tag: Header
Story StyleSheet - Orig.
With the header or footer method, you can put the passage code in a passage tagged either footer or header and it will show up automatically on every page (if you look around in the forums, you'll also find ways to hide the footer or header from specific passages. (See an example here: http://twinery.org/forum/discussion/comment/11966/#Comment_11966)
I prefer the footer method because it leaves more space at the center of the page for the story text.
I suggest that you look at this post, if you haven't found it already. there are downloadable examples of a working inventory.
Visualy if you want to see all inventory in all passages, maybe you can use a table to distribute the story on the left and a small inventary on the right
Inside the inventory cell, you can use print instruction to show items as a reminder of what you have.
You can take or drop items by adding or subtracting an array.
doing (print: $inv) will display a comma separated list. So a better approach would be something like: which will print each item on a new line.
Of course you can get a lot more complicated, depending on the needs of your story.
For putting a link to the inventory on every page, using a header or footer passage would be the easiest.