A system for skipping ahead or "saving" the game


A little while back, I asked a seemingly unrelated question about checking if something was a number. That was resolved by figuring out how to do what I wanted to do without that check. So what did I want to do? I wanted to set up a system to allow me to skip ahead to the sections of the game that I wanted to playtest without replaying everything before.

This is a refined, more elegant version of the code I ended that other thread with. I’m pretty proud of it, and I wanted to share. The system works by actually playing the game according to the entered code, in silence, so there’s no need for any additional coding to account for convoluted story branches.

In startup.txt:

*create skipcode "111111111111"
*create skipdist 0
*create SN 1
*create XX 0
*create savecode ""
*create option "continue"
*create Nc 0
*create Nx 1

Enter your bookmark code:
*input_text skipcode
*set skipdist length(skipcode)

(The funny thing about the initial skipcode setting is that even though it works with just one digit or no digits at all to begin with–I mean, if it’s going to be referenced, it will have been changed for whatever you input–Quicktest will fail unless there are as many digits as chapters. I believe Quicktest is testing code that should not be called under the circumstances.)

You also need the following subroutine. I’ve been putting it in each chapter and accessing it via *gosub, but it occurs to me that you could put it just once somewhere and access it with *gosub_scene instead. This might solve the above issue of the initial skipcode setting and the Quicktest fail.

*Label Skip
*set XX skipcode#SN
*set SN +1
*set Nx 1
*label Loop
*if (XX = "${Nx}")
  *set option "${option}"&"${XX}"
*if (Nx < Nc)
  *set Nx +1
  *goto Loop
*set skipdist 0

Within each chapter file, choices should look something like this:

*set option "01c"
*if not(SN > skipdist)
  *set Nc 3
  *gosub Skip
*if not(option = "01c")
  *goto {option}
  #Choice number one
    *label 01c1
    *set savecode "${savecode}"&"1"
    *goto Choice1
  #Choice number two
    *label 01c2
    *set savecode "${savecode}"&"2"
    *goto Choice2
  #Choice number three
    *label 01c3
    *set savecode "${savecode}"&"3"
    *goto Choice3

(EDIT: I should clarify that “*set Nc 3” means “set Nc to the number of options in this choice”, which is not always 3.)

Each contiguous block of text needs to be prefaced with the following statement:

*if (SN > skipdist)

And in choicescript_stats.txt, include the following:

  Bookmark code:

From a designer’s standpoint, sooner or later you start to recognise some of the significant digits, and this allows you to skip ahead while tweaking past choices and therefore elements of the character sheet.

Things to watch out for:

  1. Make sure stat changes, story branching, and so on do not occur inside the “if (SN > skipdist)” indent block. Anything that happens in there must be related to text and text only.
  2. The one shortcoming appears to be that you can access hidden choices with this code: that is, if an early choice makes a later choice unavailable, this code could allow you to still sort of “have your cake and eat it too”: you could tell the code that, why yes, you did avail yourself of that choice that should not have been available to you, and it would go ahead and give it to you.

Do you have a sample game we might see it in action, I am more of a hands on learner.


The thing I’m working on is … I’m kind of keeping it under wraps for now (not sure yet what the contract allows) but I think I might be able to throw something together later.

1 Like
  1. This might help you a bit. (Will also let you use letters rather than numbers.)

  2. “not sure yet what the contract allows” if you want to clarify what you don’t know and/or are asking, I might be able to answer.


Is this a question, or like, an idea? Because it’s an interesting idea. I’ve seen similar codes in games before, but they seemed hard to understand and probably went into the Javascript of the game, rather than being only through ChoiceScript.

I agree with @RETowers you could use the method of extracting letters from variables to set variables in a save game.

It would be difficult because you would need to know what ALL of your stats are that you want to transfer to a skip-ahead function, but you could essentially end up with a single string “s50s50s65s48s60s05s50ttfftttt” that sets each of six stats and then a bunch of true/false variables, predetermined by the order in which they’re placed.

If your game was playable without any stats and just based off of what decisions were chosen in the past, you can assign letters to that too, and eliminate some unused variables that don’t really matter.

1 Like

It’s an idea. The thing I like about it is that it doesn’t require too much thinking on the part of the writer … no need to keep track of what variables need to be in place at every step of the story, since it actually “plays” the game up to whatever point you want. It seems pretty versatile, that way.

@RETowers: I’m just not sure how much is wise to reveal about my current WIP, that’s all. To be honest, I think I feel more comfortable not talking about it directly unless I absolutely have to, anyway.

1 Like

Okay, I threw something together here. The thing is short but a) is potentially recursive, b) includes mutually exclusive branches, and c) includes one recursive choice. The code does not change in the face of all this potential convolution. Unless I’ve made a typo in the identification of choices, plugging back a resultant save code will “play” the game through all the paths you may have taken up to whatever point you want.

1 Like

This is really awesome, and, if it works (I haven’t tried it out yet), it would help authors immensely when skipping through parts of their games are currently fully tested.

Bravo (brava?), mate. I’ll be keeping an eye on this thread, for future reference :slight_smile:

1 Like

I have to be honest, looking at this whole thread has me scratching my head. I guess it’s true that people have different types of intelligence. I was just going to have my beta testers create new characters for Part 2 testing using a system that assigns the most vital variables but for leaping ahead, let’s say halfway through the story, I was just going to assign what I thought would be reasonable “midway through Part 2” variables and create a “start in the middle!” option, while leaving out the variables that weren’t critical to finishing the story. That’s something I can wrap my head around.

But if someone else like me who has VERY limited coding knowledge says this is the way to go, I’d definitely give it a look. It’s cool that folks are pushing the envelope here and testing long games (and sequels) does require a lot of tedious work.


I think I grasp the concept will try it out in my own game thank you. :smile:

1 Like

@ashestoashes018: Thanks. It came about because I got tired of running through all these choices I’d made just to test out this one tiny thing … I’m the sort of coder who isn’t happy unless he can run a test on what he’s done every five minutes or so. Though I seem to be getting better now.

@Eric_Moser: If that works for you, then by all means stick with it. There are always multiple ways of doing things, I think, and what works for me may not be what works for you.

@Lordirish: Cheers and good luck!

1 Like

I think that the devs might help out with cross game saves external to Choicescript. They’ll probably help people out more once their games are complete/accepted :slight_smile:


I have a similar system for generating passwords I posted a while ago, done purely in ChoiceScript, but it was riddled with bugs and not very efficient or user friendly. I’ve been working on a new version that’s a lot better and WAY more intuitive (I hope). I’m just throwing together some decent documentation for it and I’ll release it. With my system you can save whatever you need. Good to see other people working on things like this though!