Twine: ever-growing Jonah (repeats previous visited passages)

Update: this has become the default behaviour in Twine 1.4, so this is no longer necessary.

This code will alter the Jonah format such that:
* All passages are now added to the bottom, regardless of where you click the link.
* Clicking a link to a previously displayed passage will display a new version of the passage at the bottom, instead of scrolling up to the old version.

This is based on a bit of code used by E. Turner in some of his Twine games. Unlike in those games, this code also preserves the "Rewind to Here" link's functionality.

Obsolete script removed: use Twine 1.4

Remember, this goes in a disconnected passage with the tag "script".

Feel free to report any bugs to @webbedspace.

Comments

Bug?

Does this require a particular version of Twine/Twee? I'm using twee 1.7.1, and I get an error when adding this to a simple test file:

There is a technical problem with this story (Ever-Growing Jonah: ps is null). You may be able to continue reading, but all parts of the story may not work properly.

("Ever-Growing Jonah" is the name of the passage I pasted the code into).

I did a minor fix - try the

I did a minor fix - try the code now.
FWIW this is designed solely for Twine 1.3.5.

Issue with arrays and variables

Hey, I'm having an issue with this perhaps you can help.

I have a variable set up as an array that is updated whenever the user clicks a link. Then when the user loads an inventory passage each item of the array gets put on its own line and links to its own passage. This is all working fine. My issue is after continuing the story and adding more items to the array I cannot get the inventory to update, even with this script.

However if I just print out the array in a passage I can get a comma separated list that updates if I add new items.

I hope that I explained this well enough.

Thanks!