How do I put in items that are important to the story and how to put in if/else question that has to do with this question?

So, uh… how do I put in items that are important to the story and how to put in if/else question that has to do with this question? I’m on:
Twine Version: 2.3.14
Story Format: Harlowe 3

I’m not positive I understand the question, but the super simple way I deal with items is like this:
At the beginning of the story, I set all the items to false. (set: $candlestick to false)
When they pick it up, set it to true: (set: $candlestick to true)
Later on, you can check if the player has acquired the item. (if: $candlestick is true)[It's dark. You flick a match and light the candle.](else:)[It's dark. You walk into a wall.]

You can use the editor button that looks like </> for writing code. It preserves formatting, html characters, and uses monospace font.

Like this

if (a == b) {
	// example
}

Ah, many thanks!

Hello ! I’m doing the same stuff. But would it be possible for the player to see the items he/ she picked up ? Like can i add words to the left side column of the screen for example and just list the items that he/she has ? Thank you !

This is a little above my paygrade - I’ve always done inventories with variables, so if you pick up a rock $haverock becomes true, and if you pick up three bullets then we (set: $bullets to it + 3), and then when you check your inventory it runs through everything: (if: $haverock is true)[You have a rock.] You have $bullets bullets. etc.

However, actual inventory systems do exist, like this one. They’re just a lot more complex than most Twine users with no background in code will be willing to tackle.

If that link isn’t helpful, perhaps there are some more recent answers, given that Harlowe 3 had a lot of changes. Here’s a discussion from just a month ago.

I tried your way to set all items to false in the beginning but it makes the $name variable not work and replaces it with 0.

I’m not sure why that is; all variables are 0 by default, but it shouldn’t matter what $name is before the players punches in their name, which I just do like this: (set: $name to (prompt: "What is your name?", ""))

It worked!

1 Like