0 votes
by (120 points)
So, thats the question!

1 Answer

+1 vote
by (154k points)

Harlowe doesn't currently have a built-in method for deleting Save Slots, but you can use Javascript to do it.

warning: The following information is based on the code for v2.1.0 of Harlowe and was valid at the time this answer was written, it could become invalid if the developer of Harlowe later decides to change how the following storage Key name is generated.

background:
Harlowe stores the data associated with a Save Slot as a Key/Value pair within your web-browser's local storage area. The Key for each Save Slot is made up of three parts:

1. The text Saved Game
2. The IFID associated with your story. (a UUID automatically generated for you) 
3. The name you gave the Save Slot

... so assuming that the Save Slot is named Slot 1 and the IFID is cd36d31a-8eb6-4121-9ecc-9a88d553440e then a correctly formatted Key would look something like.

(Saved Game cd36d31a-8eb6-4121-9ecc-9a88d553440e) Slot1

 

The following Javascript example needs to be placed within your Story Javascript area, it creates two functions:
1. The getStoragePrefix() function, which is used to obtain a String combining parts 1 and 2 of the Key.
2. The deleteSaveSlot() function, which will delete the Save Slot you specify part 3 of the Key for.

window.getStoragePrefix = function () {
	return "(Saved Game " + Engine.options.ifid + ") ";
}

window.deleteSaveSlot = function (slotName) {
	localStorage.removeItem(getStoragePrefix() + slotName);
}

Assuming your Save Slot is named Slot 1 then you could use code like the following within a Passage to delete it using the deleteSaveSlot() function.

(link: "Delete Slot 1")[
	<script>deleteSaveSlot("Slot 1");</script>
]

 

by (1.6k points)
Well, I don't know if the OP ever figured things out, but I certainly found this information valuable. Just implemented this in my game. Thanks again, greyelf!
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...