Howdy, Stranger!

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

How do I get around return and back getting me into a loop?

edited October 2015 in Help! with 2.0
I'm using twine 2 with sugarcube 2. I have several passages in my storymenu. For example, inventory and stats. If I click on inventory and then immediately on stats, I get stuck in them and can't get back to the story. The same thing happens if the stats for example has a depth of more than one passage.

I've seen some games where the ui bar is automatically hidden during certain passages, likely to get around this, but I have no idea how to do that. I've also seen some talk about making the history skip certain passages so the <<return>> skips past them, but I haven't a clue on how to do that either.

Comments

  • edited October 2015
    A common technique used to get around this issue is to:

    1. Assign a tag (like noreturn) to each of your inventory/stats like passages.

    2. Use a markup link like the following as the means to exit these tagged passages:
    [[Return|$return]]
    
    3. Add the following predisplay task to your Story Javascript:
    predisplay["Menu Return"] = function (taskName) {
    	if (! tags().contains("noreturn")) {
    		State.variables.return = passage();
    	}
    };
    
    What the point 3 does is remember (in the $return variable) the last non tagged (with noreturn) passage displayed, and point 2 uses the value of $return to return back to the remembered passage.
  • Thank you, that works perfectly.
  • Ahoy!

    Apologies for the necro-post, but I've been trying to get this to work on twine 2 with sugarcube 2.6.2, and have thus had no luck.

    I've tried copying it word-for-word, added tags to my inventory passages, and inserted the javascript into the javascript section, but for some reason, when I put
    [[Return|$return]]
    

    to the inventory passage I want to lead back to my story (in a non-tagged passage), it takes me to a newly made passage with "$return" as the passage name rather than returning me to a previous passage.

    I've attached a small file of my attempt to get this to work for kicks.

    Any ideas/suggestions would be greatly appreciated.

  • edited May 2016
    Any ideas/suggestions would be greatly appreciated.
    The Twine 2 application does not understand advance markup links like $return so it incorrectly created the "$return" passage automatically for you, just delete the "$return" passage and the technique will work.
  • greyelf wrote: »
    Any ideas/suggestions would be greatly appreciated.
    The Twine 2 application does not understand advance markup links like $return so it incorrectly created the "$return" passage automatically for you, just delete the "$return" passage and the technique will work.

    Aarg, thanks a bunch for that, greyelf. I was thinking it was something I had stuffed up in the javascript or something. I was hoping the solution was something simple :)
Sign In or Register to comment.