User Tools

Site Tools


Sidebar

Passage markup

basics

coding

extra

list

section

whitespace

Macros

basics

colour

data structure

date and time

game state

live

maths

number

revision

saving

showing and hiding

string

styling

url

deprecated

Types of data

Special keywords

Special passage tags

harlowe:load-game

(load-game: String) → Command

This Command attempts to load a saved game from the given slot, ending the current game and replacing it with the loaded one. This causes the passage to change.

Example usage:

{(if: $Saves contains "Slot A")[
  (link: "Load game")[(load-game:"Slot A")]
]}

Details:

Just as (save-game:) exists to store the current game session, (load-game:) exists to retrieve a past game session, whenever you want. This command, when given the string name of a slot, will attempt to load the save, completely and instantly replacing the variables and move history with that of the save, and going to the passage where that save was made.

This macro assumes that the save slot exists and contains a game, which you can check by seeing if [[harlowe:saved-games|(saved-games:)]] contains the slot name before running (load-game:).

This command can't have changers attached - attempting to do so will produce an error.

In the event that the saved data exists, but contains an error - for instance, if it refers to a passage which doesn't exist in this story, which could happen if one version of the story is used to save it, and another is used to open it - then a polite dialog box will appear asking the reader whether or not the data should be deleted. An example of such a dialog is below.

Sorry to interrupt... The story tried to load saved data, but there was a problem.
The data refers to a passage named 'example', but it isn't in this story.
That data might have been saved from a different version of this story. Should I delete it?
(Type 'delete' and choose OK to delete it.)
Either way, the story will now continue without loading the data.

See also:

harlowe/load-game.txt · Last modified: 2019/04/16 03:13 by l