Falling out of choice

Hey everybody,

I created a simple name and gender selection, and when I autotest it tells me that its ilegal to fall out of choice statment. I know what that means, but I dont see where do I fall out of one. Thanks

*choice
_____ #No.
_______*if (gendertext = “Male”)
________*goto namechoosingmale
______ *if (gendertext = “Female”)
________*goto namechoosingfemale
_____ #Yes.
________ *page_break
________*goto after_name

1 Like

It sounds like it’s just an indentation issue, but with just this I can’t be sure. It’d help if you posted the actual code here. (You can make it show up with the proper indentation by selecting the code and clicking the Preformatted text button. It looks like </> )

Taking a look I am not seeing the problem, but I often find in my code it is the choice beforehand that I forgot to place a finish or goto.

1 Like

now I tested it manually and its really weird, becuse the game seems to be working fine, yet the autotest won’t.

Can you past the whole code?

*label name_is_true
Your name is ${first_Name} ${last_name}, Is that true?

*choice
     #No.
      *if (gender_text = "Male")
       *goto name_choosing_male
      *if (gender_text = "Female")
       *goto name_choosing_female
     #Yes.
       *page_break
       *goto after_name


*label after_name
*achieve character_created
1 Like

I do to see a problem I would think the error is coming before hand. This is my guess with out looking at the complete code. But I am not by any means a pro here, maybe someone else with more skills can point you in the right direction.

1 Like

This is a standard quicktest fake bug. https://www.choiceofgames.com/make-your-own-games/testing-choicescript-games-automatically/#fakes

Yours is almost exactly “Example 3” from that section, the “Gender Bug.”

1 Like

@dfabulich so how do I fix that using the *bug command?

Again without seeing the full code sounds like you need to ensure gender is selected before you reach this choice.

The best way to fix it is with *else.

*choice
     #No.
      *if (gender_text = "Male")
       *goto name_choosing_male
      *else
       *goto name_choosing_female
     #Yes.
       *page_break
       *goto after_name


*label after_name
*achieve character_created

But, if you really insist on using *bug, you can do it like this:

*label name_is_true
Your name is ${first_Name} ${last_name}, Is that true?

*choice
     #No.
      *if (gender_text = "Male")
       *goto name_choosing_male
      *if (gender_text = "Female")
       *goto name_choosing_female
      *bug
     #Yes.
       *page_break
       *goto after_name


*label after_name
*achieve character_created
1 Like

thank you very much!

1 Like