I am using Harlowe 3.0.2/Twine 2.3.1 download. I have a Timer throughout my game counting down. When it reaches 0 the game is over. However, when the player reaches a certain point in the story, I want the end screen to read something different.
I though that using a combination of set, if, else, and goto commands would make something but it did not. In previous games I have just brute forced it and would write out over twenty different timers but I want to better my coding skills.
So, is there a way to have a single Timer that changes its goto: after passing a certain passage?
How about:
In setup:
(set: $endPassage to "End")
Wherever you check the timer:
(if: $yourTimer is 0)[(go-to: $endPassage)]
Where you want to change the ending:
(set: $endPassage to "AlternativeEnding 1")
The passage is still going to the original ending. Here is what I have set up. The original time is 300 seconds, but I have shortened to 10 for testing purposes.
(set: $yourTimer to 10)(display: "Your Timer")
Head [[left]] or [[right]]?
(set: $endPassage to "End")
(if: $yourTimer is 0)[(go-to: $endPassage)]
Here is the [[right]] choice. It would be longer, but again for testing purposes I wanted to have a short time window to work with. This “Alternative Ending 1” would be in multiple passages.
(display: "Your Timer")
You turn right and are stopped.
(set: $endPassage to "AlternativeEnding 1")
Here is the $yourTimer set up (displayed as “Your Timer”) complete with the “End” ending.
{
(live: 1s)[
(if: $yourTimer is 0)[
(stop:)
(goto: "End")
]
(else: )[
(set: $yourTimer to it - 1)
You have $yourTimer seconds left!
]
]
}
Obviously the goto: in the timer is taking precedent, but is there a way to circumvent it?
You can use $endPassage just everywhere, it is a global variable.
Like
(live: 1s)[
(if: $yourTimer is 0)[
(stop:)
(goto: $endPassage)
]
I am so confused. Here is what I have set up using what you have given me.
Keep going to [[Alternative Ending Start]].
(set: $yourTimer to 10)(display: "Your Timer")
(set: $endPassage to "End")
(if: $yourTimer is 0)[(go-to: $endPassage)]
That leads to “Alternative Ending Start”…
This is the alternate passage
(display: "Your Timer")
(if: $yourTimer is 0)[
(stop:)
(goto: $endPassage)
(set: $endPassage to "AlternativeEnding")]
Which should lead to “AlternativeEnding” from what you have previously said, but instead leads to “$endPassage”. I had it set to “End” but Harlowe came up in an incorrect macro, so the passage is labelled “$endPassage”.
What is going wrong, what am I missing or mis-typing?