Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

[SugarCube] Jonah-style passages?

Is it possible in SugarCube to get Jonah-style scrolling appended passages? Is this easy or hard?
Ideally, you'd be able to get a clean slate with some passages (like a passage with a "Chapter" tag, for instance) but the rest would append on and scroll down.


  • This is still in Jonah, but it has some of the ideas of what you're looking for. The OP created a way to make a 'clean slate' with hub passages, which could be your Chapters. With some tweaking, I got it to work pretty well for me -- but again, still in Jonah.
  • Thanks! I'll take a look. A lot of interesting things in there. I'm using a lot of the SugarCube macros, etc so I suspect I can't switch to Jonah.

    I was hoping there was a simple way or some code that someone had already written for SugarCube...
    I suspect not...
  • Alternatively, you could just use div boxes to imitate Jonah passages... They could still be triggered by clicking on a word (at least, in Sugarcane; I haven't really used SugarCube, but it shouldn't be hard) and unfold underneath your current text. You can add borders and so on to make them look fancy and 'separate' from the beginning passage. Depending on how many unfolding passages you have, it could get to be too much work to do it manually, but it's a thought, if you're desperate.
  • Can second using div appending is a, well, workable solution in sugarcube. It's what I use in my current project to break scenes into interactive, flowing segments and works reliably. I used click macros with appends to bring in new content (since append includes a wikifier, it will process all variables set previously by the main scene).

    Thee append / click functionality could be abstracted into widgets, displays or pure js functions. It didn't prove practical in my case (there are too many exceptions to the flow) so I coded the control logic by hand.

    There is however an issue: since you're not calling a passage transition during the scrolls, everything you do withing a given 'scrolling scene' is temporary until the next passage is reached. This means that reloading a page will clear the content called through appending but not the variables set (which I worked around by loading autosaves on page reload).

    The better way to work around this would be to separate the append calls from the click macros so that refreshing causes the content to be appended in the correct order, regardless of whether the page is refreshed or loaded cleanly. Wasn't necessary in my case but for longer jonah-style passages it would almost be a necessity.
  • You will also need to be aware that if the Reader goes backwards (using the browser's back button) through your story they may be surprised when the story seems to jump back multiple "passages" for a single click.
Sign In or Register to comment.