How to implement endless scrolling?

Twine Version: 2.8.1.0
Harlowe Version: 3.3.8

I was wondering how to create an “endless page” effect like in a story by ztul on itch, “my father’s long, long legs”.

The only thing I would want to change is that it would be inverted scrolling.

I’m trying to make it so that the player has to interact with the story and “climb” the page. So far I’ve achieved this by nesting multiple ‘(link-replace:)’ in one another. The problem with this though is creating branching parts to the story. If I want to create any kind of branching parts of the story then I would have to use ‘(if:)(else:)’ instead of creating different passages and linking to them normally. Currently, I have only one passage in total with the nested properties in it. Is there a way to get around having only one passage while still keeping the endless scrolling effect?

2 Likes

FYI: That project was built using the Jonah Story Format, which was available with the discontinued Twine 1x. application. The closest Twine 2.x application compatible equivalent would Paloma, but that Story Format hasn’t been updated in more that 5 years.

There are two main issues with implementing an “endless scrolling” (or “stretch-text”) type project using any of the main Twine 2.x Story Formats:

1: Progress History is only updated during the Passage Transition process.

Which means that Story Variables changed made within the Passage being visited (a) are not persisted to Progress History until a Passage Transition transitions occurs.

2: A web-browser “page” refresh causes the Passage being visited to be re-processed.

Which means that any alterations that were dynamically done to the current “page”, like the displaying of additional content in response to link selection, are lost/reset. And mobile based web-browsers can preform such a refresh when someone switches back to the web-browser after viewing another app, like after taking a call or reading a message.

But putting those issues aside, one way you can prepend content above other content is to use the (prepend:) macro to add content to a Named Hook.

|output>[]
Hello there...
(link: "Select me 1")[(prepend: ?output)[Nice to see you]]
(link: "Select me 2")[(prepend: ?output)[I hope you are doing well<br>]]

note: a HTML <br> line-break element is being used to insert a line-break between the two additional lines.

And the additional content being inserted can be from another Passage…
(Twee Notation based example)

:: This Passage
|output>[]
Hello there...
(link: "Select me 1")[(prepend: ?output)[Nice to see you]]
(link: "Select me 2")[(prepend: ?output)[(display: "Some other Passage")<br>]]

:: Some other Passage
I hope you are doing well

(a) or within Passages that are included into the visited one via features like the (display:) macro.

3 Likes

Thank you so much, this is exactly what I was looking for! I was about to lose my mind trying to figure out how to not nest 9 million (link-replace: "text")[

I’ll check this out because it seems interesting, but I’ll probably stick with the (prepend:) macro instead as it works for me in the short term. This is more of a proof of concept for than anything. Thank you very much anyway!

I’m running into another problem though… I only want one choice to be shown and then the other one to not display when one choice is taken. how would I do that? I’ve been trying to use variables to do that but I don’t understand how it would work. Would I have to set the var to false in the Startup passage beforehand?

Building off of Greyelf’s example, you can wrap the links with named hooks and hide the the hooks you don’t want to display anymore upon clicking the link…

|output>[]
Hello there...
|1>[(link: "Select me 1")[(prepend: ?output)[(hide: ?2)Nice to see you]]]
|2>[(link: "Select me 2")[(prepend: ?output)[(hide: ?1)I hope you are doing well<br>]]]

For more information about the (hide:) macro, visit this section of the Harlowe manual…
https://twine2.neocities.org/#macro_hide

1 Like