0 votes
by (120 points)
I have a pretty huge Harlowe based game, running for 8 months now (twine 2). My players are constantly asking for save to file option. (there are weekly game updates, and they always lose their progress)
I understood this function is available by default in SugarCube, but not in Harlowe.
My question is if there is any method to solve this?
I checked both the js sources, but my js knowledge is not good enough to implement SugarCube save load functionality to Harlowe.
I'm also ready to pay anyone who can solve this. This case pls contact me at palmuranyi@gmail.com

2 Answers

0 votes
by (2.7k points)

Place this inside the passages that you want a "save" and "load" option inside:

(link:"Save game")[
	(if:(save-game:"Slot A"))[
		Game saved!
	](else: )[
		Sorry, I couldn't save your game.
(if: $Saves contains "Slot A")[
  (link: "Load game")[(load-game:"Slot A")]


by (23.6k points)
That won't save it to an external file though.
0 votes
by (159k points)

The Harlowe story format doesn't have a documented Javascript API and it has been deliberately designed by it's developer to restrict the access a story Author has to the internal data & functionality of it's Javascript based engine.

While it should be possible to create a Javascript based hack which allows access to the relevant History data stored within the internals of Harlowe engine, and then to use further Javascript to persist said data to a local file and to also retrieve it from such. I believe there are two better solutions.

1. Use Javascript to create functionality that can persist to file the 'save' data stored by Harlowe within the web-browser's Local Storage area, and to overwrite that 'save' data with the contents of the file.

This way you don't have to hack the Harlowe engine to access it's internal History state, and you can still use the standard (save-game:) & (load-game:) macros.

2, Fork the existing Harlowe source code repository to create a new custom story format that includes the required functionality, this would allow the "persist to file" and the "retrieve from file" features to be actual macros.

note: both of the above suggestions require time to implement the relevant Javascript functionality and to test that it works within all modern (and legacy?) desktop & mobile web-browsers.
(each environment and web-browser can have it's own restrictions when it comes to local file access)