Please specify version and format if asking for help, or apply optional tags above:
Twine Version: 2
Story Format: Harlowe 3.1
Under every story passage, I have a footer passage with some stats and a “Settings” link. This sends the player to a “Settings” passage, where they can configure some preferences and then return.
In order to return, in the footer passage, I have included:
(set:$current_passage to (passage:)'s name)
Then, in the Settings passage, I make the “return” link thus:
[[Return|$current_passage]]
The question is: since the above (set:) happens in the footer passage (and not the main story passage), how come the $current_passage is not the footer itself?
As I was writing it, I thought “well, this won’t work, but let’s try it.”
If you used your web-browser’s Web Developer Tool to Inspect the HTML elements that make up the main ‘story’ area of a Harlowe based story that includes a footer tagged passage you would see a structure something like the following…
<tw-story tags="">
<tw-passage tags="">
<tw-sidebar>
<!-- The contents of the Side-bar removed for brevity sake... -->
</tw-sidebar>
The contents of the 'current' Passage.
<tw-include type="footer" title="StoryFooter" data-raw="">
The contents of the footer tagged Passage.
</tw-include>
</tw-passage>
</tw-story>
As you can see the <tw-include> HTML element containing the ‘footer’ contents is actual a child of the <tw-passage> element that contains the contents of the ‘current’ Passage, as is <tw-sidebar> element containing the left-side bar’s contents. A ‘header’ tagged passage behaves the same way except the element containing its contents is added just before that of the ‘current’ Passage.
This parent-child relationship is why passages like ‘header’ tagged or ‘footer’ tagged ones, or ones included using the (display:) macro aren’t considered ‘current’ or tracked by the History system’s (passages:) macro.