Else, if & elif confusion

For these type of commands, I’ve always used if and elif, (they work fine) so I’m wondering what else is? It always gives me an error saying “Unexpected expression: Did you leave out the word “choice”. or forgot put a characters name in all CAPS” and I changes to elif and the error goes away, so whats “else” for?

1 Like

How are you writing else in your script? “else” should always be by itself.

else is used as “other”. It’s best to always use else as the last condition. The reason for this is if elif is wrongly used where it should be else, the computer won’t have any idea which branch to choose and will default to whatever it feels like choosing in that moment.

1 Like

This is an example. If it was used in a dressing game.

if (OUTFIT is “Outfit 1”){
@CHARACTER is dustoff_loop
@CHARACTER changes into outfit1
}
elif (OUTFIT is “Outfit 2”){
@CHARACTER is dustoff_loop
@CHARACTER changes into outfit2

else {
@CHARACTER changes into Outfit 3

Else is the last thing so it wouldn’t need all the codes needed in the previous two.

1 Like

I’m using it as it depending on a choice one can make if they have a certain amount of points for a character, so if you’re saying it’s used as “other” then i’m completely misusing it lol.

so if they don’t chose an outfit it’ll change to to outfit 3 ?

If they didn’t choose outfits 1 or 2, then they will change to 3. else is pretty much “anything that’s not the above conditions”

Oh! That makes sense, thank you!

1 Like

Thanks to everyone for the help. :ok_hand: Moved the thread to Directing Help & Tips where it belongs. Closed thread as it looks to have been resolved. Thanks again!

1 Like