Super Easy Checkpoint Saving [Updated]

Is this the easiest way? Why use THIS method?

Yes, as of 7/28/17 this is the easiest way to save progress for checkpoints in choice games listed anywhere on the forum. This method is preferable because it only uses a few lines of code, you can save a infinite number of variables and have an infinite number of saves at the same time. Also: This doesn’t require complicated stuff or javascript editing. It doesn’t use the *script command and should be 100% alright for publishing.

How do I do it?

It’s easy.

Step One

This method requires Twiger_Functions v0.7 or higher so go to this link You may either download it and move the twiger_function.txt file to your scenes folder or you can copy and paste it into a file named twiger_function.txt in your scenes folder.

Note1: This file also comes with the array functions. To learn about them, go here.
Note2: to update this file, you can copy the text from the link and then replace all the previous text. (copy the new version, go to your text editor, into the twiger_functions file press ctrl+a then ctrl+v)

Step Two

It startup.txt create the variable save_num

*create save_num ""

Step Three

Next you will want to create save variables like this:

*create save_1 ""
*create save_1b ""

You must create two variables in the startup.txt with the format save_[save name] and save_[save name]b In the example above, I named my save “1” but it can be anything, such as “213564” or “bubbles”
You can have as many saves as you want:

*create save_1 ""
*create save_1b ""
*create save_apple ""
*create save_appleb ""
*create save_death ""
*create save_deathb ""

Step Four

Once you’re done with the first three steps, you can do this in any scene you want, wherever you want.
Doing this will save the variables listed. You may then change the variables all you want, but they will remain as what they were saved in the the save variable.

*set save_num 1
*set save_1 "~x~y~z"
*gosub_scene twiger_functions save

Note: This example would save the variables x, y, and z into the save named save_1 Keep in mind you must put a ~ in front of each variable name.
If you want to save the variables “health” “stamina” “coins” and “dragons” into your save named “playerdeath” you would do this:

*set save_num "playerdeath"
*set save_playerdeath "~health~stamina~coins~dragons"
*gosub_scene twiger_functions save

Note: the variables save_[save name] and save_num can be set whenever you want. If they already list the right variables/save name, you don’t need to *set it again.

You will most likely want to save before the player makes a handful of choices that will result in the player dying or getting caught and during which some variables are altered.

Step Five

Of course if you save, you might want to load too… it’s kinda the point. (You would load this when the player dies and has to start back at the checkpoint or whenever you want)

To load your save, do this:

*set save_num 1
*gosub_scene twiger_functions load

This will ‘instantly’ replace the values of all the variables listed with the values saved in the save variables save_1 and save_1b
Once again, you and use whatever save variable you want and if save_num is already set to the right name, you don’t need to change it:

*set save_num "playerdeath"
*gosub_scene twiger_functions load

*set save_num 5234
*gosub_scene twiger_functions load

Step whatever number we’re on

To rewrite your save, just do step four. You can use a save as many time as you want.

This is pretty open ended and the source is can very easily be altered so you can really do whatever you want with it.

How should I order my code?

probably like this:

(at the start of a scene in which a player might die)
[save the variables]
[label to goto when the player dies]
[load the variables]
[the story, choices, whatever]
[If the player dies anywhere: *goto label]

Thanks for checking this out. It took a few frustrating hours to makes.
Man, someone is going to use this and make a really successful game series with it and I’ll be poor.


Yes, please!

One thing published CoC/Hosted Games are in dire need of is a save feature. Its tiresome having to reset the entire game whenever you wish to go back on a decision… I understand this may reduce replayability a little but if people really want to go back then they’re going to do it anyway, one way or another. Might as well make it easier for them.


Sounds fantastic! Will definitely try it out soon. I wonder if CoG would allow this in their official titles?

By the way, is there a way to allow the user to reload from the last checkpoint without having to get to the load spot in the game? I guess just having a dialogue pop up at some point, but maybe something more elegant? (I wonder if it’s possible somehow to set something up in choicescript_stats now that it can support limited variable setting… hmmmmmm…)


There’s no reason CoG wouldn’t allow it (I’m pretty sure). It’s just regular script and does not use the *script command or mess with any game files which would make your game not supported by CoG. It’s really no different than just stuffing a bunch of variables into one.

I’m not quite sure of what you’re asking. The load function can be used at any time. Something else you could use it for is maybe if the player has dreams every night that combine both their real-world stats and whatever happens in the dream but when they wake up their stats go back to the real world ones. It definitely doesn’t just need to be used to go back in time. Another example of what you can do is: Say you have 5 different characters that the player controls, switching from one to the other fairly often. You can use multiple saves to store each character’s variables and switch them around without having to use 5 of each variable.

Oh wait, sorry I get what you mean now.
Yes you could probably do this but not very easily.
Using the stats screen would be the only sane way to pull it off.
You could include a choice in the stats screen to take the player back to wherever they want.

If you want, I could personally help you do this with your specific game.


Hfffttt… Oooh.
I’m getting moist over these lines of codes.

Alright then, let’s see how it works on my end :smiling_imp:

:smiling_imp: :smiling_imp: :smiling_imp:

Anyway, back to the topic.
Some questions if I may.

  1. At Step Three, we are supposed to create save_[save name] and save_[save name]b
    I guess, each pair of it represent a single save slot, if I’m not mistaken?
  2. At Step Four, to save variables, we use the code line “~x~y~z” (assuming our own variable don’t use the tilde as its name, ofc). Is there any particular order to that line? Like “~z~x~y.” Or perhaps, go on double-save like “~x~x” (although I’m sure it has no benefit on doing that) :laughing:
  3. Is there any other particular restriction, like using tilde as our variable for example?

And finally, I’d like some clarification.
The save files created during the playthrough, will be wiped out when someone closes the game, right?
I mean, the way I see it, those saves are… saved, via variables (unlike @CJW’s saving plugin which uses the browser’s cookies(?) ).

But I think it doesn’t really matter when a story is finally made it into the publication.

1 Like

Ouh, Fvvvuuuuuu…
It’s working like magic! :sparkles::sparkles:

While I’m on it, let me tell you the tale of Super Easy Checkpoint Saving


So, this is the world as we know the first time. The stats are blank, the numbers are nonexistent.
The variables are still plain.



One day, the fire nation invades. The stats are altered. The world is no longer a world we used to know.



But twiger_functions has come. Her Sword of Super-Easy-Checkpoint-Saving restored the peace and order to the stats screen.
The world has come back normal.



Haha nice story—a good blend of tragedy and redemption.

@Twiger_Fluff figured out my gibberish, yeah I was wondering about a way to make the load function available at any time. I think the stats screen may be the way to do it. I’ll take some time later to play around with it and see what’s possible (haven’t done any coding recently and getting the itch for a little challenge).

And those were some interesting ideas how to potentially use the code, Twiger, definitely food for thought!

  1. the first variable saves the variable’s names and the second one their values.
  2. they can be in any order and I’m pretty sure you can do the same one as many times as you want, but haven’t tried it.
  3. variables can not have a tilda in their name, thats why I use tildas in my save functions and ^ in the list functions

Lastly. You are right. It doesn’t save in the cookies like CJW’s plugin. It’s for using in publicized or beta tested games not for browsers that don’t save. CJW’s got me there, but I have publishing in mind.


@Szaal How do you do the drop-down thingies!!! :astonished:

@Nonvita The stats screen is the only place in a regular CoG game that can be accessed at any point and interacted with as well. Technically you could offer the

 #go back three choices
 #go back to the gender choice
 #go back to the beginning of this chapter

wherever you want, but unless you want to copy and paste it all the darn time, then don’t

I just thought of something though. You can goto scene and gosub scene but from the stats screen that would just count as being a stat screen and not the actual game… huhh I’m not sure if you can change where you are in the main scene from the stats… oh no. nooooo!!! and I was going to make a way to use a #go back (number) choices (or only allow to go back by one choice but using numbered labels to do it.
@Szaal @Nonvita Can you goto scenes or labels in the main thingy from the stats thingy???

1 Like
[details=Text you want visible next to the triangle.]
Text or images you want hidden.

It may be possible to create a details box using the menu at the top of the box where you type your forum post, but I’ve not explored the buttons very much. Also, I believe you need a blank line between the details box and anything else you type for it to display correctly.

Like so:
Normal text, followed by a blank line.

[details=Text you want visible next to the triangle.]
Text or images you want hidden.

Normal text, following a blank line.
1 Like

so what how why no work

I'll close my brackets now

blah blsah blah

it works no

Can you make a preformmated textbox showing what you types to make the “Like so:” dropdown?

Make sure to close your brackets:

[details=You See Me!]
Hidden stuffs
You See Me!

Hidden stuffs




1 Like

It looks like you’re missing the second square bracket - the one that should be after “drop down” in your test. But yes, I can repeat that “Like so:” box in preformatted text for you. Actually, I’ll take a screenshot.

Like so:

Super Easy Checkpoint Saving - Game Development - Choice of Games Forum

Note: I changed the contents of this details box after I took the screenshot. Otherwise, you’d be stuck with exactly the mess I posted the first time.

…beaten to the punch by @Nonvita - I guess that serves me right for doing things the long way.


@Szaal @Minnow @Nonvita so I have a problem that used to be fixed and now it’s showing up again:
Error: line 72: There is no character at position 3. “aa” is only 2 characters long.

 *if (lists_char > length({lists_listname}))      <<<<< this SHOULD prevent the error and used to.
  *goto second
 *set lists_char + 1
 *if ({lists_listname}#lists_char) = "^"      <<<<< this is line 72
  *set lists_count + 1
 *goto first

changing the default to “aaa” just makes it say it wants there to be a 4th letter.

On the one hand, I should probably get some sleep and look at this in the morning.

On the other hand, I can get terribly stubborn about the silliest things.

Back to the topic of discussion: What happens if you move the *set lists_char + 1 command ahead of the line that checks lists_char against length({lists_listname})? I feel like, unless I’m misreading something, the check makes sure lists_char is no larger than the length of the listname… and then lists_char gets bigger after the size check is complete, allowing it to exceed the allowed size.

It’s possible I’ve misunderstood something, so double-check my suggestion very carefully before making any changes.


You did it! I mean you’re totally wrong, but you made me find the answer so I guess not totally.
This fixed it:

 *if (lists_char > (length({lists_listname})-1))
  *goto second
 *set lists_char + 1
 *if ({lists_listname}#lists_char) = "^"
  *set lists_count + 1
 *goto first

Because *label second is after this code, increasing the lists_char DOES matter but not like that… just umm blah blah blah science blah math blah blah complicated. understood?

1 Like

Getting an error

for my code:

Bananas (my upcoming bestseller).
*create save_num ""
*create save_bananas ""
*create save_bananasb ""
*create save_morebananas ""
*create save_morebananasb ""
*create bananas 0

*label check_1
*set bananas +1
*set save_num "bananas"
*set save_bananas "~bananas"
*gosub_scene twiger_functions save
This is checkpoint 1. You have ${bananas} banana@{bananas |s|s}.

		*goto check_2
	#Start over.
		*gosub_scene twiger_functions load
		*goto check_1

*label check_2
*set bananas +2
*set save_num "morebananas"
*set save_morebananas "~bananas"
*gosub_scene twiger_functions save
This is checkpoint 2. You have ${bananas} banana@{bananas |s|s}.

		You have ${bananas} banana@{bananas |s|s}. No more bananas for you!
	#Go back.
		*gosub_scene twiger_functions load
		*goto check_2
	#Start over.
		*set save_num "bananas"
		*gosub_scene twiger_functions load
		*goto check_1

It’s probably just me doing something completely silly, but I’m too tired right now to try and sort through the code to figure it out. Help please?

I… uh, I’m sad :cry:

@Szaal Why are you displaying such an uncomfortable human emotion?

@Nonvita I have no idea. The only idea I have is you’re doing something wrong but I see nothing wrong with your inputs. Are you testing this in quicktest, randomtest, or regular play?
You could say it’s driving us… bananas! ba dum tss
I really have no idea what it is.

1 Like