Forgot to add an option


I was replaying a scene of my game when I noticed I’d accidently only put one option under one of the choices. I went to go back to the text file, but there’s a lot of text, and I wasn’t sure exactly where to put the second option…So, after what/where should I put it?


Let’s say you meant to have the choice “Turn left” or “Turn right,” and discovered that only “Turn left” was there. What you’d need to do is search for “Turn left” in your .txt file, and you would find a choice something like this:

  #Turn left
    The game continues!
    *goto next_choice

I’d then check to see whether “Turn right” was somewhere below there, but being missed by the computer because the spacing wasn’t the same as the spacing for #Turn left. If so, I’d fix the spacing.

If not, I’d just insert the other choice I meant to have:

  #Turn right.
    You die!... just kidding.
    *goto other_choice
  #Turn left
    The game continues!
    *goto next_choice

If that doesn’t help, then perhaps you might share your actual .txt file?



It helps, but at the same time it doesn’t. My files are really, really long, so it’s a bit hard to see where the final *goto is. I’ll try it out, though.


Okay, and here’s another question:

I accidently forgot to add two spaces in the majority of my lines under a two options that are very, very long. Is there any faster way than just adding two spaces to each line?


You could try using the TAB key.


Tab is a very good option. I always use Tab and it is very easy to track.


I find the TAB does bring with it a better chance for errors. I’d just put on a good song and add the spaces, and it will be over before you know it


Word of Caution:
Please be sure that you don’t mix tabs and spaces. It will cause frustrating errors.

Notepad++ Tip:
You can change your TAB key to insert a designated amount of spaces instead of a full TAB. Simply choose settings in your menu and click on preferences. In the Language Menu/Tab Settings tab, you can find a section that notes your TAB size and a checkbox indicating whether or not to use spaces instead. Just check the box and click the number to change it to your prefered number of spaces. This eliminates a lot of the indentation issues people seem to encounter.

Notepad++ Tip 2:
If you ever find that you made a mistake and need move entire blocks of text over, highlighting the offending text and pressing either TAB to increase indent or SHIFT+TAB to decrease indent fixes your problem in one easy step.

I’m not sure if there are similar solutions for other programs, but looking up shortcuts can make your projects less of a hassle.


Choicescript was developed to be as natural as possible so non-programmers can take to it easily, but one of the down-sides of the design choices involved is that it’s too easy to write convoluted “spaghetti code” that can be hell to figure out. This is because it doesn’t impose any structure.

A graphical editor like Notepad++ can be a big help figuring stuff out in a block of code, but tracing a path that involves significant numbers of goto’s can still be hellish. Therefore use gosub instead of goto whenever possible. You’ll thank yourself later. Blocks of code also should be kept within a page or two in size. If it’s longer, than turn it into two blocks, each accomplishing a different task. It’s thus very useful for the author to write in as structured a manner as possible in order to both make the code easier to follow, and easier to debug.