Howdy, Stranger!

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

How to prevent save slot overwriting, and create a new save for every new game - Harlowe

I would like for the (save-game:) macro to allow for non-overwriting of saves for more than just two slots. As far as I can figure out in the documentation for Harlowe, you can make an (if:) statement to have it check if a game is already occupying "Slot A" and have it save in "Slot B". However, this would always overwrite the save in "Slot B". I attempted to do a bunch of (if:) statements back to back, to check if "Slot A" is filled, then "Slot B", then "Slot C" and so forth, until it found an empty slot. But I got a bunch of errors, 'cause I guess you can't run (if:) macros back to back like that. So really, what I would like, is a way to have every new game have its own save slot. Whenever the player starts a new game, say, "Game 1", they have no save until they click to save the game. Then that saves in "Slot A" and every time the player saves the game, it will overwrite "Slot A", since "Slot A" is reserved for "Game 1". Then when a different player plays on the same computer, they click to begin a new game and whenever they save, the new "Game 2" will always save in "Slot B" and overwrite any previous saves in "Slot B".

So, create a new game, reserve a save slot for only that game and prevent any other game from saving in that slot. Allow the use for multiple games that all have separate reserved save slots that they can overwrite the saves in that slot to always hold the most up-to-date save for that game, but never overwrite a save from another game.

Thank you for any and all help you can give me and I apologize for any confusion.

Comments

  • You can name your games saves anything you want, they don't have to be "Slot A", "Slot B", etc.

    eg. If your first game is named Bunnies you could name the saves "bunny1", "bunny2", etc... and if your second game is named Pyjama Party they could be "pjp1", "pjp2", etc.

    I can't think of an easy way to identify one player from another without asking them.

    If you want to test that a slot has not been used yet the can us an (if:) macro with the not keyword, place the following in a passage. Pressing the "Same game" link will determine which slot is free, save to that slot and the show the current passage again. The displayed list of used slots should grow until all three have been used.
    (set: $saves to (datanames: (saved-games:)))
    Saves: (print: $saves)
    {(link: "Save game")[
    	(if: not ($saves contains "bunnies1"))[
    		(save-game: "bunnies1")
    	]
    	(else-if: not ($saves contains "bunnies2"))[
    		(save-game: "bunnies2")
    	]
    	(else-if: not ($saves contains "bunnies3"))[
    		(save-game: "bunnies3")
    	]
    	(go-to: (passage:)'s name)
    ]}
    
    ... the above is just an example, it may not be the best way to do what you want.
Sign In or Register to comment.