Looking for something that allows players to save 'on the fly' (like save.js) but with multiple slots? Try the smPluginMenuAddon.js
Release - smPlugin.js
The new 'framework' save system is done.
I don't currently have the time or willpower to write up proper documentation for it.
There's a demo here, which should be enough to grasp the general concept:
Instructions and Basic Info in a Nutshell
Uses browser localStorage to store/restore generated between browser sessions on the same computer/device. Older browsers, some mobile browsers etc do not support localStorage.
If a browser doesn't support localStorage the system shouldn't stop your game from working, it'll only inform the player they can't save - not actually "crash" - let me know if it does.
Must be used before any other sm commands, right at the top of your first scene file is ideal. This initializes the system, checks for previous saves etc.
It takes two arguments, the name of your game and the number of save slots.
Try to choose these two values carefully when you first implement this system and stick with them. Changing the game name will result in loss of your player's saves.
*sm_init mygame | 5
Does exactly what it says on the tin. Saves the game (if it can).
This one takes three arguments, the first two are compulsory and the last one is optional.
The first one is the slot number the game should save to, it HAS to be a "number" and it has to be a WHOLE number - it also has to be between 0 and your number of slots (as declared with sm_init).
The second argument on sm_save is the type of save, there's two:
Hidden Saves & Shown Saves
Hidden saves will just save like that without any input from the player, nor any notification that a save has taken place.
Shown saves will prompt the player to save (but he can decline), it'll also allow them to rename a save, if they so wish.
Shown Save to slot 3
*sm_save 3 | true
Hidden Save to slot 3
*sm_save 3 | false
The last argument is optional (the above code examples will work) and is the save name. For both shown and hidden saves you can provide a 'default' name for a save - this is particularly useful for hidden saves, where the player cannot rename them themselves.
For example we're coding our game and come to the end of a chapter - we don't want to ruin the experience with a big ugly 'please save' popup, so we'll do a hidden save. However, we want the player to know (when loading) exactly where he is - he won't remember 'saving' this one after all.
Hidden Save to slot 2 with a default name
*sm_save 2 | false | End of Chapter 5 - Close Call
Now when the player tries to load a save, this one will appear with that name.
If you don't provide a default name a time and date will be used instead.
Much like sm_save, sm_load does exactly what you think it does; loads saves.
It takes the same two compulsory arguments as sm_save, the slot number from which it should be loading and the hidden/shown parameter.
Force load a game from slot 3
*sm_load 3 | false
Prompt the player to load a game from slot 3
*sm_load 2 | true
Takes one argument, the slot number.
Again it has to be within the bounds of your defined number of slots, so watch that.
Deletion will ALWAYS prompt the player you can't silently delete saves, yet. I might add it in if there's popular demand.
Note on Slots
THINK! This is a do-it-yourself framework, not a automatic system like the save.js - There are many ways and means by which you can use these commands. Experiment a little, find what works for you.
If you're going to mix manual and 'automatic' saving, keep the slots separate. Players won't be happy if you're constantly overwriting their manual saves with automatic ones.
Say slot 0 is the automatic slot, don't allow manual saves to slot 0. Simples.
Have fun, report bugs, make cool games etc etc ^^'
Oh yeah... The system uses the typical js notifcation boxes, not alertify.js' because IE kept throwing a tantrum and I'd personally rather have the functionality over the aesthetic appeal.