0 votes
by (690 points)
I'm working on an RPG with a shop mechanic. In the past my games have just had one location, but this one will have more. I don't feel like making more than one "shop" passage, is there a Macro I can use to set a return without making multiple links to the various locations?

If so that would be really useful...

1 Answer

0 votes
by (63.1k points)

You can do this in a number of ways based on your needs.  Assuming that no other links are available from within the shop, you could use the previous() function or the <<return>> macro*:

[[Go back.|previous()]]


<<return 'Go back.'>>

However, if other links are available, such as links that allow you to look at the items, or links in the StoryMenu, you can instead save the passage the player went to the shop from in a variable:

:: outside the shop
[[Go into the shop.|shop][$return to passage()]]

:: in the shop
[[Go back.|$return]]

You could also use tags to control this: http://twinery.org/forum/discussion/1821#msg4762.  A system like this has the benefit of being a bit more automated.

* Note that the <<return>> macro is probably what you'll want to use here, not the <<back>> macro.  The latter pushes the State history back one turn, which will undo story variable changes, and probably undo anything the player does in the shop, while the <<return>> macro goes back to the previous passage, but does so by creating a new moment in the history, preserving any changes to the State and other variables.

by (690 points)
Thanks for the help, this will be very useful. Epecially since I also learned of the (linkrepeat) macro
by (690 points)
edited by

How do I add the Passage Tag to this, It just keeps creating new Passages. That link brought me to an answer for Sugarcube, and the format looks very different from Harlowe...


I figured it out using $vars...