"Error: It is illegal to fall out of a *choice statement" despite using *fake_choice

I am constantly running into the

It is illegal to fall out of a *choice statement; 
you must *goto or *finish before the end of the indented block.

error statement in my game despite using commands like *fake_choice and *create implicit_control_flow true. Do note that this is in a *fake_choice with sub-groups (a.k.a. multiple choices bodies in one page). Other instances of *fake_choice that don’t have sub-group work completely fine.

The code used in this image:

*title Test Dummy
*author Monkey Lottery
*scene_list
  startup

*create implicit_control_flow true 
*create fruits "NULL" 

*fake_choice Apples Oranges 
  #One Apple 
    #One Orange 
      *set fruits "1 apple 1 orange"

    #Two Oranges 
      *set fruits "1 apple 2 oranges"

    #Three Oranges 
      *set fruits "1 apple 3 oranges"

  #Two Apples 
    #One Orange 
      *set fruits "2 apples 1 orange"
    #Two Oranges 
      *set fruits "2 apples 2 oranges"
       
    #Three Oranges 
      *set fruits "2 apples 3 oranges"
       
  #Three Apples
    #One Orange 
      *set fruits "3 apples 1 orange"
       
    #Two Oranges 
      *set fruits "3 apples 2 oranges"
       
    #Three Oranges 
      *set fruits "3 apples 3 oranges"
       
You have ${fruits}
*finish


Another observation I’ve noted is that it also appears to be unpredictable. In some runs, all of the options work fine (meaning I don’t get the error message at all) while all the second options (Two Apples and Two Oranges) would incur the message.

When I close my browser and run the game again, all of the options cause the error message suddenly despite running perfectly in a previous test.

Any help with this problem would be greatly appreciated. Thanks!

1 Like

I’ve never heard of sub-groups until now, however, from what you’ve described, I would add another fake choice command right above the oranges choice.

*fake_choice Apples Oranges 
  #One Apple
    *fake_choice 
     #One Orange 
       *set fruits "1 apple 1 orange"

     #Two Oranges 
       *set fruits "1 apple 2 oranges"

     #Three Oranges 
       *set fruits "1 apple 3 oranges"

I’ve had to do the same thing in the game I’m making. Unless this would no longer make it a sub-group.

@Phantmwolf Don’t forget to indent the second options one more level now that you added *fake_choice. Unless sub-groups don’t need that. Sub-groups are new to me.

Unfortunately, it’s a pain in the ass to indent properly using the mobile version of this site, otherwise I would have.

They are new to me as well, so I’ll be testing this out later.

1 Like

It would seem that even with *fake_choice, sub-groups still need the *goto command.

*fake_choice Apple Orange
    #One Apple 
        #One Orange 
            *set fruits "1 apple 1 orange"
            *goto 1
        #Two Oranges 
            *set fruits "1 apple 2 oranges"
            *goto 1
        #Three Oranges 
            *set fruits "1 apple 3 oranges"
            *goto 1
    #Two Apples 
        #One Orange 
            *set fruits "2 apples 1 orange"
            *goto 1
        #Two Oranges 
            *set fruits "2 apples 2 oranges"
            *goto 1
        #Three Oranges 
            *set fruits "2 apples 3 oranges"
            *goto 1
    #Three Apples
        #One Orange 
            *set fruits "3 apples 1 orange"
            *goto 1
        #Two Oranges 
            *set fruits "3 apples 2 oranges"
            *goto 1
        #Three Oranges 
            *set fruits "3 apples 3 oranges
            *goto 1
*label 1
You have ${fruits}
*finish

You shouldn’t have any problems with this. And because I like to torture myself, I made a three sub-group choice just for fun.

*fake_choice Apple Orange Banana
    #One Apple 
        #One Orange
            #One Banana
                *set fruits "1 apple 1 orange 1 banana"
                *goto 1
            #Two Bananas
                *set fruits "1 apple 1 orange 2 bananas"
                *goto 1
            #Three Bananas
                *set fruits "1 apple 1 orange 3 bananas"
                *goto 1
        #Two Oranges
            #One Banana
                *set fruits "1 apple 2 oranges 1 banana"
                *goto 1
            #Two Bananas
                *set fruits "1 apple 2 oranges 2 bananas"
                *goto 1
            #Three Bananas
                *set fruits "1 apple 2 oranges 3 bananas"
                *goto 1
        #Three Oranges
            #One Banana
                *set fruits "1 apple 3 oranges 1 banana"
                *goto 1
            #Two Bananas
                *set fruits "1 apple 3 oranges 2 bananas"
                *goto 1
            #Three Bananas
                *set fruits "1 apple 3 oranges 3 Bananas"
                *goto 1
    #Two Apples 
        #One Orange
            #One Banana
                *set fruits "2 apples 1 orange 1 banana"
                *goto 1
            #Two Bananas
                *set fruits "2 apples 1 orange 2 bananas"
                *goto 1
            #Three Bananas
                *set fruits "2 apples 1 orange 3 bananas"
                *goto 1
        #Two Oranges
            #One Banana
                *set fruits "1 apple 2 oranges 1 banana"
                *goto 1
            #Two Bananas
                *set fruits "1 apple 2 oranges 2 bananas"
                *goto 1
            #Three Bananas
                *set fruits "2 apples 2 oranges 3 bananas"
                *goto 1
        #Three Oranges
            #One Banana
                *set fruits "1 apple 3 oranges 1 banana"
                *goto 1
            #Two Bananas
                *set fruits "1 apple 3 oranges 2 bananas"
                *goto 1
            #Three Bananas
                *set fruits "2 apples 3 oranges 3 bananas"
                *goto 1
    #Three Apples
        #One Orange 
            #One Banana
                *set fruits "3 apples 1 orange 1 banana"
                *goto 1
            #Two Bananas
                *set fruits "3 apples 1 orange 2 bananas"
                *goto 1
            #Three Bananas
                *set fruits "3 apples 1 orange 3 bananas"
                *goto 1
        #Two Oranges 
            #One Banana
                *set fruits "3 apples 2 oranges 1 banana"
                *goto 1
            #Two Bananas
                *set fruits "3 apples 2 oranges 2 bananas"
                *goto 1
            #Three Bananas
                *set fruits "3 apples 2 oranges 3 bananas"
                *goto 1
        #Three Oranges
            #One Banana
                *set fruits "3 apples 3 oranges 1 banana"
                *goto 1
            #Two Bananas
                *set fruits "3 apples 3 oranges 2 bananas"
                *goto 1
            #Three Bananas
                *set fruits "3 apples 3 oranges 3 bananas"
                *goto 1
*label 1
You have ${fruits}
*finish
2 Likes

Thanks for the feedback! Yes, I also just ended up settling with using a series of *goto commands as well. I appreciate your effort painstakingly coding these things on mobile and for experimenting a bit.

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.