ChoiceScript Saving Plugin (Update: April 2023)

That’s some interesting bytecode you got there. Any javanese interpreters ITT?

Sorry :upside_down_face:

What browser is suggested to use choicescript? I’m using Vivaldi and as soon as I make these modifications to test the plugin out I get unhandled exceptions.
I even tried it with the sample game choicescript comes with and it still gives me the issue.

Image 1
Image 2

Edit: The first image with the test is not defined is my mistake, I forgot to include the “” in the code.

Its recommended to be on Firefox and if not there chrome.

Still getting the error in Firefox either. Using Firefox v70.
This is what I am trying to do. I downloaded the choicescript from GitHub. Extracted it up and made the necessary changes as instructed in the GitHub. I did that on the sample script it comes with just to test the script out since it gave me the same error while loading it on my own project.

What am I doing wrong???

EDIT: Never mind, I forgot I had adguard installed, which basically messes with Javascript and html files if downloading them online. It works, thanks a lot.

EDIT2: Alright, one question. How would I implement saving/loading from specific directory?
One more thing, if I opt to choose to publish with CoG/Hosted, and if there’s a sequel, is there a way for me to allow the readers to load saves stored locally? My goal is to allow saving the game at the end of the book locally, and then able to be restore it from that save to a possible sequel.

No idea about the specific directory question. As for the publication via CoG/HG, saving is only added if a confirmed sequel is on the path to publication. Otherwise, there’s no saving at all.

Well then, where are these saves stored at?

So if I publish through them (and regardless of their own save system and any planned sequels) I can’t include a local (own) method to do just that?

For example, it’s not planned yet but still provide the ability to save the games locally to be loaded in the sequel when it’s out? What if I publish them on my own?

1 Like

Saves are stored in the player’s browser’s cache. I think the plugin provides a way to save locally - not sure as I just use Dashingdon to host my game.

If you self-publish, you can probably include the save plugin, but you’d have to buy the Choicescript license to self-publish (expensive and you don’t get their excellent marketing services). If you publish through CoG or HG, they only include saving if a sequel is going through their publication process. You can’t insert it yourself.

The saves are stored local to your browser as mentioned above. You can’t, and probably don’t want to, use this for published games. It’s really just a convenience plugin for longer WIPs.

1 Like

Hi!. I know there has been a lot of talk about hard-keeping in cs.
I have been acquainted with this interpreter for less than a month, and I have achieved many things thanks to your countless answers.
I’m going to try to explain myself the best that I can, because I can’t make the scrypt work and I don’t understand another detail.
Objective: To obtain that from a game with many scenes, the user can exit it and return and the scene or the point where he left it is loaded:

Note: I put all the examples between “”, since I think they will understand me better.

  1. So that everything that refers to configuration, must be included in the “index.html” found in “mygame” the following line?

And, this line must go under the “navigator.js” scrypt right?

The other parameter to configure is the line called: “window.storeName = null;”
And I change the null by a distinctive name to any game, right?
for example, “window.storeName =” librojuegospanish; "
Now, how do I implement the scrypt usage settings in the game?

I know there are a couple of basic commands: “sm_save”, “sm_load”, basically those interest me, since the goal of implementing this system in my game is to give the user the ability to save the game and return to it without Lose your progress in the various scenes.

How do I get it?

I have tried putting under each “page_break” that happens to other small scenes but in independent lines the following:
“sm_save”
“sm_load”

But, I don’t get it, no buttons appear, nothing.
I use the most recent cs.
Thank you!

Alright, if I understand correctly, the newest save plugin is ChoiceScriptSavePlugin.js which is on the first post of this thread. I downloaded and set up everything as the link says, and I can run run_server correctly, and even save, but the plugin doesn’t let me load/delete any slots. I click on them and receive no response. (I’m on Chrome, can’t seem to try this on phone atm)

I’m assuming it looks different from before (things like “New save” instead of “Save” and different text) because it’s a newer plugin, but could it be that I downloaded an outdated version? Or something of that sort?

Season’s greetings both!

Please follow the instructions at (if you haven’t already): https://github.com/ChoicescriptIDE/ChoiceScriptSavePlugin/blob/master/README.md

These instructions include the latest download link. Please also make sure you’re using the latest copy of ChoiceScript.

There are two ways to use the new version of the plugin:

  • With the sm_save/load commands
  • With the quicksave menu

If you’re aiming for the former, please also see the working example, here: https://github.com/ChoicescriptIDE/ChoiceScriptSavePlugin/blob/master/examples/save.txt

The latter should “just work”, and the UI should appear automatically. If it hasn’t, try opening your browser console (usually F12) and seeing if there any errors displayed. Feel free to PM me if either of you are having any further trouble.

4 Likes

I have the latest version, just forgot Chrome doesn’t like CS, apparently :sweat_smile: Thank you for answering!

1 Like

This plugin has been a revelation for me. Testing scenes has become 100x less of a hassle, and I have @CJW to thank for it.

I do have a question, though: Is it possible to export/import the saves for use in multiple devices? I get some of my testing done on my phone when I’m away from my workstation, and it’s not easy trying to remember which set of choices I’ve been testing on a different browser.

2 Likes

Hey AdiGrateles, glad you’re enjoying the plugin!
Strictly speaking, I’d imagine this should be technically possible, but I’m afraid it’s not something I’ve spent much time looking into.

Understandable. Might try and code it in myself, when I have the time.

Is it possible for the save to be located a cloud, such as OneDrive, which is then available to you whether it is on your phone or computer?

Afraid not! This is a plugin intended as a convenience when developing/testing your game, not as a production ready solution for finished products. That said, @AdiGrateles was working on an extension to allow you to import/export saves. May that be of help?

3 Likes

Hi @CJW, I was hoping I could pick your brain on something - would you have any ideas on why one of my readers would be getting a bad save slot error, but not anyone else? Say 99 readers (using the exact same link) access their saves on dashingdon just fine, but 1 gets the

Error:Bad Slot has smPlugin been included

message. It seems to come and go, with some loads having good saves for this one user, and then abruptly they’ll stop working and revert back to the error message. Just scratching my head and trying to figure out if this is a plugin thing, a dashingdon thing, or a coding error on my part!

How convenient. I was just going to post a question about how people are doing this.

Hmm… Afraid I can’t make much from that alone.
That said, I have updated the script (quietly) recently. May be worth trying the newer version.

The *sm commands aren’t working very well, but the quick menu interface should be good.

2 Likes