Problem With Hidden Choices and Falling out of If Error

I’m getting a “can’t fall out of an if” error, but searching other topics with the same issue hasn’t helped me figure out what’s wrong with my code specifically. :S I’d appreciate it if someone would be willing to take a look and see if they know what the problem is.

The “no” and “funny business” variables are set if certain dialogue options are picked before the code I’ve pasted below. They display correctly and seem to function more or less as intended, but it seems like I’m getting an error if they don’t display and the player chooses any other option.

*choice
	#Anyone
		*set likes_boys true
		*set likes_girls true
		*set likes_enbys true
		*goto backhome
	#Men only
		*set likes_boys true
		*goto backhome
	#Men and Women
		*set likes_boys true
		*set likes_girls true
		*goto backhome
	#Men and other genders (non-women)
		*set likes_boys true
		*set likes_enbys true
		*goto backhome
	#Women only
		*set likes_girls true
		*goto backhome
	#Women and other genders (non-men)
		*set likes_girls true
		*set likes_enbys true
		*goto backhome
	#Other genders only
		*set likes_enbys true
		*goto backhome
	*if (no = true) #I wouldn't be. I'm not interested in anyone that way.
		*goto backhome
	*if (funnybusiness = false) #Why would that matter? What part of "no funny business" wasn't clear to you?
		*goto confirm

*label confirm
Of course, of course, I understood as much. I was simply trying to inquire about your preferences, relationship-wise. There's plenty of fish in the sea, as they say, and you could certainly have a fulfilling partnership without any so-called "funny business".
*choice
	#I'm not interested in relationships. Period.
		*goto backhome
	#Oh, I see. In that case, I suppose I would be interested in finding someone.
		Who would you be seeking out?
		*set funnybusiness true
		*goto orientation

*label backhome
I see. Thank you for sharing, I'll be keeping that in mind.

I would really appreciate any help in figuring this out. ^^;

What does specifically the error report says?

#Other genders only
		*set likes_enbys true
		*goto backhome

*if (no = true)
          #I wouldn't be. I'm not interested in anyone that way.
		*goto backhome
*if (funnybusiness = false)
         #Why would that matter? What part of "no funny business" wasn't clear to you?
		*goto confirm

Never mind that, here ya go.
Your problem is this {Indentation}

I still can’t seem to get it to work. I messed around with the indentation, but I’m still getting the same error. :confused:

Some day I’ll get used to the idea of coding in something that really, really cares about your spacing :roll_eyes:

startup line 617: It is illegal to fall in to an *else statement; you must *goto or *finish before the end of the indented block.

*choice
	#Anyone
		*set likes_boys true
		*set likes_girls true
		*set likes_enbys true
		*goto backhome
	#Men only
		*set likes_boys true
		*goto backhome
	#Men and Women
		*set likes_boys true
		*set likes_girls true
		*goto backhome
	#Men and other genders (non-women)
		*set likes_boys true
		*set likes_enbys true
		*goto backhome
	#Women only
		*set likes_girls true
		*goto backhome
	#Women and other genders (non-men)
		*set likes_girls true
		*set likes_enbys true
		*goto backhome
	#Other genders only
		*set likes_enbys true
		*goto backhome
	*if (no = true) 
                #I wouldn't be. I'm not interested in anyone that way.
		          *goto backhome
	*if (funnybusiness = false) 
               #Why would that matter? What part of "no funny business" wasn't clear to you?
		          *goto confirm

*label confirm
Of course, of course, I understood as much. I was simply trying to inquire about your preferences, relationship-wise. There's plenty of fish in the sea, as they say, and you could certainly have a fulfilling partnership without any so-called "funny business".
*choice
	#I'm not interested in relationships. Period.
		*goto backhome
	#Oh, I see. In that case, I suppose I would be interested in finding someone.
		Who would you be seeking out?
		*set funnybusiness true
		*goto orientation

*label backhome
I see. Thank you for sharing, I'll be keeping that in mind.

Did you check the indents?

Yeah, I checked the indents, tried a bunch of different ways for them to be arranged, including that exact one you have posted there. I’m still getting the same error for some reason. :confused:

Which line in the snippet is 617?

Alright, I think I’ve found the problem.

Have you considered a scenario where both conditions – *if (no = true) and *if (funnybusiness = false) – can’t be met at all?

The code won’t find a way how to continue, and thus, “Illegal to fall in” error.


As a note, @Bathala’s way of handling *if , as in

*if (condition)
   #choice body
      choice text

is preferrable to avoid quicktest/randomtest issues.


Oh. By the way, since you’re seem to be in early stage of writing, I recommend looking into Implicit Control Flow feature CS has.

…Well I feel like an idiot now. Upon closer inspection and actually looking at it in a format that shows me my line numbers (thanks Gabs), the problem isn’t even included in the snippet :man_facepalming: It’s working now. Thank you everyone for your input.

2 Likes

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