I need help with the if/elif/else coding

I don’t know what I’m doing wrong?

You need to remove the (other_subjects) from else.
It should be like this:

if (business_finance) {
} elif (modern_languages) {
} else {
}

Also Dara’s guide could help you.

Just editied it, but it’s still not working. There isn’t any errors but everytime I play to watch the preview it chooses a different option from what was picked in the choices.

For example, in the script I also used “gain”.

The script:
choice (MAJOR) “Business and Finance” {
gain business_finance

    MC (talk_sit_armscrossed_neutral_loop)
I'm taking Business and Finance!

    MC
I love to make money so why not learn how to make even more.

@MC starts idle_sit_neutral_loop

} “Modern Languages” {
gain modern_languages
MC
I’m taking Modern Languages, I heard being a tutor does pay well.

    MC
And learning about different languages and culture seems exciting!

} “Other” {
gain other
MC
I’m not taking anything at the moment. I still gotta figure out my career path

    MC
If anything I'm here for the extra credits and to get my degree.

}

Heres the if/elif/else lines!

DIMITRI (talk_think_neutral)
But what’s your major, have you decided yet?

if (MAJOR is business_finance){

    MC (talk_neutral)
I'm taking Business and Finance! Money has always been my top priority so why not take a business class. 

} elif (MAJOR is modern_languages){

    MC 
I'm taking Modern Languages! Learning about different cultures and ethnicities sound fun. And it's a different experience. 

} else {

    MC (talk_sheepish_rubneck)
I haven't decided yet! I'm still taking my time to figure it out. 

    MC (talk_sheepish_rubneck)
I know it's kind of late to make a decision since I'm at College.

}

are the choice and the if/elif in the same episode? and are you previewing only from the portal previewer?

yes! It’s in the same episode

Moved to Directing Help and Tips since this is about coding. Make sure to check out our Forum Tutorial for more info about creating topics, and feel free to PM me if you’ve got questions. :smiley:

They didn’t do it wrong. They used both gains and named choices. In their script above, they chose to use the gain to remember by, in which case they’re correct.

When you’re previewing, do you clear the flags in the modifiers of the previewer? If not, you’ll need to do that by previewing, clicking story modifiers, then flags and click all the ones that are gold. Once you do that, hit preview again from the initial choice and it should work the next time around.

The reason you need to do this is because you cannot un-gain a flag once it has already been gained. I hope that helps you :slight_smile:

Ah okay! I’ll go ahead and try it!

1 Like