0 votes
by (150 points)

So this is probably a simple question, but I'm a newbie to Twine and Harlowe. I'm trying to make it so that once a player has visited three specific passages, when they click the link to return to a certain page, it sends them to a different page instead. The player comes to a "crossroads". They have the option to visit passage one and passage two. If they pick passage two, that leads them to passage three. The player has the option to return to the "crossroads" at any time, so that they can visit all the paths. Once they have gone through Pall the paths, clicking to return to the "crossroads" should send them to an entirely different passage. Here's what I have:

You are at the crossroads. Do you want to visit passage one or passage two? 
[[I want passage one->PassageOne]]
[[I want passage two->PassageTwo]]
(if: (history:) contains "PassageOne" and "PassageTwo" and "PassageThree")(link-goto:)[[MessageOne]]

So clearly, this is incorrect. What am I doing wrong? Do I need to store it on a different passage? Thanks for any help!

1 Answer

0 votes
by (159k points)
selected by
Best answer

A little background:

1. If you want to test if the array of Passage Names returned by the (history:) macro contains three specific names then you need to check that array three times, once for each name.
(untested code)

(if: (history:) contains "PassageOne" and (history:) contains "PassageTwo" and (history:) contains "PassageThree")[ ... ]

2. The array of Passage Names returned by the (history:) macro is re-generated each time the macro is called, if you know that the list won't change between each call then you should temporarly save the array returned by the first call and use that for the other calls.

eg. In your (if:) macro you need to check the array three times, and the names within that array won't change between the 1st & 2nd or 2nd & 3rd call. So in this case you should use a temporary variable like so.
(untested code)

(set: _history to (history:))
(if: _history contains "PassageOne" and _history contains "PassageTwo" and _history contains "PassageThree")[ ... [

3. You stated you wanted to automatically send the player to another passage, that is what the (go-to:) macro is for. (untested code)

(set: _history to (history:))
(if: _history contains "PassageOne" and _history contains "PassageTwo" and _history contains "PassageThree")[
	(go-to: "MessageOne")


by (150 points)
Thank you! I definitely understand the (history:) macro a bit better now.