How do I have an "if, else" within an "if, else" branch?


#1

So, I want to make a game where you can play a boy or girl character. So I make the different scenes with an if you chose girl or boy, then have the scenes within that bracket. Like…
if (gender is “Girl”) {
this is the girl route
} else {
this is the boy route
}
and that has worked okay before, but I’ve run into a problem with having another if, else branch within the two routes. example:
if (earlier decision is “rude response”) {
I was rude earlier in the game.
} else {
I was not rude earlier in the story.
}
I want that to be in the two different gender branches. I’ve tried to make it work but it keeps telling me that I need a { when I have one but further up. lemme example this too
if (gender is “Girl”) {
I am a girl
if (earlier is “rude”) {
I was rude earlier.
} else {
I was not rude earlier.
}
the dialogue continues regardless of rudeness
} else {
I am a boy
if (earlier is “rude”) {
I was rude earlier.
} else {
I was not rude earlier.
}
the dialogue continues regardless of rudeness
}
it tells me that the } in front of else is missing a {. I don’t understand, please help!!


#2

It means that you have an error somewhere inside those brackets. If you have 2 different story lines for different genders, the best way to go about that is to use labels (instead of having everything inside of if/elif brackets). This will also be better to find out where the actual error is at.

choice (gender)
“Girl” {
goto girl_route
} “Boy” {
goto boy_route
}

label girl_route

[girl story here]

label boy_route

[boy story here]


#3

ohh thank you so much! This seems to have fixed it, this is super helpful. plus this makes it much easier from here on to organize I think. Thanks for the help! ;u;