if/elif/else
To remember a choice you must use the if/elif/else coding, which looks like this:
if (condition_1) {
} elif (condition_2) {
} else {
}
if is always first, elif is always in the middle, and else should always be the last one by itself with no condition next to it; else is anything that isn't the other conditions.
if you have 2 options, you only need to use if and else
if (condition_1) {
} else {
}
if you have 3 options, use if then elif then else
if (condition_1) {
} elif (condition_2) {
} else {
}
if you have more than 3 options, keep using elif for the middle parts, but always make sure that if is first and else is last
if (condition_1) {
} elif (condition_2) {
} elif (condition_3) {
} elif (condition_4) {
} else {
}
There are two methods to remembering choices:
-
Choice Naming
-
Flags/Gains
Both of these methods work in the same episode as the choice as well as in future episodes.
Choice Naming
-
Name your choice by adding the name next to the word choice and put it inside parentheses.
-
Choice names cannot have spaces nor special characters. They can only be consisted of letters, numbers, and/or underscores.
choice (choice_name)
"Option Title" {
}
To remember a choice using the "Choice Naming" method, you must use the if/elif/else code with this format for the if's and elif's:
if (choice_name is "Option Title 1") {
} elif (choice_name is "Option Title 2") {
} else {
}
Example:
NARRATOR
What do you want to eat?
choice (FOOD)
“Turkey Sandwich” {
} “Pepperoni Pizza” {
} “Spaghetti” {
}
Then later on in the story, I'd use the if/elif/else code to remember which food option a reader chose:
if (FOOD is “Turkey Sandwich”) {
CHARACTER
That turkey sandwich was delicious!
} elif (FOOD is "Pepperoni Pizza") {
CHARACTER
That pepperoni pizza was to die for!
} else {
CHARACTER
That spaghetti didn't sit well in my stomach...
}
Things to remember:
1. This method will not work with a customization template or repeated choices.
Customization choices repeat themselves. Inside each choice is a goto that leads back to the label to start the choice over again, so technically whatever choice you tapped on does not get remembered since the choice goes back and starts over.
2. Your choice name and option titles need to match exactly!
If your choice name is (YUM_food) and your option title is “I LoVe DonuTS!!”, then the format for the if/elif needs to be
(YUM_food is “I LoVe DonuTS!!”)
3. Wrap straight brackets around the choice name so you can reference that option in dialogue.
CHARACTER
Today I had [FOOD] for lunch.
If the reader chose “Spaghetti”, then they will see:
CHARACTER
Today I had Spaghetti for lunch.
But be warned that whatever the option title is will be what the reader will see!
If the option title was “I want to eat Spaghetti!!”, then readers will see this:
CHARACTER
Today I had I want to eat Spaghetti!! for lunch.
Flags/Gains
-
You can have your readers gain certain flags by just using the code: gain flag_name
-
Flag names cannot have spaces nor special characters. They can only be consisted of letters, numbers, and/or underscores.
choice
"Option Title" {
gain flag_name
}
To remember a choice using flags, you must use the if/elif/else code with only the flag name inside the parentheses for the if's and elif's:
if (flag_name1) {
} elif (flag_name2) {
} else {
}
Example:
NARRATOR
What do you want to drink?
choice
“Orange Juice” {
gain orange_juice
} “Coffee” {
gain coffee
} “Water” {
gain water
}
Then later on in the story, I'd use the if/elif/else code to remember which drink option a reader chose:
if (orange_juice) {
CHARACTER
Yuck! I hate pulp in my orange juice!
} elif (coffee) {
CHARACTER
I always need a cup of coffee in the mornings!
} else {
CHARACTER
Nothing is healthier than just water.
}
Things to remember:
1. Once a flag is gained, you cannot “un-gain” it.
So be sure to not use this method with dressing games. If you do, you will need to put a “yes/no” choice inside each outfit option with the flag inside the “yes” choice.
To see an example of that, click on the button below:
2. You also cannot use this method with customization templates.
A customization template has choices that repeat so you can go back and keep changing your appearance and choosing multiple choices at once. Adding flags to all those choices will result in the reader gaining all of those flags after clicking on all the options.