# ChoiceScript Saving Plugin (Update: April 2023)

**URL:** <https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983>\
**Category:** Game Development\
**Created:** [December 12, 2012, 2:57pm UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983 "2012-12-12T14:57:54Z")\
**Posts on this page:** 20\
**Page:** 19

<div class="post-metadata">

**Author:** ![Fiogan](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/fiogan/32/215832_2.png) [@Fiogan](https://forum.choiceofgames.com/u/Fiogan)\
**Post date:** [February 2, 2017, 2:10am UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/363 "2017-02-02T02:10:39Z")

</div>

If you’re hosting on Dashingdon with a game that isn’t compiled, I think all you have to do is include the command:

`*sm_init mygame | 3`

at the beginning of your first scene file. Then check the little box on the Dashingdon ‘edit game assets’ page to enable the save slot system. I have my first scene file in a different .txt file to startup.txt, so I put the `*sm_init` command at the top of that first scene.

There are instructions on the Dashingdon ‘edit your game assets’ page, too. And then you’ll be good to go with save slots!

Will that suit, or do you need it to work in a compiled game? Or did you want to have specific save points? If so, you can also have a look at [this post](https://forum.choiceofgames.com/t/saving-system-plugin/983/116).

---

<div class="post-metadata">

**Author:** ![MahatmaDagon](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/mahatmadagon/32/18504_2.png) [@MahatmaDagon](https://forum.choiceofgames.com/u/MahatmaDagon)\
**Post date:** [February 2, 2017, 2:27am UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/364 "2017-02-02T02:27:24Z")

</div>

I did exactly that and it worked like a charm. Thanks for the tip, it was way easier than I expected it to be!

---

<div class="post-metadata">

**Author:** ![Eric\_Moser](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/eric_moser/32/259257_2.png) [@Eric\_Moser](https://forum.choiceofgames.com/u/Eric_Moser)\
**Post date:** [February 2, 2017, 3:30am UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/365 "2017-02-02T03:30:07Z")

</div>

I will try it this weekend! Thanks for the guidance!

---

<div class="post-metadata">

**Author:** ![Fiogan](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/fiogan/32/215832_2.png) [@Fiogan](https://forum.choiceofgames.com/u/Fiogan)\
**Post date:** [February 2, 2017, 3:51am UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/366 "2017-02-02T03:51:38Z")

</div>

For sure! @dashingdon’s support for the save system in the hosting service has made using the plug-in even more convenient and accessible, which is great.

I usually comment out the `*sm_init` line when I’m writing and coding, since the autotests don’t get on with it, and then enable it again when I’m ready to upload the new material.

---

<div class="post-metadata">

**Author:** ![youtubermelts](https://avatars.discourse-cdn.com/v4/letter/y/9dc877/32.png) [@youtubermelts](https://forum.choiceofgames.com/u/youtubermelts)\
**Post date:** [April 4, 2017, 1:25pm UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/367 "2017-04-04T13:25:33Z")

</div>

Will I need to have save.js downloaded in order to work smPlugin and the menu addon?

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [April 4, 2017, 2:08pm UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/368 "2017-04-04T14:08:59Z")

</div>

No, save.js is an old iteration. Use smPlugin.js and, optionally, smPluginMenuAddon.js.

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [August 29, 2017, 2:11pm UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/369 "2017-08-29T14:11:46Z")

</div>

I’ve made a _tiny_ change to smPluginMenuAddon.js that should fix a bug where the menuAddon would always initialise with 3 slots, regardless of the \*sm\_init parameter, outlined here:

> [@Having trouble with Dashingdon's save plugin - can't make \> 3 slots](https://forum.choiceofgames.com/t/having-trouble-with-dashingdons-save-plugin-cant-make-3-slots/29965/14):
>
> I’ll take a look. I can’t help but feel like someone had a similar problem before (off of dashingdon), but I thought I fixed that. Maybe I didn’t confused

If you’re happily using 3 slots, there’s no rush to update, but there’s no harm in it either! Just download the file via the same link and replace 🙂@dashingdon

---

<div class="post-metadata">

**Author:** ![Szaal](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/szaal/32/112202_2.png) [@Szaal](https://forum.choiceofgames.com/u/Szaal)\
**Post date:** [August 29, 2017, 2:24pm UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/370 "2017-08-29T14:24:37Z")

</div>

> [@CJW](#):
>
> If you’re happily using 3 slots,

Pssstt… 6 slots :"

---

<div class="post-metadata">

**Author:** ![Fiogan](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/fiogan/32/215832_2.png) [@Fiogan](https://forum.choiceofgames.com/u/Fiogan)\
**Post date:** [September 17, 2017, 9:49am UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/371 "2017-09-17T09:49:26Z")

</div>

I can’t seem to get the saving system plugin to work with the very latest version of ChoiceScript. When I try to run the game in Firefox, it gives me the error: ‘Non-existent command ‘sm\_init’’.

---

<div class="post-metadata">

**Author:** ![Szaal](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/szaal/32/112202_2.png) [@Szaal](https://forum.choiceofgames.com/u/Szaal)\
**Post date:** [September 17, 2017, 10:01am UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/372 "2017-09-17T10:01:42Z")

</div>

It’s either probably because:

1. You forgot to include the  
`<script src="../smPlugin.js"></script>`  
`<script src="../smPluginMenuAddon.js"></script>`  
lines to the `index.html`
2. You forgot to include the  
`smPlugin.js`  
`smPluginMenuAddon.js`  
files to the `/web/` directory

---

<div class="post-metadata">

**Author:** ![Fiogan](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/fiogan/32/215832_2.png) [@Fiogan](https://forum.choiceofgames.com/u/Fiogan)\
**Post date:** [September 17, 2017, 10:10am UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/373 "2017-09-17T10:10:07Z")

</div>

@Szaal Ah yes, you are right, I made a mistake with the `index.html` file. All sorted; thanks for the rescue!

---

<div class="post-metadata">

**Author:** ![Szaal](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/szaal/32/112202_2.png) [@Szaal](https://forum.choiceofgames.com/u/Szaal)\
**Post date:** [September 17, 2017, 10:12am UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/374 "2017-09-17T10:12:32Z")

</div>

Anytime 👌🏽  
You’re lucky that I’m around this time.  
_\*puffs out chest, hands on hips_

---

<div class="post-metadata">

**Author:** ![Mango\_Pirate](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/mango_pirate/32/164510_2.png) [@Mango\_Pirate](https://forum.choiceofgames.com/u/Mango_Pirate)\
**Post date:** [November 15, 2017, 10:43pm UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/375 "2017-11-15T22:43:54Z")

</div>

@CJW Sir, you are a lifesaver! I very much enjoy your choicescript API also.

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [November 16, 2017, 2:58pm UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/376 "2017-11-16T14:58:23Z")

</div>

Glad you like it. What do you mean by ChoiceScript API though? I wasn’t aware I’d wrote one! 🤨

---

<div class="post-metadata">

**Author:** ![Mango\_Pirate](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/mango_pirate/32/164510_2.png) [@Mango\_Pirate](https://forum.choiceofgames.com/u/Mango_Pirate)\
**Post date:** [November 16, 2017, 4:40pm UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/377 "2017-11-16T16:40:39Z")

</div>

I meant choicescript IDE.

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [November 16, 2017, 7:01pm UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/378 "2017-11-16T19:01:15Z")

</div>

Ah! Sorry for being pedantic, I just wanted to be sure I wasn’t being credited for someone else’s hard work! 🙂

I’m very glad you’re finding them of use, and please don’t be shy about sharing feedback (good and bad)!

---

<div class="post-metadata">

**Author:** ![crookedcrow](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/crookedcrow/32/49284_2.png) [@crookedcrow](https://forum.choiceofgames.com/u/crookedcrow)\
**Post date:** [December 20, 2017, 5:55am UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/379 "2017-12-20T05:55:25Z")

</div>

@CJW  
@Malebranche

Hi, I hope I’m not causing an issue by posting in this thread. I’m running into a bit of an issue. I’ve read through everything in here, top to bottom. I can’t seem to get this working.

**What I’ve done:**

1. Download both files (“_smPlugin.js_”, “_smPluginMenuAddon.js_”).
2. Place both files into the “_web_” folder, where “_ui.js_” already exists.
3. Go into “_mygame_” folder. Open “_index.html_”.
4. Add the following lines (in exact order) to the “_index.html_” file, making sure that they come after the other “_.js_” files in.

```
<script src="../smPlugin.js"></script>
<script src="../smPluginMenuAddon.js"></script>

```

So they actually look like this:

```
<script>window.version="UNKNOWN"</script>
<script src="../version.js"></script>
<script src="../persist.js"></script>
<script src="../alertify.min.js"></script>
<script src="../util.js"></script>
<link href="../style.css" rel="stylesheet" type="text/css">
<style id="dynamic"></style>
<script src="../ui.js"></script>
<script src="../scene.js"></script>
<script src="../navigator.js"></script>
<script src="mygame.js"></script>
<script src="../smPlugin.js"></script>
<script src="../smPluginMenuAddon.js"></script>
<link href="../alertify.css" rel="stylesheet" type="text/css">

```

1. Save the “_index.html_” file, and close it.
2. Go into the “_scenes_” folder. Open “_startup.txt_” (or first file).
3. Place “_\*sm\_init_” between the variables created and the start of the story text.

```
*create control_world false

*sm_init 

Chapter One: A Sloppy Beginning

```

1. Save and close file. Return to the “_mygame_” folder.
2. Right-click “_index.html_” and open with IE, Edge, or Firefox.

**Problem:**  
For some reason, it won’t work. Did I miss any steps?

For step 4, I tried setting the two added scripts above the “_mygame.js_” script, and once above the “_navigator.js_” script.  
For step 7, I’ve tried “_\*sm\_init_”, “_\*sm\_init mygame | 3_”, and “_\*sm\_init The\_Necromancer | 3_”.

**Errors:**

1. A popup window: “_Unspecified error_.”. I press OK.
2. The drop down menu displays, but all three slots say “_Error: Bad Slot - Has smPlugin been included?_”
3. None of the story text is displayed at this point. Not sure if it is relevant.

I can provide screenshots if they are needed.

Thanks in advance for any help.

---

<div class="post-metadata">

**Author:** ![EclecticEccentric](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/eclecticeccentric/32/112816_2.png) [@EclecticEccentric](https://forum.choiceofgames.com/u/EclecticEccentric)\
**Post date:** [December 20, 2017, 6:38am UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/380 "2017-12-20T06:38:21Z")

</div>

The files

```
<script src="../smPlugin.js"></script>
<script src="../smPluginMenuAddon.js"></script>

```

should go after ` scene.js `, not at the end of the other `.js` files in the `index.html` file.

The format for the `*sm_init` command is as follows:

```
*sm_init [gamecode] | [number of slots needed]

```

---

<div class="post-metadata">

**Author:** ![crookedcrow](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/crookedcrow/32/49284_2.png) [@crookedcrow](https://forum.choiceofgames.com/u/crookedcrow)\
**Post date:** [December 20, 2017, 6:41am UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/381 "2017-12-20T06:41:23Z")

</div>

Yeah, I tried them once between “_scene.js_” and “_navigator.js_”.

It’s actually where I’ve left off. It’s not working. D:

EDIT: This is supposed to work in one of the browsers right? It’s not just something for DashingDon?

EDIT 2: What is the game code? Is this something we can make up?

---

<div class="post-metadata">

**Author:** ![Fiogan](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/fiogan/32/215832_2.png) [@Fiogan](https://forum.choiceofgames.com/u/Fiogan)\
**Post date:** [December 20, 2017, 6:51am UTC](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983/382 "2017-12-20T06:51:56Z")

</div>

Yes, it’ll work in a browser as long as you’re using your copy of CS with the modified files in `index.html`.

> [@crookedcrow](#):
>
> What is the game code? Is this something we can make up?

The ‘game code’ is essentially a unique identifier for your game. So, if your game were called Endless Fountain and you wanted three save slots, the `*sm_init` line might look like:

`*sm_init endless_fountain | 3`

[Previous page](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983.md?page=18)

[Next page](https://forum.choiceofgames.com/t/choicescript-saving-plugin-update-april-2023/983.md?page=20)
