Howdy, Stranger!

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

Help with return and back in sugarcube 2

I'm using Twine 2 and Sugarcube 2.

Recently I asked how to avoid return loops and got the answer to use the following:
predisplay["Menu Return"] = function (taskName) {
	if (! tags().contains("noreturn")) {
		State.variables.return = passage();

This works fine in some cases, but it turns out that many situations need the equivalent of the back macro, not the return macro, as returning to certain passages sets variables too many times. How would I get that with a function, or otherwise skip parts of the history with a back macro or similar function?

The problem could be sidestepped if I could determine which passages the ui bar shows up in. Is there a way to do that? I think I've seen it in some games.


  • The <<back>> macro states (paraphrasing) that if you use the <<back Previous Passage Title>> format then it will Go back to the most recent "Previous Passage Title" passage, with the link text "Link Text".

    note: I am not at a machine with SugarCube 2 installed, so I have not tested the following.

    Try replacing a $return link with:
    <<back [[Back|$return]]>>
  • edited October 2015
    Thanks, it seems like this did the trick.
Sign In or Register to comment.