Error in if/elif/else code

Hi everyone! I’m new here so I don’t have much experience…
I need help with the if/elif/else code.
I wanted to make a dressing game where the character has to choose three dresses in which there are three different swimsuits, so I wrote the basic template of the dressing game with the dresses and, after this, I put some codes so that people can see the swimsuit under the dress. I obviously created six outfits: three for the dresses and three for the swimsuits under them. When people choose a dress, the game will show the relative swimsuit under it, but when the dressing game is ended, I would like the character to put back on the chosen dress. The error comes at this point: I used the if/elif/else code because the game has to remember what dress is chosen, so that the character can put it back on. But it doesn’t seem to work, because when I see the preview and choose dress x, the game shows me the swimsuit x but at the end, the character wears dress y.
I don’t know how to solve this… I tried to switch the outfits’ positions in the code but it happened the same thing.
This is my script:
label dressinggame
YOU (think_rubchin)
(What should I wear?)
choice (SWIMSUIT)
“Black Raven Flowers” {
@YOU exits left
@YOU changes into Black Raven Flowers
@pause for a beat
@YOU enters from left to screen center
@YOU faces left
NARRATOR (YOU)
And here’s the swimsuit.
@YOU starts dustoff_neutral_loop
@pause for a beat
@pause for a beat
@pause for a beat
@YOU changes into Blue Raven
@YOU starts primp_neutral
@pause for a beat
@pause for a beat
} “Snow Blue Flowers” {
@YOU exits left
@YOU changes into Snow Blue Flowers
@pause for a beat
@YOU enters from left to screen center
@YOU faces left
NARRATOR (YOU)
And here’s the swimsuit.
@YOU starts dustoff_neutral_loop
@pause for a beat
@pause for a beat
@pause for a beat
@YOU changes into Blue and White
@YOU starts primp_neutral
@pause for a beat
@pause for a beat
} “Lavender Wrap” {
@YOU exits left
@YOU changes into Lavender Wrap
@pause for a beat
@YOU enters from left to screen center
@YOU faces left
NARRATOR (YOU)
And here’s the swimsuit.
@YOU starts dustoff_neutral_loop
@pause for a beat
@pause for a beat
@pause for a beat
@YOU changes into Lavender
@YOU starts primp_neutral
@pause for a beat
@pause for a beat
}
YOU (think_rubchin)
(Do I like this swimsuit?)
choice
“Yes!” {
YOU (listen_nod_happy_loop)
(It’s perfect!)
if (SWIMSUIT is “Blue Raven”) {
@YOU starts dustoff_neutral_loop
@pause for a beat
@pause for a beat
@pause for a beat
@YOU changes into Black Raven Flowers
} elif (SWIMSUIT is “Lavender”) {
@YOU starts dustoff_neutral_loop
@pause for a beat
@pause for a beat
@pause for a beat
@YOU changes into Lavender Wrap
}
else {
@YOU starts dustoff_neutral_loop
@pause for a beat
@pause for a beat
@pause for a beat
@YOU changes into Snow Blue Flowers
}
} “No, I want to try something else.” {
goto dressinggame
}

Can you help me solve this, please?
Thank you in advance!

Hmm… the codes a bit messy but would I recommend is adding a continue label and moving the if/eif/else under the choice:

YOU (think_rubchin)
(Do I like this swimsuit?)
choice
“Yes!” {
YOU (listen_nod_happy_loop)
(It’s perfect!)
continue
} “No, I want to try something else.” {
goto dressinggame
}

if (SWIMSUIT is “Blue Raven”) {
@YOU starts dustoff_neutral_loop
@pause for a beat
@pause for a beat
@pause for a beat
@YOU changes into Black Raven Flowers
} elif (SWIMSUIT is “Lavender”) {
@YOU starts dustoff_neutral_loop
@pause for a beat
@pause for a beat
@pause for a beat
@YOU changes into Lavender Wrap
}
else {
@YOU starts dustoff_neutral_loop
@pause for a beat
@pause for a beat
@pause for a beat
@YOU changes into Snow Blue Flowers
}

Unfortunately it doesn’t work. Even if I choose different outfits, the character keeps wearing “Snow Blue Flowers” at the end.

Try this:

if (SWIMSUIT is “Black Raven Flowers”) {
@YOU starts dustoff_neutral_loop
@pause for a beat
@pause for a beat
@pause for a beat
@YOU changes into Black Raven Flowers
} elif (SWIMSUIT is “Lavender Wrap”) {
@YOU starts dustoff_neutral_loop
@pause for a beat
@pause for a beat
@pause for a beat
@YOU changes into Lavender Wrap
}else {
@YOU starts dustoff_neutral_loop
@pause for a beat
@pause for a beat
@pause for a beat
@YOU changes into Snow Blue Flowers
}

1 Like

Also instead of adding @pause for beat many times in your story, you can add @pause for S and replace S with an actual number (S stands for number of seconds)

So, for example @pause for 3 means the scene would be paused for 3 seconds : )
@pause for 5 means the scene is paused for five seconds and so forth :sunny:

Thank you!! You’re a life saver! :heart_eyes:

No problem :wink:

1 Like