Saving System Plugin


#364

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


#365

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


#366

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.


#367

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


#368

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


#369

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:

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 :slight_smile: @dashingdon


#370

Pssstt… 6 slots :"


#371

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’’.


#372

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

Pulse University - a Mech Game (WiP) - Updated 1/21/2019
#373

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


#374

Anytime :ok_hand:t4:
You’re lucky that I’m around this time.
*puffs out chest, hands on hips


#375

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


#376

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


#377

I meant choicescript IDE.


#378

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

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


#379

@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.


#380

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]

#381

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?


#382

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

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


#383

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

Should it all be lowercase or does it not matter?