Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


I used search and found nothing related.

How can I <<back>> in Twine 2?
Is there a way to make choices that are one-click only (eg: choose 1, 2 or 3. If you choose 1, you go to panel one and can go back. When you go back, choices 2 and 3 are inactive).



  • (link-goto:"Back",(history:)'s last) seems to take you back to the last visited page. Note that the documentation suggests this syntax may change in the future:

    [quote](history:): This returns an array of strings. The strings are the names of every passage the player has visited, in order. You can use this array in the following ways: to find out the previous passage the player visited was, use (history:)'s last. To find out if the player ever visited a passage named "Lighthouse", use (history:) contains "Lighthouse". Note: this macro may change in future versions of Harlowe to return more complex datamaps instead of just strings, providing more information about that passage.

    (emphasis mine)

    To make choices that will become invalid, you'll need to set a variable on the page where you make the choice. The following example shows both a back button and permanent choices.

    (set: $choice to 0) [[begin|first-page]]
    this is the page I came from!

    [First Choice]<c1|
    [Second Choice]<c2|
    [Third Choice]<c3|

    (if: $choice is 0 or it is 1)[(click:?c1)[(set:$choice to 1)(goto: "second-page")]]
    (if: $choice is 0 or it is 2)[(click:?c2)[(set:$choice to 2)(goto: "second-page")]]
    (if: $choice is 0 or it is 3)[(click:?c3)[(set:$choice to 3)(goto: "second-page")]]
    Coming from (print:(history:)'s last), you chose choice #$choice.

    (link-goto:"Back",(history:)'s last)
  • (second-page)
    Coming from (print:(history:)'s last), you chose choice #$choice.

    (link-goto:"Back",(history:)'s last)

    What did the
    stand for?
  • angelodias wrote:

    What did the
    stand for?

    I believe he is printing a # character before the value of $choice

    eg. If you clicked the First Choice on (first-page) then the message on (second-page) would end with you chose choice #1.
  • Correct, it is just for the output. No code meaning. Sorry that was confusing :)
  • That was helpful. Thanks!
Sign In or Register to comment.