Falling out of choice


#1

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


[RESOLVED] Problem with *if and *elseif
#2

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 </> )


#3

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.


#4

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


#5

Can you past the whole code?


#6
*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

#7

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.


#8

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.”


#9

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


#10

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


#11

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

#12

thank you very much!