Back to previous passage link

edited November 2015 in Help! with 2.0
I've tried and tried - pretty much blindly - to do this. I've also searched the forum rigorously for the answer, and while I found some related threads, I can't figure out how to do it.

I'm using SugarCube v1, and have a link in the sidebar called Inventory. This takes the user to a list of objects they're carrying (still need to work out how to tell the game when a player picks up an object, but that's a question all of its own).

I want a link on that inventory page, at the bottom of the list of objects, that says 'Back' (or whatever) where 'back' returns the player to the previous passage. How do I do this?

This software is great, but I'm discovering the claim that 'no coding knowledge is required', is a little... shall we say, misleading, particularly if you want your game to do anything other than move players from room to room.

Comments

  • There are several ways to do it. Here are the two simplest.

    Try the previous() function:
    [[Return|previous()]]
    
    Or the <<return>> macro:
    <<return>>
    
  • edited November 2015
    I swear I tried the <<return>> as I found it in the SG tutorial?

    Anyway, that works, but the first option auto-creates an additional passage on close and sends the player there, rather than back to the previous passage.

    It's a shame the first doesn't work, as I wanted to use 'Close' instead of 'Return' or 'Back'

    I've successfully hid the little arrow icon using CSS, but is there a way to change the wording of 'Return'?
  • Jud_Casper wrote: »
    I swear I tried the <<return>> as I found it in the SG tutorial?

    Anyway, that works, but the first option auto-creates an additional passage on close and sends the player there, rather than back to the previous passage.

    It's a shame the first doesn't work, as I wanted to use 'Close' instead of 'Return' or 'Back'
    Just delete the auto created passage, the previous() link will work correctly when you Test / Play / Publish to File the story.

    note: Twine 2 currently does not support any link types besides the standard ones, so sometimes it will incorrectly auto create unwanted passages.
  • To add to what greyelf said, if a passage called "previous()" exists then previous() will take you to that. If it doesn't exist then it will take you back to the previous passage.
  • edited November 2015
    To add to what greyelf said, if a passage called "previous()" exists then previous() will take you to that. If it doesn't exist then it will take you back to the previous passage.

    That's not the case, prof_yaffle. It auto-creates a passage called 'Previous'. Unless you were just emphasising the fact that I needed to delete the passage it created?

    greyelf. Thanks. Deleting the passage it created worked. This also allows me to use 'Close' as I wanted.
  • Jud_Casper wrote: »
    To add to what greyelf said, if a passage called "previous()" exists then previous() will take you to that. If it doesn't exist then it will take you back to the previous passage.

    That's not the case, prof_yaffle. It auto-creates a passage called 'Previous'. Unless you were just emphasising the fact that I needed to delete the passage it created?

    Yes, I was just pointing out why deleting the auto-created passage would make it work.
Sign In or Register to comment.