0 votes
by (120 points)
reshown by
Hi there, I've been trying to resolve this issue for a while now but I'm very much a beginner when it comes using Harlowe (or any programming in general!). I've seen some questions related to this, but perhaps due to my beginner's knowledge, I wasn't able to get an answer to my issue from them.

I'm trying to make a game which has a diary function of sorts; ideally, the player would be able to complete a short chapter, then save this under a name of their choice. They could then reopen the game, complete another chapter, and save this under another name of their choice. Once they've saved one chapter or more, they should also be able to load them from a loading screen.

I've managed to create a single save file based on the notes in the Harlowe manual, but I'm really struggling to understand how to allow for multiple saves on the same device, and how to present those to the player once they've happened. Is this actually possible? If not, is there some other way the user could save those chapters to look back on later? The main thing for me is that they'd be able to look back on each individual completed chapter later on, whether inside the game or outside.

Thanks for reading and any advice!

1 Answer

0 votes
by (159k points)

At the end of each chapter you could use the (save-game:) macro to save the state of the game's History at that point, and then use the (reload:) macro to restart the game.

Blah blah blah
(save-game: "end-of-chapter-1", "End of Chapter 1")

(link: "Restart the Game")[(reload: )]

You can use the (saved-games: ) macro to access the information about all known saves, the (datanames:) macro to obtain the slot-names assigned to each of them, the (for:) macro to loop through those slot-names, and the (print:) macro to output the Special Filename (*) associated with each slot.

Known saves:\
(set: _saves to (datanames: (saved-games: )))\
(if: _saves's length > 0)[\
	(for: each _slot, ..._saves)[\
		<br>(print: (saved-games:)'s (_slot))\

(*) While the documentation of the (save-game:) macro calls the second argument passed to the macro a Special Filename (and I have included the same term in the above comment) this value isn't actually a filename, nor does it have anything to do with files.

by (120 points)
Thanks for your answer! I tried implementing this, but when it came to accessing and printing known saves, I got messages saying '_saves is not defined' and '_slot is not defined' - is this what you are referring to with the Special Filename?