"Chapter1 line 29: Invalid indent. Expected at least one line in if true block."


#1
Hi there,

As you can guess, I need your help.

I honestly have no idea as to what to do. The piece of code in question is:

*if playersex ="male"
*fake_choice
  #Jack
    *set firstname "Jack"
  #Blake
    *set firstname "Blake"
  #Dominic
    *set firstname "Dominic"
  #Daniel
    *set firstname "Daniel"
  #Chase
    *set firstname "Chase"
  ##No. That's not the name beeing called.
    *input_text firstname
*goto last_name_male
*else
*fake_choice
  #Charlotte
    *set firstname "Charlotte"
  #Ellie
    *set firstname "Ellie"
  #Sophia
    *set firstname "Sophia"
  #Alexis
    *set firstname "Alexis"
  #Abagail
    *set firstname "Abagail"
  ##No. That's not the name beeing called.
    *input_text firstname 
*goto last_name_female

So i'm getting this error "Chapter1 line 29: Invalid indent. Expected at least one line in if true block" when the players gender is set to female. It works fine if the players gender is set to male.

According to the error message, the particular line in question is the "*fake_choice" command. I'm really confused here.

Hope you guys can help,
Thanks in advance!

#2

It might be best if you used *if playersex = “female” instead of *else. Also, I’m pretty sure there should be an indent in the subsequent line after using an *if or *else command.


#3

I already tried indenting the *fake_choice command but when the player gender is set to mail, the first name options are skipped.


#4

Did you try using two *if commands instead of an *if and a *else? Also, what comes after *if should be in brackets


#5

Is ##No in your code?

Also, your indentations/labels are slightly off. Is that just a copy/paste error? That else isn’t going to be hit because *goto last_name_male is before it.


#6

I changed the *else to *if, I added in the brackets and tried playing the game with the *fake_choice command indented and then unindented. When it’s unindented, and the player gender is set to mail, everything is fine. However, if the player gender is set to female, I still get the same error message. If the *fake_choice command is indented, I get the error message “invalid indent. Expected at least one choice”


#7

I corrected the ##no in my code and i’vchanged the *else to *if. how is my indentation and labelling off?


#8

I generally use tabs instead of spaces since I find those are easier to keep track of my indentations.

*if playersex ="male"
	*fake_choice
		#Jack
			*set firstname "Jack"
		#Blake
			*set firstname "Blake"
	*goto last_name_male
*else
	*fake_choice
		#Charlotte
			*set firstname "Charlotte"
		#Ellie
			*set firstname "Ellie"

#9

Yeah. Thanks. I copied your indentation but substituted the tabs for spaces and it works now. :slight_smile: