How do I make checkpoint/save?


#1

Yeah title is pretty self explanatory. I don’t have a clue how to and would like to learn. Thanks


#2


That should help.


#3

I went and downloaded the save.js file but after I edited the index.html and the null in save.js, I get this

TypeError: window.nav is undefined

and I tried to open the game after deleting it, I get Script Error. Did I just break my game?


#4

@that1german You’d have to ask @CJW, but that save system of his may now work anymore with the latest version of CS. I know of another way of doing it, it just wouldn’t persist if the browser is closed.


#5

At the beginning of startup.txt, for every *create command you do at the beginning, you create a duplicate for every save slot you want to create. For Example:

<pre \*create health "0" \*create health1 "0" \*create health2 "0" \*create strength "0" \*create strength1 "0" \*create strength2 "0" ``` Then, in another scene file, I'm going to call it "extras", do something like this: ``` *label saveslot1 *set health health1 *set strength strength1 *return *label saveslot2 *set health health2 *set strength strength2 *return ``` When you create a checkpoint, you do this ``` *set health1 health *set strength1 strength ``` Now whenever you want to load up a save point you use *gosub_scene to reset your stats, like ``` *gosub_scene extras saveslot1 ``` And then you use another \*gosub_scene or \*goto (whichever is applicable) to go to the part of the game you want to go to.

#6

I can assure you that CJW’s system does work with the latest version of Choisecript. There is a tiny thing that needs altering however, but I’ll have to look through my files later on to check


#7

I suppose a better question would be if a game is publishable with @CJW’s system? It’s probably good for testing (the reason most people use it, obviously) but what about once you’re ready for release?


#8

@BlazedStorm weird I did exactly what it told me to do in the link that @gkkiller gave. Unless I’m suppose to copy/paste the save.js with that new framework system that CJW posted later on in the thread?


#9

Try downloading a fresh copy of the latest CS, and putting your scene files and mygame.js in that to see if they work.

Also, you should be using sm_Plugin.js. save.js is outdated.


#10

What @gkkiller said. To be honest, I thought you meant the sm version in that post, so I misread it. Most people still use the plugin as it allows you to create a series of save files without the need of extra on screen buttons that save.js has. It also has a flashy green success box, because like aesthetics for the win

However I am not sure if the post still contains what needs to be altered in the default files for sm_Plugin to work. Was it deleted? I haven’t checked


#11

smPlugin definitely works with the latest version of CS, I can’t comment on save.js but I’ll try and have a look tomorrow.

@fantom
Arguably it would work, but I work on the premise that I doubt COG would allow it, although in fairness they don’t really need to, the state persistence on the mobile apps is pretty good.

@that1german
save.js and smPlugin.js shouldn’t ever be used in conjunction (use one or the other, not both). I can only think that the error is caused by a typo in your included code and/or including it before all the other .js files (it needs to come after them).

@BlazedStorm
You need to edit save.js manually but with smPlugin you don’t, you just use the *sm_init command to set up all the stuff you’d need to set manually with save.js :slight_smile:


#12

yeah I must have screwed up when I was editing the index part with the save.js cause it works now when i put it into a practice game