How do you code to remember choices?

Hey guys. I need help on how to code to remember choices. Can someone help me please?

Thank you so much!

There are two methods. Flags or choice names.

Method 1 (flags)

NARR
Dialogue here.

choice
“Option 1”{
gain chose_1
}“Option 2”{
gain chose_2
}

Later…

if (chose_1){
#Coding here
}elif (chose_2){
#Coding here
}

Method 2 (choice names)

NARR
Dialogue here.

choice (choice_name)
“Option 1”{
#Code here.
}“Option 2”{
#Code here
}

Later…

if (choice_name is “Option 1”){
#Code here.
}elif (choice_name is “Option 2”){
#Code here.
}

2 Likes

What’s the difference? This is definitely new to me :sweat_smile:

And, where does the if, elif go?

Correct me if I’m wrong, but I don’t think there’s a difference other than the way you are gonna code the choices.

As for the if/elif/else, it would go where you want the choice to be remembered.

1 Like

Is this like the point system?

The point system and the gain system are very similar in the respect that both are used to track the reader’s choices and whether or not certain conditions have been met. The gain system, however, is allowed to store each choice as a separate condition instead of creating an accumulative score like the point system.

Ultimately, the point system is used typically when the writer wants the reader to have different results based on what their choices have been overall or over a series of choices. The gain system is typically used when the writer wants the reader to instead have different results based on one singular choice made previously in the story.

I hope this helps.

2 Likes

Yes that does help. How would I keep track what the reader chose for it to affect future scenes?

Look, I found this. Maybe this could help you

2 Likes

Ooo I will definitely give this a shot. I still don’t understand how will I know what option the reader chose

To break the above down…

Method 1 (flags/the gain system)

NARRATOR
Dialogue here

choice (regular text is typical coding for choices. The new code is in bold.)
“Option 1”{

gain flag_name_1

} “Option 2”{

gain flag_name_2

}

Explanation: The gain code is like a marker. When Option 1 is chosen, flag_name_1 will be remembered by the program/app. This will be used…

Later…

if (flag_name_1){

#Coding based on the reader having chosen Option 1

}elif (flag_name_2){

#Coding based on the reader having chosen Option 2

}else{

#Coding for if there was any other Option not accounted for above (or this can be left blank)

}

Explanation: This is what checks which choice the reader has made. If the reader chose Option 1, the flag_name_1 will exist in the program, so the app will use the code based on the reader having chosen Option 1. This is the same for Option 2.

I hope this helps.

1 Like

Thank you so much for breaking it down. I really appreciate this. I will try it in my script and if I need any help, can I ask?

Sure. Feel free to ask if you need any help or clarifications. I’ll probably be on for a little over an hour. You likely won’t get a reply until tomorrow after that.

1 Like

That is totally fine. I will be on and off today as well. I will try the coding in a few minutes then keep you all updated if it worked or if I need more help :blush::revolving_hearts:

I think it will be easier if I paste here the way I scripted my choices and if possible, you guys can help me how to code the remember choices.

   TRAVIS (eyeroll_subtle)
(What a great situation I'm in.)

choice
“Tell Leon about the nightmare” {
@TRAVIS is deepbreath
@pause for 2

    TRAVIS (talk_exhausted)
I've been having the same nightmare the past 4 nights.

    LEONCOWORKER (talk_think_neutral)
What's the nightmare about?

    TRAVIS (talk_sad)
A woman covered in blood, being stabbed by someone.

@LEONCOWORKER is react_startled_surprised
@pause for a beat

    LEONCOWORKER (talk_confused_mindblown)
WHAT THE HELL?

@TRAVIS is shush_neutral
@pause for 1

    TRAVIS (talk_doubtful)
Say it louder, mate.

    TRAVIS (talk_apathetic)
I don't think they heard you in China.

@LEONCOWORKER is flirt_coy AND TRAVIS is eyeroll_sarcastic
@pause for a beat

    LEONCOWORKER (talk_flirt_coy)
Sorry, bro.

    LEONCOWORKER (talk_think_neutral)
Wait, was she | animation:shuffle-sideways , bold , italic , color:red |hot?

@TRAVIS is idle_armscrossed_angry_loop

(zoom on travis armscrossed angry then leon flirt_coy then travis)

@pause for 1

    TRAVIS (talk_repulsed)
You're a pervert, mate.

@zoom on Leon

    LEONCOWORKER (talk_flex_happy)
The ladies can't resist this beast.

@TRAVIS is talk_repulsed
(zoom on Travis)
@pause for 1
@zoom on Leon

    LEONCOWORKER (talk_primp_neutral)
Don't be jealous, bro.

gain tell_travis
} “Change the subject” {
TRAVIS (idle_armscrossed_neutral_loop)
(I can’t tell him.)

    TRAVIS
(It's best I keep this to myself.)

    TRAVIS
(It would only freak him out.)

    TRAVIS (talk_reassure_neutral)
Don't worry about it, mate.

    TRAVIS (talk_primp_neutral)
You might get jealous of how crazy it was.

@LEONCOWORKER is eyeroll_sarcastic AND TRAVIS is flirt_wink_happy
@TRAVIS is laugh_chuckle

    LEONCOWORKER (talk_doubtful)
You think I'm an idiot?

    TRAVIS (talk_think_neutral)
Is that a trick question?

@TRAVIS is laugh_crackup AND LEONCOWORKER is idle_armscrossed_angry_loop
@pause for a a beat
@LEONCOWORKER is eyeroll_sarcastic
@pause for 1

    LEONCOWORKER (talk_flex_happy)
Don't be jealous because girls can't resist this sexiness.

@TRAVIS is react_disgusted_shudder AND LEONCOWORKER is flirt_wink_happy
@pause for a beat
@LEONCOWORKER is laugh_crackup
gain change_travis
}
@pause for a beat

Now, when you want the choice to be remembered, you write:

if (tell_travis) {

[Code the scene for tell_travis here]

} else {

[Code the scene for change_travis here]

}

1 Like

if (tell_travis) {
#coding of results for talking about his nightmare
} elif (change_travis) {
#coding of results for changing the subject
} else {
}

The above code is basically being interpreted by the program like this:

if the reader (as Travis) had previously decided to talk about his nightmare, the code in { } occurs
else if or if the above did not happen and instead the reader (as Travis) changed the subject, the code in the second set of { } occurs
else neither of those were chosen for some reason (which should not be the case in your code because there are only two choices), then the code in the last set of { } will occur

Note that the elif lines can be removed like the above and all the code within it can be put into the else section since there are only two choices.

1 Like

Okay so how would I code this:

NARRATOR
Dialogue here

choice (regular text is typical coding for choices. The new code is in bold.)
“Option 1”{

gain flag_name_1

} “Option 2”{

gain flag_name_2

}

From the script I sent

(: It’s already here:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.