I am just starting out on Twine and am starting to feel like I'm getting the hang of it, but I want to go beyond just a simple choose-your-own-adventure game. Creating an in-game inventory feels like it would be a good starting point, but I know nothing about coding and any explanations that I find online are right on the border between understandable English and CSS gibberish.
Assuming I know little to nothing about coding, how would I go about making a simple inventory? (i.e., containing quest items and miscellaneous garbage). And on a similar note, how could I make a record of the player's stats in the game? Would the two concepts be alike in how they're done?
Again, this is assuming that I know nothing about coding and that I'm only just starting to learn how to do it correctly.
Comments
Following is an example of assigning some variables and then using those variables in your game.
(note: The first four lines that start with the <<set>> macro should be added to your games StoryInit passage, the last two lines could be added to your Start passage.) What sort of inventory system are you looking for?
If you only want to track if the player has found selected items then you can use simple variables like the example above to achieve this. Just use the above as a starting point and extending it by adding more variables as needed to track whatever you want.
The Twine story formats are designed to create Interactive Fiction (IF) and Choose Your On Adventure (CYOA) type games.
You can create a Role Playing Game (or most other games types) with it but features like Combat, Inventory, Shops, Clothing (Armour), and the like are not built-in and you will have to do most of the hard work to implement them.
And I haven't tried it yet, but would this code work in the 2.0 beta? Or is it still too rough? I know I haven't seen anything about using CSS in the beta anywhere, so I'm assuming either it doesn't work yet or no one's written anything about it.
Both the format of a macro (<<macro_name>>) and what macros are available are control by the story format you select when building your game/story, and currently the 2.0 beta version of Twine does NOT support the older story formats that are used by Twine 1.x, so you cant copy code from a 1.x project over to a 2.0 one.
The same code using the 2.0 beta and the Harlowe story format would look like the following:
The 2.0 beta supports CSS but it is different than 1.x in two major ways:
1. There is a special passage where all CSS must be places.
2. The structure of the HTML file generated by the Harlowe story format is different than the older story formats and the elements of the parts of that structure have different id/names than before, so the selectors of the CSS you write are different than the ones used in 1.x.
The Harlowe story format also has its only built-in macros which you can use to formatting the text of your story.
Example Turn-Based RPG (Pre-Alpha v. 0.4)
Objects are Your Friends: How & Why to Use JavaScript Objects for Total Newbies
It would work for some macros like set but would not work as well for macros like if / if else Array initialization, assignment, manipulation and referencing is different between Harlowe and the Twine 1.x story formats, and Harlowe also has a number of new built-in macros.
Also Twine 2.0 and the Harlowe story format are both beta projects, so may change without notice and these changes may break your story/game.