How do I make it so that a passage only appears if the player does not have a specific item?

I want a passage to only be visible if the player does not have the object associated with the passage. I tried the (unless:) macro, but it doesn’t seem to be working.

Please specify version and format if asking for help, or apply optional tags above:
Twine Version: 2
Story Format: Harlowe

1 Like

You can use a Boolean variable to indicate if the ‘player’ has the ‘item’ or not. You would need to pre-initialise the variable some time before then need to check if the ‘passage’ needs to be shown, one place to do this initialisation is in your project’s startup tagged passage

(set: $haveTouch to false)

You can use an (unless:) macro call like the following to conditionally show a link to the Passage.

(unless: $haveTouch)[ [[Search for a torch]]]

To stop the above link been shown simply change the value of the variable to true

You found a torch
(set: $haveTouch to true)

If you are using a (display:) macro displaying the contents of a ‘child’ Passage within the ‘current’ Passage, and want this only to happen when the ‘player’ doesn’t have the ‘item’ then you would change the above (unless:) example to something like the following…

(unless: $haveTouch)[(display: "Dark Room Description")]


1 Like