Creating multiple save slots in Harlowe?

Twine Version: 2.6.2

I’m currently trying to create a game that will have a start menu with multiple save slots- how do I go about that? Ideally, I want it to default to “Start New Game” unless there is a pre-existing save, at which point I want there to be a “Load Game” button.

My main question here is how do I set up the system for save slots- I want to start with about 5- but if you’d be able to help with the menu thing as well, I would appreciate it.

You’ll need (load-game: ), (save-game: ), and (saved-games: ) macros (here’s the documentation for more deets in the explanation).
I’ve implemented save slots using the built-in sidebar as a simple “menu” - there’s a link to open up the save slots and that’s about it. For that, I used (link-repeat: ) to run the loading/saving commands, like this:

{(link-repeat: "Slot A")[(save-game:"Slot A",)
	(if:(save-game:"Slot A"))[<br>Saved!](else: )[<br>Error: game not saved.]
]
(if:(saved-games:) contains 'Slot A')[<br>(link:'Load Slot A')[(loadgame:'Slot A')]]}

{(link-repeat: "Slot B")[(save-game:"Slot B")
	(if:(save-game:'Slot B'))[<br>Saved!]
	(else: )[<br>Error: game not saved.]
]
(if:(saved-games:) contains 'Slot B')[<br>(link:'Load Slot B')[(loadgame:'Slot B')]]}

{(link-repeat: "Slot C")[(save-game:"Slot C")
	(if:(save-game:'Slot C'))[<br>Saved!](else: )[<br>Error: game not saved.]
]
(if:(saved-games:) contains 'Slot C')[<br>(link:'Load Slot C')[(loadgame:'<br>Slot C')]]}

And so on, to get the 5 save slots. For the menu, you could create a passage with all the save slots, then link to it from your start menu. (Apologies if the code formatting is funky, I’m on my phone and it’s allergic to code blocks…)

1 Like