Multiple Choices on 1 Page Helppp!

Okay, so a question came up by Direct Message that I think would be more usefully answered where others can see the response, in case they have some extra insight to add, or encounter the same issue.

How do you deal with *goto and *finish in one of these? How do you deal with the “…illegal to fall out of a *choice statement…” error message when you’re using Choice Groups?

Unfortunately, implicit control flow doesn’t help here. Or rather, it tries, but it isn’t good enough. It only works correctly if the player chooses the last #option for every Choice Group except the first. The player can choose whatever they want for the first Choice Group, but if they choose any but the last for the others, they’ll still receive the error about “…illegal to fall out of a *choice statement…”, which defeats the entire purpose of using Choice Groups in the first place!

Whoops. And yes, I tested that with a fresh download of the lastest ChoiceScript.

There’s only one option: You must add a *goto, a *finish, or an equivalent command (*goto_scene, *ending, etc.) after every single option in your last Choice Group.

If the Choice Groups are meant to be the last page of the current chapter, then you can use *finish, like this:
*choice first second
    #First choice, first option.
        #Second choice, first option.
            *set variable1 "first"
            *set variable2 "first"
            *finish
        #Second choice, second option.
            *set variable1 "first"
            *set variable2 "second"
            *finish
        #Second choice, third option.
            *set variable1 "first"
            *set variable2 "third"
            *finish
    #First choice, second option.
        #Second choice, first option.
            *set variable1 "second"
            *set variable2 "first"
            *finish
        #Second choice, second option.
            *set variable1 "second"
            *set variable2 "second"
            *finish
        #Second choice, third option.
            *set variable1 "second"
            *set variable2 "third"
            *finish

Note that everything is indented under the #options for the last Choice Group. The #options for previous Choice Groups don’t receive any commands or text directly; it all gets stuffed under the last one.

If your Choice Groups aren’t meant to be the end of the chapter, then you need *goto instead. And each *goto command, of course, needs a *label to go to. (You can send multiple *goto commands to a single *label.) Here are some examples:

In this first example, everything goes to one label.
*choice first second
    #First choice, first option.
        #Second choice, first option.
            *goto next_label
        #Second choice, second option.
            *goto next_label
        #Second choice, third option.
            *goto next_label
    #First choice, second option.
        #Second choice, first option.
            *goto next_label
        #Second choice, second option.
            *goto next_label
        #Second choice, third option.
            *goto next_label

*label next_label
In this second example, everything goes to a different label, then they reunite after.
*choice first second
   #This is the first option for the first choice.
      #This is the first option for the second choice.
         *goto one_one
      #This is the second option for the second choice.
         *goto one_two
      #This is the third option for the second choice.
         *goto one_three
   #This is the second option for the first choice.
      #This is the first option for the second choice.
         *goto two_one
      #This is the second option for the second choice.
         *goto two_two
      #This is the third option for the second choice.
         *goto two_three

*label one_one
*goto reunite

*label one_two
*goto reunite

*label one_three
*goto reunite

*label two_one
*goto reunite

*label two_two
*goto reunite

*label two_three

*label reunite

One last reminder: To use Choice Groups, every Choice Group must have its own name after the *choice statement. In these examples, the names are first and second. In the earlier examples, the names were hehe and hoho. They’re not optional - the code won’t work without them. Leave them out, and ChoiceScript will only display the first Choice Group, hiding the rest. Even worse? It will bring back the error message about …illegal to fall out of a *choice statement… even if you have all your *goto commands written correctly!

3 Likes