Multiple Choices on 1 Page Helppp!

Greetings!

So, I want to learn how to code MORE THAN 1 Choice on the same page as I’ve seen it done before in other stories… I’ve been researching, searching other forums, studied that Wiki’s page for hours… URGK, I CAN’T FIND A SOLUTION!!! I don’t know what I’m doing wrong. Maybe I need sleep, but I’d SOooo appreciate it if someone could quickly code a simplified version of what’s it supposed to look like.

I mean, do I do something like this?

What is your hair color and style?

*fake_choice
#Long straight
#Medium
#Short
*finish

(for the 2nd choice)
*fake_choice
#Black
#Brown
#Red
#Blonde
*finish

??

Try to look here: How do I put multiple choices on one page?

Hi.

I did, but the coding there looks too complicated and overwhelming that I didn’t get it… most of their choices were too long =/ I’d just like a clean, simple version, but thanks! =)

The code is a bit clunky and overwhelming, but it’s basically like this.

*choice hehe hoho
   #Choice A Option 1
      #Choice B Option 1
      #Choice B Option 2
      #Choice B Option 3
   #Choice A Option 2
      #Choice B Option 1
      #Choice B Option 2
      #Choice B Option 3

That should give you

3 Likes

That looks Awesome, Szaal, as always you rock!!

So, the options next to the choices don’t need a # hashtag?

Uh, if you’re referring to the “choice” in #choice A option 1, then you still need the # tag. It’s the only way the interpretor can understand if those are the options.

Of course you can edit the texts after the hashtag.

Hmmm… Okay. On the same line then or the next?

The same line.

#Dis da option
   #Da "sub-option," or "2nd option"
1 Like

If you mean the hehe and hoho coded on the same line as the *choice, those aren’t options. Those are the names for the Choice Groups that follow. Each “Choice Group Name” must be exactly one word long, though you can “cheat” this by using underscores. he_he_he would be a valid Choice Group Name. he he he would not be a valid Choice Group Name.

As far as #choice A option 1, that’s just @Szaal 's personal notation for “This is the first option for the first choice.” You can rewrite his code like this:

*choice hehe hoho
   #This is the first option for the first choice.
      #This is the first option for the second choice.
      #This is the second option for the second choice.
      #This is the third option for the second choice.
   #This is the second option for the first choice.
      #This is the first option for the second choice.
      #This is the second option for the second choice.
      #This is the third option for the second choice.
2 Likes

Ahhhh, gotcha!

Okay. I will try this!

Thanks SOOO much you guys, have a GREAT day!! :smiley: :smiley: :smiley:

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

@dfabulich some bugs (and possible improvements?)

1 Like

Okay, I think this was my problem… but now the choice just comes up as 1 choice group, I don’t know what I’m doing wrong… ?

My first reaction is to ask if you have names for each of your Choice Groups on the same line as your *choice statement. If you’re working with two Choice Groups, it should look something like this:

*choice name1 name2
    #option
        #option
            Text goes here.
            *set variable1 " "
            *goto next_label

That’s all I’m coming up with based on your description, but it’s likely not the only possible cause. If you check that (and correct it, if necessary) but the problem persists anyway, you’ll need to post your code for us to examine.

There are a couple ways to mark your code as "preformatted text" so it displays your indents correctly.

One way is to put a trio of backticks on each of the lines above and below your code. On a US English Windows keyboard, the backtick is on the same key as the tilde. Backticks look like this: ` ` `. Tildes look like this: ~ ~ ~.

Another way is to write the <pre> and </pre> tags around your code, in the same way as the backticks.

Another way is to highlight your code after you paste it into the forums, then press the “preformatted text” button at the top of the box where you write your forum post. The button looks like this: </>

There may be other methods, but at least one of those should work for you regardless of device or posting method.

1 Like

Hellooo there! Yes, I do have names for each choice groups on same line.

*choice name1 name2
#option (name1)
#option (name2)

Why are there 2 options here? Is that how it works or do you have another *choice group for name 2?

I’m… not entirely clear what you’re asking here? And I think I’ve reached the limit of the help I can offer without seeing what you’re working with, indentation included. Please post the code you’ve written for your Choice Groups, using one of the various Preformatted Text methods I described earlier.

While I’m considering writing a complete walk-through style tutorial, there’s probably a reason I’ve never seen one written by anyone else. I know there’s a reason I haven’t yet written one myself. For now, let’s ignore the general use and focus on your specific use.

1 Like

Thank you SOOooo much for your help, Minnow, but I think I’m getting a hang of the coding… I just need to play around with it for a bit, but you’ve been a BIG help!

Thanks again!!

:smiley:

As in my example before, edited to make it looks simpler

*choice [GroupA] [GroupB]
   #XXX
      #YYY
      #YYY
      #YYY
   #XXX
      #YYY
      #YYY
      #YYY

XXX are the options for choice group [GroupA], while YYY are the options for choice group [GroupB].

To clear up any confusions and uneasiness:

  • Yes, you have to create the copy of YYY for every XXX you add
  • Yes, first indentation is the first choice group. 2nd indent for 2nd choice group
  • If you add the 3rd choice group, you’ll have ZZZ on the 3rd indentation
  • More choice groups, more indentation, more copying

As I said, “a bit clunky and overwhelming.”

1 Like

Ummm…. Okay, so I figured out how to do it for a while there, but…

Stupid me deleted the document and started a new one and now something went wrong.

“line 18: Missing expected suboption ‘Bald’; all suboptions must have same option list

What does that mean?

*edit: Hmm… Okay, so it seems I can’t have the same option (#bald, for instance) for both ChoiceGroup 1 & 2? If I delete those options, it works just fine… Weird.

Every #option in the first Choice Group must contain a complete copy of the second Choice Group’s #options.

Start by writing the *choice statement, the names for your Choice Groups, and one #option for the first Choice Group, like so:

*choice group1name group2name
    #choice1, option1

Next, write all your #options for the second Choice Group, like so:

*choice group1name group2name
    #choice1, option1
        #choice2, option1
        #choice2, option2
        #choice2, option3

Now generally, if you’re making two Choice Groups on a single page, you’re setting two different variables at the same time, and you want to give your players independent control over each. So the first Choice Group will handle the first variable, and the second Choice Group will handle the second variable. Sounds reasonable, right?

Go ahead and add all those *set commands, indented under the #options for the second Choice Group like so:

*choice group1name group2name
    #choice1, option1
        #choice2, option1
            *set variable1 "first"
            *set variable2 "first"
        #choice2, option2
            *set variable1 "first"
            *set variable2 "second"
        #choice2, option3
            *set variable1 "first"
            *set variable2 "third"

Right now, we’ve only coded one #option for the first Choice Group. So every *set variable1 has been coded for the same result! "first", in this example. However, we’ve also coded every #option for the second Choice Group, so each *set variable2 gets a different result.

Following along so far? Let’s move on.

Next, add all the *goto commands (or their equivalents, as appropriate) under the *set commands. They get the same amount of indentation as the *set commands, like so:

*choice group1name group2name
    #choice1, option1
        #choice2, option1
            *set variable1 "first"
            *set variable2 "first"
            *goto next_label
        #choice2, option2
            *set variable1 "first"
            *set variable2 "second"
            *goto next_label
        #choice2, option3
            *set variable1 "first"
            *set variable2 "third"
            *goto next_label

Now, copy everything that is indented under the first #option of the first Choice Group. Absolutely all of it.

Ready?

Write the rest of the #options for the first Choice Group, indented to match that lonely first #option. Like so:

*choice group1name group2name
    #choice1, option1
        #choice2, option1
            *set variable1 "first"
            *set variable2 "first"
            *goto next_label
        #choice2, option2
            *set variable1 "first"
            *set variable2 "second"
            *goto next_label
        #choice2, option3
            *set variable1 "first"
            *set variable2 "third"
            *goto next_label
    #choice1, option2
    #choice1, option3

Are you ready to paste? I hope you’re ready to paste! Because that’s next. You copied everything that was indented under the first #option for the first Choice Group, so now we’re pasting all that under each of the new options we wrote to finish the first Choice Group!

It'll look like so (hidden due to length, click to reveal):
*choice group1name group2name
    #choice1, option1
        #choice2, option1
            *set variable1 "first"
            *set variable2 "first"
            *goto next_label
        #choice2, option2
            *set variable1 "first"
            *set variable2 "second"
            *goto next_label
        #choice2, option3
            *set variable1 "first"
            *set variable2 "third"
            *goto next_label
    #choice1, option2
        #choice2, option1
            *set variable1 "first"
            *set variable2 "first"
            *goto next_label
        #choice2, option2
            *set variable1 "first"
            *set variable2 "second"
            *goto next_label
        #choice2, option3
            *set variable1 "first"
            *set variable2 "third"
            *goto next_label
    #choice1, option3
        #choice2, option1
            *set variable1 "first"
            *set variable2 "first"
            *goto next_label
        #choice2, option2
            *set variable1 "first"
            *set variable2 "second"
            *goto next_label
        #choice2, option3
            *set variable1 "first"
            *set variable2 "third"
            *goto next_label

Almost done! Only one last thing to do!

Now you need to go back and customize those *set variable1 commands to match which of the first Choice Group #options they’re actually indented under.

Like so:
*choice group1name group2name
    #choice1, option1
        #choice2, option1
            *set variable1 "first"
            *set variable2 "first"
            *goto next_label
        #choice2, option2
            *set variable1 "first"
            *set variable2 "second"
            *goto next_label
        #choice2, option3
            *set variable1 "first"
            *set variable2 "third"
            *goto next_label
    #choice1, option2
        #choice2, option1
            *set variable1 "second"
            *set variable2 "first"
            *goto next_label
        #choice2, option2
            *set variable1 "second"
            *set variable2 "second"
            *goto next_label
        #choice2, option3
            *set variable1 "second"
            *set variable2 "third"
            *goto next_label
    #choice1, option3
        #choice2, option1
            *set variable1 "third"
            *set variable2 "first"
            *goto next_label
        #choice2, option2
            *set variable1 "third"
            *set variable2 "second"
            *goto next_label
        #choice2, option3
            *set variable1 "third"
            *set variable2 "third"
            *goto next_label

Now it’s finally done! Probably.

You could, optionally, add some unique text in where you’re setting your variables, to indicate to the player which unique combination of #options they had chosen. You could, optionally, change each *goto command to go to a different *label. However, all the “moving parts” that make it work are complete. It’s done.

5 Likes