Ok, so I have a strange situation, involving the brilliant 'previous()' function thingy, that lets you go back without having to specify where "back" is. (
http://twinery.org/wiki/twine_1.4_release_notes#macro_syntax_functions).
In the game that I am making, I have several "item" pages added to the menu (map, inventory, sword, etc). Each of them ends with a "back" link: [[Back|previous()]], thus making it possible to visit the menu pages at any time without losing your place within the game. HOWEVER, if you to visit a menu page, and then click directly onto another menu page link (and thus not using the back link), you become trapped in a limbo between the two. For example: you click on "inventory." Then, instead of hitting "back," you click on "map." Now the map's [[back|previous()]] will send you to... the inventory. Click on inventory's [[back|previous()]], and it'll send you to the map, and so on...
It's not a major issue. I can write a warning to people to always use the "back" links. But does anyone know a more elegant solution? Is there a way around this? maybe some kind of combination of visited() and previous()? I've yet to learn any javascript...
Comments
previous()
.P.S: In Twine 1.4.1 you can use passage() instead of state.history[0].passage.title.
unimportant
... though I don't know how widespread this specific use case is, compared to the similar but distinct case here that might also be worth some built-in support.http://twinery.org/forum/index.php/topic,708.0.html
I think it's really something we should take a look at. As L said, though, it's hard to think of an alternative way.
previous()
.Ok, so I AM using the actual menu to display links to their own passages for the items, but I tried this method and it worked anyway. It means I'll have to add <<set $last to state.history[0].passage.title>> to every regular passage in the entire thing, which is a bit cumbersome, but at least it'll work! Thanks for the idea.
Would you be able to give a syntax example of how to use that for the scenario in this thread?
I have the exact same problem with a inventory passage that has other links pertaining to the inventory, so I get the same looping problem. Would passage() have to be used in every passage like in the work around someone suggested?
Thanks.
**Update**
I worked this out in the end with the same method already mentioned in this thread. Using something like this <<set $pasHist to passage()>> in every passage and then in say, an inventory passage using [[Back|$pasHist]].
The advantage is that you only need to code it in your inventory pages...