So I'm using the new version of Harlowe (which seems awesome by the way) and I want to add save functionality to the game I'm working on. One thing I'm not sure on, though: is it possible to ERASE a player's save?
Hmmm... okay so let's say I have a single save file which I've made with (savegame: "XYZ", "A REAL SAVE"). I can overwrite that save by going (savegame: "XYZ", "DELETED") at some other point, right? If I did that, would I then be able to only display the "Load Game" option if (savedgames:) contains "A REAL SAVE"? In other words, "erasing" the file by preventing the option to load it?
As in:
(if: (savedgames:) contains "A REAL SAVE")[blah blah blah link to a passage with loadgame in it]
Or does that contains thing only work with slot names and not filenames?
Datamaps consist of key->value pairs. The "contains" operator only checks keys in datamaps, and the datamap produced by (savedgames:) has slotnames in key position, with filenames in value position. So, that won't work.
HOWEVER, you can use the brand new (datavalues:) macro to put all the datamap's values into an array, and then use "contains" on it:
(if: (datavalues: (savedgames:)) contains "A REAL SAVE")[blah blah blah link to a passage with loadgame in it]
Comments
As in:
Or does that contains thing only work with slot names and not filenames?
HOWEVER, you can use the brand new (datavalues:) macro to put all the datamap's values into an array, and then use "contains" on it:
This should work as you hope.