Invalid indent, expected at least one line in 'if' true block?

I just recently just started learning how to use this, so I don’t know exactly what I’m doing wrong. Thanks in advance.

The error I’m getting is startup line 48: invalid indent, expected at least one line in ‘if’ true block.

My code looks like this:

*choice
  	#Alexandros
  		*set name "Alexandros"
  		*goto next
  	#Dionysius
  		*set name "Dionysius"
  		*goto next
  	#Philip
  		*set name "Philip"
  		*goto next
  	#Demetrius
  		*set name "Demetrius"
  		*goto next
  	#None of these
  		*goto custom_name

*if gender = "female"
*choice
  	#Alexandra
  		*set name "Alexandra"
  		*goto next
  	#Penelope
  		*set name "Penelope"
  		*goto next
  	#Phoebe
  		*set name "Phoebe"
  		*goto next
  	#Cassia
  		*set name "Cassia"
  		*goto next
  	#None of these
  		*goto custom_name
  	
*label custom_name
*input_text name
*goto next

Hey there! It looks like the problem is with indents. You need to indent everything after an if/elseif/else command. So something like…

*if gender = "female"
   *choice
      #Alexandra
         *set name "Alexandra"
         *goto next
      #Penelope
(etc)

That should fix the particular problem you’re having…However, if the purpose here is to only give sets of names associated with gender, you’re going to need to adjust your code a little more. Right now, as it is, you’ll always get the prompt for the male names and never for the female ones, because there’s no *if statement locking the male names to gender = male, at least that’s shown in this snippet of code. So what you’ll want is more like…

*if gender = male
   *choice
      #Alexandros
         *set name "Alexandros"
         *goto next
(etc)

*else
   *choice
      #Alexandra
(etc)

Note the else! You could also use

*elseif gender = female

if you wanted to have another set of names farther down for nonbinary players, or just wanted to make super duper sure that the female names only showed for female players or whatever.

Hope that helped!

7 Likes

Thanks for replying but now I’m getting a startup line 48: Illegal mixing of spaces and tabs; this line has a space, but there were tabs on line 39 error.

Nevermind, I just figured it out. Thanks for the help!

1 Like

Just for future reference… do not mix spaces and tabs! :joy: I screwed that up when I first started and spent hours going through and fixing it. Good luck!

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