How to use the if/elif/else coding?

I would like to know how to use the if/elif/coding. I would like my story to kind of go into different directions where a choice will affect the story. I would like the choices that I have to have different outcomes in the story line. That’s where the if/elif/else coding comes in at. Here’s my script:

ASHDEN (think)
(Should I listen in?)
choice (SHOULD I LISTEN)
“Be an eavesdropper.”{
ASHDEN (talk_shrug)
(I want to know what their talking about.)
gain Be_an_eavesdropper
}“Do not listen in.”{
ASHDEN (talk_awkward)
(It would be wrong to be nosey.)
gain do_not_listen_in
}
if (Be an eavesdropper.) {
@ASHDEN is search
NARRATOR
Hi
} Do not listen in. {
ASHDEN (talk_shrug)
(I’m just gonna go in my office.)
@ASHDEN exits left
}

Both choices are very crucial to the story line so whatever choice the reader chooses, will see what will happen in the story based on those choices. Also, I have an error that says “Expected else or elif () after block.” I don’t know what the means.

Here: DARA’S GUIDE: Remember Choices with if/elif/else

You replied on that thread but did you actually read through the guide?

Your if/elif/else is not correct. If you are using the “choice name and option” method, the format for the if/elif/else looks like this:

Also:

Also again:

I did all of that, and I did actually read that stuff on that other thread. I did the right thing, but it shows up as an error.

I can see that you didn’t. You’re mixing up the 2 methods. If you’re adding gains, then the gain name should be the only thing inside the parentheses for the if/elif/else. Instead you put just the choice option inside the parentheses.

If you’re using gains, you don’t need to name your choice.

Your if/else should look like this with only the gain name:

if (Be_an_eavesdropper) {

} else {

}

Okay. I still don’t really understand it, but I guess so :frowning: So I don’t put the second choice as the “else?”

The “else” is the 2nd option

Ohh okay. So what if there’s more than 2 options?

.

1 Like

Very helpful :slight_smile: