I'm having problems trying to apply an *if statement to *choices

For some reason, it just shows the male name options and doesn’t show the women’s names, even if you’re a female.
Can anyone help me with this?
Here is the code that I’m using.


*choice
	*if female
		# "ALICE!"
			*set Name "Alice"
			*goto guard
		# "MABELINE!"
			*set Name "Mabeline"
			*goto guard
		# "GERTRUDE!"
			*set Name "Gertrude"
			*goto guard
		# You are named something else
			*input_text Name
			*goto guard

	*if male
		# "HARDING!"
			*set Name "Harding"
			*goto guard
		# "DENZEL!"
			*set Name "Denzel"
			*goto guard
		# "ALLISTER!"
			*set Name "Allister"
			*goto guard
		# You are named something else
			*input_text Name
			*goto guard

The *if female is right under choice I think that’s causing the error.

You need it to be like this


*choice
  *if female
    #girl name 1

  *if female
    #girl name 2

  *if male
    #boy name 1

  *if male
    #boy name 2

@Nocturnal_Stillness
I just put a space in between the
*choice
and the
*if female
and the same thing is happening.

There’s not supposed to be spacing like that. It’s just:
*if (male) #Malename.
*if (female) #Femalename.

@lackofmops
I changed the spacing to this
But it still doesn’t work.


*choice
	*if female
		# "ALICE!"
			*set Name "Alice"
			*goto guard
		# "MABELINE!"
			*set Name "Mabeline"
			*goto guard
		# "GERTRUDE!"
			*set Name "Gertrude"
			*goto guard
		# You are named something else
			*input_text Name
			*goto guard
	*if male
		# "HARDING!"
			*set Name "Harding"
			*goto guard
		# "DENZEL!"
			*set Name "Denzel"
			*goto guard
		# "ALLISTER!"
			*set Name "Allister"
			*goto guard
		# You are named something else
			*input_text Name
			*goto guard

your problem could be that you leave spaces between # and text . also you forget write *choice

I’d do it this way instead


*if female
    *choice
        #Name 1
        #Name 2

*if male
    *choice 
        #Name3


@FairyGodfeather
ahhh, good suggestion. Thanks everybody!

Actually, I copied your code into the tester and it should work.

Is the problem with your female variable? Do you have

*set female true
*set male false

The tester’s at https://dl.dropboxusercontent.com/u/7840892/CJW/choicescript/tools/online-cs-tester/mygame/input.html I find it so extremely useful for tweaking small sections of code. You do need to define your variables at the top, I generally just do a

*temp male true
*temp female false
*temp name

*create works too though

@FairyGodfeather
I see what the problem is! I had the
*goto gender
before the
*set female true
*set male false

so it didn’t take the previous two codes into account! I just put those two before the
*goto gender
and it works now


*create male true
*create female false

*choice
	#Demon Huntress
		*set gender "Female"
		*set hunter "huntress"
		*goto gender
		*set female true
		*set male false
	#Demon Hunter
		*set gender "Male"

Hmm. I’d suspect it’s a problem with your female variable that’s causing the problems with your code, since just using what you pasted in the first post does actually work in the tester with a *set female true and *set male false

I’d need to see more of your code though to find out where the problem is, or you could try hunting it down yourself.

OH! You need to put the *goto gender at the end, after the last two sets. *goto always comes last.

@FairyGodfeather
You ninja’d me:P

edit: Fairy got there before me!

Hee! I am the speediest ninja coder. :slight_smile:

Well thanks again for all your help, everyone:)