Twine Version: 2.8.1
Using Harlowe 3.3.8
I’ve created something that mostly does what I want. Using the code below I’m able to filter all passges in my story and get a list of only the ones with a specific tag.
(set: _PassageNames to (altered: via its name, ...(passages: where its tags contains _tag1)))
I am then using this list of _PassageNames elsewhere to populate a Cycling Link. My one issue is that the (passages:) macro returns the passages in alphabetical order. I was hoping to find a way to show them in the order they are laid out in the actual story.
If there is a simple way to do this, that would be great. But given how hard it is for Twine to know the order in which things may be seen, I assume this may not be possible.
If so, if I named my passages like “1.1) xxxxx”, “1.2) xxxxx”, etc., I think that would work. But how would I retrieve the list of passage names while removing everything before “xxxxx” title? Would there be a way to list the passage names without having to show "x.x) " in the Cycling Link text?
Edit: several people have confirmed what I suspected; that sorting/ordering chronologically using the passage data isn’t possible. In that case, assuming I am using a Story Format that orders alphabetically by name (like Harlowe), would there be a simple way to do it if I named them with numbers at the beginning? Would I be able to take the output of the (altered:) or (passages:) macro and replace/remove the number at the beginning of each passage name?
there’s a serious problem in listing passages: Twine internally (and also externally…) stores the passages with the last edited on the very top. (this renders the .twee files hard to understand in figuring the story flow) so one needs a pathfinding algorithm, starting from the “start here” passage to the end of every path. and I undescore, every path. Not an easy solution to your problem, I fear…
Best regards from Italy,
dott. Piergiorgio.
1 Like
An Author may decide to do many things when it comes to the “order” a project’s Passages might be seen in (visited), some of them are:
- have “hub” or “location” Passages that the Reader may travel through repeatable. (eg. a group of Passages that represent the rooms of a home)
- use logic to display the contents of “child” Passages within the body of visit-able Passages.
- have the order a set of Passages are visited in depend on conditional logic.
- other means that “links” may be used to cause a Passage to be visited. (eg. SugarCube’s
Config.navigation.override
handler)
So there are many reasons why the Twine 2.x application would not be able to determine the potential order that a project’s Passages will be visited, so there is no point for the application to try and store those Passage’s meta-data in such a sequence.
note: The following is from memory, the process may of changed.
The Twine 2.x generally stores Passages in the order of creation, as that is the order Passages are assigned their unique numerical identifiers in. If a Passage is deleted then the Passages with a higher identifier will be renumbered so all the assigned identifiers are sequential.
It is up to the Story Format Developers to decide if they store Passage meta-data in memory at runtime, and what order they store that data. It’s also up to the Developer to decide how the functionality of their Story Format is implemented.
eg. Harlowe’s (passages:)
macro sorts the list of Passage objects by name before it returns the list.
2 Likes