"Lock and Key: Variable": Harlowe (v2.0)
"Lock and Key: Variable" demonstrates how to create the effect of picking up a key and unlocking a door. In this example, the key is a variable ($key) and is initially set to the value false in the Start passage.
When the link "Pick up the key" is clicked, $key is changed to the value true and the door link changes from its initial response of "Locked Door" to a link to the passage Exit.
:: StoryTitle Lock and Key: Variable in Harlowe :: Start (set: $key to false) Rooms: [[Front Room]] [[Back Room]] :: Front Room (if: $key is true)[ [[Exit]] ] (else:)[ *Locked Door* ] Rooms: [[Back Room]] :: Back Room (if: $key is false)[ Items: (link: "Pick up key")[(set: $key to true)You have a key.] ] (else:)[ There is nothing here. ] Rooms: [[Front Room]] :: Exit You found the key and went through the door!
Download: Twee Code