Help with Save System


So I’ve discovered this handy little post:

Only problem is, I’m not 100% sure I know how to use the thing.
Ok, I’ve got the system working fine. Now can someone teach me how to make use of it?
Basically I want a bare-bones save system. These are my only requirements:

  1. Right at the start the player has the option of creating a new game or loading a previous save.
  2. At certain points, the game will automatically save to one of two slots (the player has no choice as to where he wants to save - one slot will contain the save from the beginning of the chapter, and one from the last checkpoint within the chapter) and tell the player ‘a checkpoint has been saved’.
  3. If you enter a ‘fail’ situation or die, the game will ask you which slot you want to load.

And that’s all I need. Can someone - @CJW perhaps? - help me figure out how to do this?


See the working smPlugin example perhaps?

I simply don’t have time to implement specific Choicescript code for everyone, but as long as you’ve got smPlugin.js file included, I think between looking at the example file and using your head, you should have no problem implementing what you need.

For example the checkpoint functionality should be nice and easy - everytime you want there to be a check point, just do something like this:

bla bla story story
You've reached a checkpoint and your game has been saved! 
*sm_save checkpoint name | false
bla bla more story story story

The front menu and the die stuff will be a tiny bit more tricky but the example code should be more than enough to get you started. If you’ve any more specific or technical problems, I’ll be happy to help - feel free to post here or send me a PM; but I’m not going to code it for you.


I think I’ve figured out the code. Now I just have to test it to see if it works.
Thanks for the help, and for making several coders’ lives a lot easier! :slight_smile:


Does using the save system break Quicktest? Because I get this:
Error: startup line 13: Non-existent command ‘sm_init’”


yes, sm_init is not part of CS, so Quicktest has no idea what it is.



@JimD is right the entire save system is basically editing the code. So its not official this also means if you want to submit a game you will have to remove it prior to submission.


Yup, as above; smPlugin is a plugin (would you believe it?! :D) which extends the ChoiceScript language with additional commands, which of course, quicktest doesn’t know about.

Best way is to just comment/uncomment the commands when you need to test, there’s a thread here that discusses using macros to do this automatically which may be of some help.


Ok that helped loads. Thanks :slight_smile: