ChoiceScript Saving Plugin (Update: April 2023)

I have this is this what you were talking about?

Yes, you don’t need it, only if there was a bug related to the amount of slots, it’d be more likely that it was related to that.

You can check whether or not a slot exists/has been created properly by printing the slot variables like so:

${savemod_slot_0}

Replace ‘1’ with the slot count you expected (only -1 to account for 0). So if you’re expecting five slots, ${savemod_slot_4} will print “No Data” or the name of a save, if one exists. If it hasn’t been created (i.e. you’re stuck with three slots) then you’re game will crash and complain that the variable doesn’t exist.

@CJW

Idk if you can see but on right screen there are five "No Data"s but when I click the menu there are only three. Code is as follows;

${savemod_slot_0}

${savemod_slot_1}

${savemod_slot_2}

${savemod_slot_3}

${savemod_slot_4}

Also the saves do work as they should. This is not a major problem I was just wondering why.

It seems to be a bug with the menu addon, sorry about that. I’ll fix it when I get a moment. It shouldn’t affect core functionality, it just means that only the first three slots will appear in the drop down menu.

@CJW
Thats fine its really no big deal. Three is better than none. Take your time as I can’t think of more than three major points when someone would need/want to save anyway :slight_smile:

Hello @CJW

really great plugins - thank you. I started using your system a few days ago and seemed to trial fine on my demo:

https://dl.dropboxusercontent.com/u/47183494/‘The%20Aegis%20Saga%20-%20Blood’%20Demo%20v2/web/mygame/index.html221

But one user on a mobile has reported this:
https://dl.dropboxusercontent.com/u/47183494/pics%20charles/IMG_7028.PNG

Is that something you’ve seen before? (apologies if this is a simple one)

iPhone Safari? Second half of this post: ChoiceScript Saving Plugin (Update: Sept. 2019)

Thanks CJW - much obliged.

So I apologize for how stupid this question might be but I literally understand all of the directions but, exactly where in the Index file am I putting this. I don’t want to put it in front of code and then mess everything up.

Again sorry for the probably ridiculous question.

@ToxicDreams
Look at post 286 and 295

2 Likes

Playing with number of save slots in the PlugIns. When changing the slotCount variable I can go up to 6 like so:

var saveMod = { game_id: "", slotCount: 6, justLoaded: false, using_cookies: false };

If I go over 6 with this variable I get the following reaction: “Error: Bad Slot - Has smPlugin been included?”

This is the part of code kicking the response;

for (var slot = 0; slot < smPluginMenuAddon.slotCount; slot++) { var option = document.createElement("option"); option.setAttribute("value", slot); if (typeof stats["savemod_slot_" + slot] != 'undefined') { option.innerHTML = "Slot " + slot + ": " + stats["savemod_slot_" + slot]; } else { option.innerHTML = "Error: Bad Slot - Has smPlugin been included?";

How can I add a higher slot count?

Can this system be used on dashingdon saves? or only compiled dropbox ones?

Edit: Sorry really not good at this stuff and can’t get it to work, (I know it’s probably not that hard really) is there a step by step tutorial? Have read the posts suggested, it just doesn’t seem to be working for me. (It throws up this error: startup line 2: Non-existent command ‘sm_init’ )

If you feel comfortable with it, might I ask if you could post the top part of your statup.txt file (where all the variables and the rest are) or take a snapshot of it and post it on the thread? Also, just to be sure, what files have you downloaded in order to implement the mod? Because without Smplugin.js (the actual saving code) it’s nothing doing as far as CS is concerned.

Sure. This is the code (I tried putting it above and below the title)

*label top
*sm_init draconicchallenges | 4
*choice
    #Save
        *label save
        *choice
            #${savemod_slot_0}
                *sm_save 0 | false
                *goto top
            #${savemod_slot_1}
                *sm_save 1 | true 
                *goto top
            #${savemod_slot_2}
                *page_break
                *sm_save 2 | true
                *goto top
            #${savemod_slot_3}
                *sm_save 3 | true
                *goto top
            #Return
                *goto top
    #Load
        *label load
        *choice
            #${savemod_slot_0}
                *sm_load 0 | false
                *goto top
            #${savemod_slot_1}
                *sm_load 1 | true
                *goto top
            #${savemod_slot_2}
                *sm_load 2 | true
                *goto top
            #${savemod_slot_3}
                *sm_load 3 | true
                *goto top
            #Return
                *goto top
    #Delete
        *label delete
        *choice
            #${savemod_slot_0}
                *sm_delete 0
                *goto top
            #${savemod_slot_1}
                *sm_delete 1
                *goto top
            #${savemod_slot_2}
                *sm_delete 2
                *goto top
            #${savemod_slot_3}
                *sm_delete 3
                *goto top
            #Return
                *goto top
*page_break

I downloaded smplugin, smPluginMenueAddon and the save file and put them all in the web folder. I also changed the index file to this:

</head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name = "viewport" content = "width = device-width, initial-scale = 1.0, maximum-scale = 1.0">
<!-- INSERT correct meta values -->
<!-- <title>Multiple Choice Example Game | My First ChoiceScript Game</title> -->
<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>
<script src="../ui.js"></script>
<script src="../scene.js"></script>
<script src="../smPlugin.js"></script>
<script src="../smPluginMenuAddon.js"></script>
<script src="../navigator.js"></script>
<script src="mygame.js"></script>
<link href="../alertify.css" rel="stylesheet" type="text/css">
<link href="../style.css" rel="stylesheet" type="text/css">
<!--[if IE 6]><style>.alertify-logs { position: absolute; }</style><![endif]-->

<body>

And changed the save.js file to this:

saveMod = {
    mygame_save: "draconicchallenges" //Change null to the name of your game inside quotation marks, for e.g. : ,mygame_save: "terminal"
                                     //This ensures your game saves are unique to your game and won't be overwrote by anyone else using this system.
    ,isLocalIE: false                 //Don't change this           
    ,autoSave: false                  //true = Autosaves by default - Otherwise player must activate autosave.

Thanks for the help :slight_smile:

Can you send me a link to your game either on here or PM? It looks like you’re doing everything no problem, it may just be faster if I can look at the game from a browser’s Dev Console. Also if I’m not mistaken save.js is depreciated, so I don’t think you even need it.

If you’re using smPlugin.js do NOT use save.js (that’s separate/standalone). You shouldn’t need to edit any .js files if you’re using smPlugin and its add-on.

Well, this is frustrating. I’ve come so close to actually getting this save to work the way I want it to…but then I ran into a wall.

This is what my index.html looks like:

`

`

I’m not really sure what the two middle links are for. I might have tried to use the other save system(where it emails you a password and everything).

This is what my save.js looks like:

saveMod = { mygame_save: "tainted" //Change null to the name of your game inside quotation marks, for e.g. : ,mygame_save: "terminal" //This ensures your game saves are unique to your game and won't be overwrote by anyone else using this system. ,isLocalIE: false //Don't change this ,autoSave: false //true = Autosaves by default - Otherwise player must activate autosave. };

And finally, this is what my startup looks like:

[quote]*title The Tainted
*author A.G. a.k.a Silhuetta
*scene_list
startup
prologue

*label top
*sm_init freakhouse | 4
*choice
#Save
*label save
*choice
#${savemod_slot_0}
*sm_save 0 | false
*goto top
#${savemod_slot_1}
*sm_save 1 | true
*goto top
#${savemod_slot_2}
*page_break
*sm_save 2 | true
*goto top
#${savemod_slot_3}
*sm_save 3 | true
*goto top
#Return
*goto top
#Load
*label load
*choice
#${savemod_slot_0}
*sm_load 0 | false
*goto top
#${savemod_slot_1}
*sm_load 1 | true
*goto top
#${savemod_slot_2}
*sm_load 2 | true
*goto top
#${savemod_slot_3}
*sm_load 3 | true
*goto top
#Return
*goto top
#Delete
*label delete
*choice
#${savemod_slot_0}
*sm_delete 0
*goto top
#${savemod_slot_1}
*sm_delete 1
*goto top
#${savemod_slot_2}
*sm_delete 2
*goto top
#${savemod_slot_3}
*sm_delete 3
*goto top
#Return
*goto top [/quote]

(for some reason that section just doesn’t format correctly…hm.:thinking:)

Anyways, after I put all of that in, it works. There’s just one thing: they come up as actual choices, in game, instead of there being a little bar at the top(which would be next to the restart and stats button).

I don’t know what I’m doing wrong…help?:disappointed:

Oh? Ok, what happens when you remove the choices? Since you don’t need them there to have the top bar populate.

EDIT: Also, not to pry, but what’s ss.js? Something you put together?

If I remove the choices, well, everything disappears then. It doesn’t even give me an option to save anymore.

I mentioned before that I used the other method of saving, the one where the game emails a password to you. I honestly don’t remember if it’s a remnant of that or just a regular part of the code.

Have you tried removing these lines in the index file?
`

`

Since I don’t see jQuery putting up any issues, do you have a link to this (save-buggy) version of the game? I might be able to find something via Dev Console.

EDIT: if all else fails, why not try a clean re-install, without re-installing save.js as its depreciated and useless?