ChoiceScript Saving Plugin (Update: April 2023)

@CJW

I’ve just had to remove the save system from Unnatural in preparation for submitting it to Cog. Do you have any plans to submit the save system itself to Cog?

@Nocturnal_Stillness Nope, it’s not necessary - all the published games (that I’ve played) have an adequate save-state functionality already built in :slight_smile:

And my system isn’t comprehensive enough (to guarantee working across the board on all devices).

@CJW A few people has said that the save system has been giving them problems, right now, and it’s a bit buggy when they tried to save. I’m unsure of what’s wrong because I copied & pasted the example you wrote, so that I won’t get anything wrong and stuff. It works perfectly fine when I tried it out, though.

Apparently, if it was saved on a phone and they continue on with the chapter, they would get an error saying: “QuotaExceededError” or something similar to that, and then they would be forced to restart. It doesn’t happen if they don’t save, though.

I don’t want to bother you during Nanowrimo, so if you don’t want to hit this up until November ends, that’s fine. But I’ll still be posting this up for now, in case I’d forget about it later.

iPhones?

The phone browser(s) in question are unable to save because of (likely) one of the following:

  • Private mode/disallowing data storage/cookies
  • They’ve reached their local storage limit (they’ll need to clear data in their browser settings)
  • Their browser doesn’t support local storage (this would be unlikely to throw *that* particular error though).

The link above refers to the first option in Safari on iPhones, I believe Private mode is often on by default and seem to recall someone had a similar issue on an iPad.

Hey guys, i already got the system working in my game and its auto saving at certain stages. What would need to be done to increase the slot numbets in order to avoid overwrites?

Thank you.

You need to use smPlugin.js, save.js doesn’t support multiple slots.
If you’re using smPlugin you define the slot count with the *sm_init command.


*sm_init mygamename | 5

Or similar :slight_smile:

I know this is an ancient thread.

I would really like to install a save system in WIP before I upload the next chapter for everyone to play. However, reading through all the changes in this thread has me confused. Is there a save script still around, and if so, how do I install it?

Thanks @CJW and everyone else!

:slight_smile:

@LadyCass, sorry I got the notification for this while out of the house and forgot about it for a while.
I do believe the save-systems are still in use and should still work with the latest copy of CS, but if they don’t, please just let me know and I’ll fix them right up.

There are two, there’s an automatic, easy-install one: save.js
Or a more complicated framework one that adds save-based commands to the CS language for you to use however you please. You can check the first post for links and instructions etc : )

Thanks @CJW! I will try it out when I finish this next chapter. Fingers crossed. :slight_smile:

@CJW, maybe you can help me out here…my coding skills are pretty rudimentary. How do I do this step?

When I try to open the index file, it opens the game in the browser. I don’t know how to install it as a script.

I’m sure this is really simple, and I just don’t get it.

Thanks so much!

Oooo…never mind… I figured it out!

:slight_smile: :slight_smile: :slight_smile:

@CJW, many thanks for sharing this brilliant system with everyone.

I’m currently using the simplified version of the save system in a game that features achievements.

The save system works excellently for allowing the game progress to be saved and reloaded. However, when I close the browser and load the save, all my achievements are lost.

Do you have any plans to update the save system to work with achievements? Do you believe this is even possible?

Having thought about it, I don’t think this could be solved through the save system, because achievement progress is independent of your save game (i.e. you could have three save games with different achievements in each). Therefore you couldn’t use the save system to restore achievement progress.

I don’t know how you would get around this, but I need to give it some more thought.

I haven’t updated this since achievements were implemented so you may very well be right, I’ve got a busy week or two coming up but I’ll try to make time afterwards to have a look at the feasibility of including them - thanks for the bringing this to my attention!

It took me an hour to figure how it work, then message ‘localStorage not support’ pop up. Any advice, cause when I save with your game it do just fine but not with mine. If the problem was not with coding, then what your suggestion? Any way to make it support or just move all files to other computer and try again?

It after all just for testing, right?

Make sure you:

  • Are using a decent and up to date browser (Firefox, Chrome)
  • NOT browsing in a private, incognito (or similar) mode
  • Don’t have cookies/local storage disabled in the browser settings

never mind it fine, it turn out I need at least 3-4 save slots to make it work, and it must be on firefox.

Which made me wonder, if I release demo, does that mean all my player who play on IE could not save?

Recent versions of IE should work just fine : )

Um I have another problem, I try to use random test, but i was unable to.
The error said it involve save, is it supposed to be like this?

Random test doesn’t support the sm commands because they’re not official, there’s nothing I can do about that I’m afraid! You’ll just have to comment them out when running tests.