Howdy, Stranger!

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

How do I create a link that returns to the previous story passage?

I know there has to be a way to do this. I have looked all up and down the macros library and I can't seem to figure out how though.

So in my game I have a sidebar menu that has [character display], [inventory] and [stats]. So what I need is a link that returns me to the previous STORY passage because with <<return>> you can get "trapped" in your menu's and with <<back>> if you've poked about in the menu's for a bit going from one to the other and then back again (drinking a healing potion, changing your armour and then looking at stats), you may have to go "back" through several "menu" passages to get back to the story and it's just really tedious. Is there a "return to previous story passage" option that I'm missing? Any help would be amazing!

Thanks,

Virgil

Comments

  • edited September 2016
    NOTE: You should always specify the story format, and version, you're using.


    This has come up several times before and there are many possible solutions. This one is largely automatic (set it and forget it).

    1. Tag all of your menu passages with a tag unique to them (e.g. menu).

    2. Put something like the following in a script section (Twine 1: script-tagged passage, Twine 2: Story JavaScript):
    /* Use this if using a Twine 1 vanilla story format (Jonah, Sugarcane, Responsive). */
    prerender['setReturn'] = function () {
    	if (tags().indexOf('menu') === -1) {
    		state.history[0].variables['return'] = passage();
    	}
    };
    
    /* Use this if using SugarCube v1. */
    prerender['setReturn'] = function () {
    	if (!tags().contains('menu')) {
    		state.active.variables['return'] = passage();
    	}
    };
    
    /* Use this if using SugarCube v2. */
    prerender['setReturn'] = function () {
    	if (!tags().includes('menu')) {
    		State.variables['return'] = passage();
    	}
    };
    
    I used menu for the tag name there. If you already have your menu passages uniquely tagged with something else, then simply replace the instance of menu in the above code with whatever you're using.

    3. Inside your menu passages, you'd do something like the following to return:
    [[Return|$return]]
    

    That will send the player to the last encountered non-menu passage, whatever it was.
  • as exile stated you should specify your story format and version this is how you do it in harlowe
    (link-goto: "Return", (history:)'s last)
    
  • The Basic "return from menu passages" handling for Harlowe thread contains a breakdown on how to do what TheMadExile described using the Harlowe story format.
Sign In or Register to comment.