Howdy, Stranger!

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

Previous function doesn't work

I would like one of my passages to have a "Back" link that takes the user to the passage they viewed immediately before. The twine wiki tells me that the following code is what I need.

previous()

Rather than linking to the previous, though, the above command just auto-creates a new passage called previous() and links there. That's not what I want. What am I missing?

Comments

  • You need to state the name and full version number of the story format you are using, as answers can be different for each one. Also please use the code tag when posting examples - it's the C on the editor bar.

    The Twine 2 application's "Create Missing Passage" feature does not understand about advance markup based links like the one in your example, which is why it is incorrectly created that new passage.

    Delete that new passage and everything should work correctly in your story.
  • Thanks! I was using Harlowe 1.2.3. I also tried Harlowe 2.0.0, Snowman 1.3.0, SugarCube 2.14.0and SugarCube 1.0.35. In all of these formats, it either creates a new passage and makes the link non-working when I delete it, or just creates a link that doesn't work.

    The code used was
    [[Back|previous()]]
    
  • edited April 2017
    Skydog wrote: »
    Thanks! I was using Harlowe 1.2.3. I also tried Harlowe 2.0.0, Snowman 1.3.0, SugarCube 2.14.0and SugarCube 1.0.35. [...]

    I'm almost certain that only SugarCube 1 & 2 have the previous() function (Sugarcane might; I can't rememeber). Story Formats all have their own syntax, functions, macros, and utilities, so you can't use code from one and expect it to do anything in another.

    I just tested your code
    [[Back|previous()]]
    

    in both SugarCube 1.0.35 and 2.14.0 in Twine 2.1.1, and it worked in both as expected.

    Harlowe doesn't have the previous() function (as far as I can find in the documentation, anyway), but this code should do something similar and should work in either version:
    (link: 'Back')[(goto: (history:)'s last)]
    
  • Thanks, Chapel, your suggested code worked.
Sign In or Register to comment.