I mainly use Sugarcube. I need a code that lets me use the <<display>> command for the last visited passage. I used to have it display a fixed passage, but that's become a big pain and I'd rather just have it display the previous one.
I understand <<return "Home">> and
previous() are great functions for returning to the previous passage, however, I want to code this so the player doesn't have to click a button.
What I'm doing specifically is having the player click a button "MORE" to increase a value, with certain checks to make sure the value does not go over the maximum. Upon click "MORE", they're directed to a passage with a few "ifs" and "sets" syntax, then directly routed back to the original passage with a <<display originalpassage>>
However, more than one passage now links to the "MORE" and I don't want it to constantly link to <<originalpassage>>, so is there a way I can get it just to relink to <<display previous>> ?
I'm also vaguely aware you can put variables in a link, like
Hub][$roomJustLeft to 1, but I've tried that it doesn't seem to work for me. Maybe I'm just using the syntax wrong, but the function essentially needs to refresh the passage with a few new values, instead of linking to a hard passage id.
If anyone can help me with this, it would be greatly appreciated
Comments
Assuming that you want to use the <<display>> macro, there are two basic ways to do what you asked:
1. Using a variable: 2. Using a <<print>> macro: That syntax is correct but due to a known limitation of Twine 2, the automatically created new passage will have the wrong name of Hub][$roomJustLeft to 1.
You will need to edit the new passage and change it's name to Hub.
I think my biggest problem was assuming the <<display>> macro placed the player back in the first room instead of just displaying the first room's information from within the second room. Using the <<goto>> macro will solve the problem I was having, thank you.