Help with variables and hidden passage links in Twine/Harlowe

What I’m trying to do: Reveal additional passage links based on passages the player has visited. For example, visiting one Passage should “unlock” a link to another passage in the “Downtown” passage.

How I’m trying to do it: Set a variable to true when they visit a passage that should unlock another passage. On the “Downtown” page, I’m just using if: and hidden hooks. Example: (if: $megansapartment is true)[ [[Old Salty's]]])

The problem: Navigating to the Downtown passage using the back arrow icon doesn’t re-run the if: macro (based on Harlowe 3.2.3 manual this appears to be by design).

I can get it to work by adding a link back to Downtown from Megan’s Apartment, which apparently does re-run the macro. So I guess I could try to just remove the back and forward arrows from the template and only use hand coded passage links for navigation, but I’m hoping there’s a better way to do what I’m trying to do (it’s also not clear to me that my workaround is officially supported, so I’m worried it might break at some point).

Thanks in advance!

That is by design. Using the “back” arrow resets the state of the story to its last previous point. It’s not re-running the passage, it is literally rewinding the story’s values.

Having explicit links would help in this regard. Clicking on a link is considered a “turn” and the story’s values are updated as a result.


Depending on how you have designed your story, looking at (history:) may help, too. You can test to see if the player has visited certain passages previously.

Using is true or is false when evaluating the current state of a Boolean variable is redundant, and results in that evaluation taking more steps / longer to achieve the same outcome.

The correct ways to check if a Boolean variable is currently true or false using the (if:) or (else-if:) macros are:

(if: $variable)[The variable currently equals true]

(if: not $variable)[The variable currently equals false] 

Thank you both!

If I just use (if: $variable) I get the error “(if:)'s 1st value is the number 0, but should be a boolean.” (I think this is why I did it the way I did it before in the first place, come to think of it).

Harlowe automatically assigns a default value of 0 (zero) to any variable that is referenced that hasn’t previously been assigned a value by you. Unfortunately (unlike most programming languages) Harlowe doesn’t consider a numerical value (like 0 or 1) as the equivalent of a Falsy or Truthy value.

If you are going to use a variable as a Boolean then you need to initialise it to either true or false before hand, often this is done within your project’s startup tagged special passage.

eg. sometime prior to your evaluating of the current value of $variable you need to do one of the following:

(set: $variable to true)

(set: $variable to false)

Hi everyone,

I am completely new to Twine/harlowe 2.2.3 so may this question would be dumb.
I would like to display a passage link only if a conditionnal statement is verified. So I wrote:

(if: ($intelligence <= 20) and ($force <= 20) and ($dexterite <= 20) and ($constitution <= 20) [ [[Validate]] ] 

The aim is to give the possibility for the player to go the validate button only if all of the caracteristics are less than 20 (I followed the caracteristics values via the debug mode and nothing was wrong from this point of view). The problem is that the “validate” link is always displayed despite de values given to the caracteristics. How should I correct it?

Thanks in advance for your help.
PS: I know that this topic is two years old, but due to the similiarities between the request of the author and mine I thought it would be better to continue on this subject.