If: history: doesn't work

Twine Version: 2.3.12
Story Format: Harlowe 3.2.1

I’ve struggled with Passage History for a while now. What I wanted to achieve was to only display a certain Link if the player has never visited that particular Passage before. I tried both of these two codes:

(if:(history: where it is "Water")'s length <= 0)[[[* Go drink the water.|Water]]]
(if:(history: where it is "Water")'s length is 0)[[[* Go drink the water.|Water]]]

Both didn’t work. Any pointers?

NOTE: For simplicity sake the following explanation is not 100% technically correct.

Each moment in Harlowe’s History represented by a Passage data-map object, and each of those Passage data-map objects has a known set of properties. You can see the names of those properties by looking at the documentation of the (passsage:) macro.

When you supply a lambda as a conditional for the (history:) macro call the its keyword is used to represent each Passage data-map object that will be evaluated.

So if you want to only consider History moments where the Passage’s name equal to “Water” then you would use a lambda like the following…

(history: where its name is "Water")

And if you only wanted to show a link when the Array returned by above (history:) macro call didn’t contain any elements then you would do something like the following…

(if: (history: where its name is "Water")'s length is 0)[[[* Go drink the water.|Water]]]
1 Like