ChoiceScript Saving Plugin (Update: April 2023)

@CJW: This looks great - I may not implement it in the current game i’m working on since I don’t want to have to tinker around with the fundamental coding too much at this stage, but will certainly be looking to implement it in future :slight_smile:

1 Like

@Nocturnal_Stillness
Must just be something I did, then. Probably an issue with my convoluted *gosub routines. Thanks for letting me know it’s possible, though!

@akatsuki9344 @Marius @Largejo

Thanks guys, really looking forward to seeing what people can do with this, be sure to post your games that use it here! And if you get any ideas for improvement or find any bugs, please let me know! :slight_smile:

@CS_Closet

As @Nocturnal_Stillness says you should be perfectly fine loading and reloading in the middle of a scene, it may be that I’ve changed something since Nocturnal’s version (you may want to upgrade Nocturnal, your version will bug out on a lot of browsers like IE) - so please do let me know if you continue to have problems.

As for the save names - that did occur to me - and I can see why that would be useful for hidden saves, I’ll look further into it!

1 Like

I’ll mess around a bit more with it to see if I can get it to work. Likely, it’s something I did due to not “reading instructions before assembly”, so to speak. :-"

@CJW - this looks very impressive! The earlier version is already excellent, so I’m looking forward to implementing this. Will need to update my choicescript version first, so might save it for when I’ve got the next update for my wip ready. Thanks again!

1 Like

@bawpie You’re very welcome! I look forward to seeing it in action :smiley:

@CS_Closet Not really, I can’t think of any way to ‘use it wrong’ that would result in that behaviour - if you’ve no joy soon, let me no asap and I’ll do some tests.

@CJW - Eh, well…I updated my version of choicescript, downloaded your plugin and placed it in the web folder and amended the index.html to make reference to smPlugin (just under the navigator.js line as per your demo code). I’ve started my startup file with *sm_init but just get an error saying the command doesn’t exist whenever I try to run it?

The first line of my startup file looks like this:

*sm_init healms | 4

I’ve updated the smplugin file to look like this:

saveMod = {
game_id: “healms”
,slotCount: 4
,justLoaded: false
};

But to be honest, it seems like the plugin just isn’t being picked up? I guess I’m missing something, though I’m not sure what!

The link to my wip is here: https://dl.dropbox.com/u/11379019/COG/WIP/Heal/web/mygame/index.html - would be very grateful if anyone could point out what I’m doing wrong!

@bawpie
Try changing your smPlugin.js file back to:

saveMod = {
	game_id: ""
    ,slotCount: 3      
    ,justLoaded: false
};

The *sm_init command at the start of your game file should take care of defining the rest (or that’s what I assumed it did, anyway).

Other than that, I can’t think of anything that you might’ve done differently than I. Your startup.txt file is fine.

@CS_Closet - thanks for the suggestion, I only changed smplugin when I thought that might be the reason it wasn’t working. Changed it back to the default and still no joy :frowning:

@bawpie Dropbox doesn’t seem to think you’ve got the file in the ‘web’ folder:
https://dl.dropbox.com/u/11379019/COG/WIP/Heal/web/smPlugin.js

And as @CS_Closet says *sm_init defines those values for you, so you don’t need to change them in smPlugin :slight_smile:

@CJW - God I’m an idiot. I have two folders, one which I work on, and one for people to play. I put the smplugin into the play folder rather than the wip folder…but managed to make the changes to the WIP coding…I knew it’d be an 1D10T error!

:smiley:

@CJW - Okay, so I think it’s working. There is one drawback that I’ve discovered, which is that it’s not compatible with the autotester. I know it’s not something a lot of people use, but I do use it frequently. So whilst the game will play, as soon as I try to use the autotest it just says ‘non-existent’ command for sm_init (I guess the autotester doesn’t load or accept the smPlugin?).

However, I’ve recorded 2 macros for notepad++ (where I do my editing) - one to comment out any cm_commands and one to uncomment them. This way I can autotest to my hearts content and then uncomment the commands when it’s ready to go ‘live’. I’ve also had to add the save slots as variables in mygame.js to allow autotester to work, but again, I’ll just disable these when I’m done testing. :slight_smile: Thanks again!

You can use macros in notepad++? How?

@bawpie
Yep, sorry about that. Glad to see you’ve already found a workaround :smiley:

@fantom
To avoid getting off topic:

@CJW - sorry, just wanted to say I go into a bit more detail here: http://www.choiceofgames.com/forum/discussion/1089/using-autotester-with-cjws-save-system/#Item_1 regarding macros for working round the autotester/save system issue.

@fantom - the video @CJW posted pretty much explains it all, though my post mentions where to find the macros once they’ve been recorded in case you want to amend certain parts.

1 Like

@bawpie No problem, that was a ‘related’ issue - but it’s good that you’ve made a thread about it. The whole thing actually slipped my mind as I don’t even use the autotests, but I guess quite a lot of the forum users do! :o

1 Like

i don’t even known what auto tests are??..O_O

@akatsuki9344 It’s in the main folder for your game. It runs through your game like a player would, going through all the choices combinations and checking for errors. It’s far from perfect, mind you, but it’s a handy tool to use if you want to polish your game as much as possible before letting someone play through it. It can’t check for spelling or grammar mistakes though, just coding.

Here’s the official CoG article on testing: http://www.choiceofgames.com/make-your-own-games/testing-choicescript-games-automatically/

1 Like

@akatsuki9344 - the tutorial for autotest is fine, but I did write up an article on the wiki for it too, which is here: http://choicescriptdev.wikia.com/wiki/Automatically_testing_your_game

It’s a bit more detailed than the COG one, which assumes some knowledge of dos commands etc.

@CJW - I guess when the save system is added to the wiki, I could add the article for the work around if it’s still relevant. To be honest, I’m not sure a lot of people do use the autotest…frankly I couldn’t code without it! It doesn’t pick up everything, but it generally lets you know when you’ve slipped up.

1 Like