Using the if/elif/else coding


#1

Since this coding is used for complex choices, how would I use it to show the outcome of the other choice which is the “else?” Do I just switch the “If” and the “elif” choices around?


#2

Not sure I understand your question, but else will always be the last choice outcome.


#3

I know, but in my story there are two choices. I’m only using the if/elif/else coding for the first choice ONLY to show the outcome of that choice. What if I want to show the outcome of the second choice as well? How would I use the if/elif/else coding for that? What I’m saying is, how would I like to show the outcome of both choices.


#4

So you want to show both the outcomes?
Explain the scene to me.


#5

Yes ma’am! The scene is, I have two choices where the reader gets to choice rather or not the main eavesdrop on two girls talking, and to not eavesdrop. The next two scenes, the main character is talking to the other girl that she saw talking, and she can either confront the girl about her listening in to her and the other girl’s conversation or to not confront her about it. That’s where the if/elif/else coding comes in at because I want to show both outcomes of the choices based on what the reader choose from the beginning. I just want the story to make sense. I know it’s complex choices and branching, and it can get really complicated.


#6

So what I’m getting from this is that you’re if/elif/else has to do whether or not the character eavesdropped and then it breaks off into another choice that determines whether or not a character gets confronted for eavesdropping?


#7

Yes that’s what I’m saying.


#8

So you can use nested choices or labels. Labels are the easier version, so I’ll explain that option.

You simply divide your outcomes into labeled sections and then use goto within the if/elif/else command.

Ex:

if (eavesdrop) {

BRANCHING

goto eavesdrop_confrontation

} else {

BRANCHING

goto continue_story

}

Story with eavesdropping

label eavesdrop_confrontation

choice
“Confront her” {

BRANCHING

} “Don’t confront her” {

BRANCHING

}

label continue_story

Story without eavesdrop


#9

Ohhh okay. So I would’ve had to use the gotos instead of the whole if/elif/else && else coding.


#10

That’s what I would suggest for you specifically, yes.


#11

Okay. I followed exactly how you did it, but I have an error that says unexpected choice. I don’t know what that means.


#12

Let’s see your script


#13

Okay. First I’m going to show what my previous choices looked like before we get into this coding of remembering those choices.

Previous Scene with the Choices:
choice (SHOULD I LISTEN)
“Be an eavesdropper.”{
DIALOGUE
gain Be_an_eavesdropper
}“Do not listen in.”{
DIALOGUE
gain do_not_listen_in
}

Current Choices:
if (Be_an_eavesdropper.) {
goto eavesdropper_confrontation
} else {
goto continue_story
}

label eavesdrop_confrontation
RAINA (talk_shrug)
Is there something wrong Ash?
choice (CONFRONT HER)
“Confront her” {
DIALOGUE
} “Don’t confront her” {
}
label continue_story


#14

I think I named the choice wrong, but I don’t know :frowning:


#15

Label mistake:


#16

I’m having another issue. For some reason, I don’t know how to make dialogue between those choices about confronting her or not confronting her.


#17

Well that really depends on what you want to happen and what you want your characters to say.


#18

I know but how would I fit that in between the choices? On my script, the two characters are having a conversation but when I go to see it on my phone, it doesn’t show the conversation that they are having.