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

Please visit my website for more templates and guides!
https://www.dara-amarie.com/

FIRST AND FOREMOST, to remember choices, you will need to use the if/elif/else code, which looks like this:

if (label1) {
} elif (label2) {
} else {
}

if is always first, elif is always in the middle, and else should always be the last one by itself

if you have 2 options, you only need to use if and else
if (label) {
} else {
}

if you have 3 options, use if then elif then else
if (label1) {
} elif (label2) {
} 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 (label1) {
} elif (label2) {
} elif (label3) {
} elif (label4) {
} else {
}

There are 2 methods to remembering past choices:

1- The choice name and option method
2- Using GAINS

1. Choice Name & Option Method

Name your choice by adding the name next to the word choice and put it inside parentheses. Choice names cannot have spaces: they can only be consisted of letters, numbers, and/or underscores.

Here is an example:

NARRATOR
What do you want to eat?

choice (FOOD)
“Spaghetti” {

} “Donuts” {

} “Sandwich” {
}

TO REMEMBER THE ABOVE CHOICE, USE THE IF/ELIF/ELSE CODE WITH THIS FORMAT: (choice_name is "Option Name")

if (FOOD is “Spaghetti”) {
[scene for spaghetti choice here]

} elif (FOOD is “Donuts”) {
[scene for donuts choice here]

} else {
[scene for sandwhich choice here]
}

NOTES:
This is the best method to use for dressing games!
CLICK HERE for a simple dressing game template!

This method will not work with a customization template or repeated choices:

Customization templates have repeated choices. 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 gets repeated.

Your choice name and option titles need to match exactly

If your choice name is “YUM_food” and your option name is “I LoVe DonuTS!!”, then the format for the if/elif/else needs to be (YUM_food is “I LoVe DonuTS!!”)

Wrap straight brackets around the choice name to reference that option in dialogue

You can use the choice name to reference what the reader chose in dialogue; just wrap straight brackets around the choice name.

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 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.

2. USING FLAGS/GAINS

You can have your readers gain certain flags by just using the code: gain flag_name

Here is an example:

NARRATOR
What do you want to drink?

choice
“Orange Juice” {
gain orange_juice

} “Coffee” {
gain coffee

} “Water” {
gain water
}

TO REMEMBER THE ABOVE CHOICE, USE THE IF/ELIF/ELSE CODE WITH JUST THE GAIN NAME INSIDE PARENTHESES ()

if (orange_juice) {
[scene for orange juice here]

} elif (coffee) {
[scene for coffee here]

} else {
[scene for water here]
}

NOTES:

  1. Once a flag is gained, you cannot “un-gain” it. So be sure that if you use this method with dressing games, you will need to put a “yes/no” choice inside each outfit option with the gain inside the “yes” choice. Click Here for a Dressing Game with Flags.
  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 gains to all those choices will result in the reader gaining all of those gains after clicking on all the options.
  3. Gain names cannot have spaces or special characters. They can only have letters, numbers, and/or underscores.
281 Likes

but I’ve never used “else” cuz it didn’t work at all :confused:

3 Likes

If you’re using gains, you have to remember to reset story progress. Otherwise it should always work.

7 Likes

Can you do that on mobile?

Mobile creation? No you can’t. This is only for directing using the script in the writer’s portal online.

2 Likes

alright thank you!

1 Like

No you replace that with your outfit changing script scene.

1 Like

[outfit changing scene] gets replaced with the script/commands to have your character change into the outfits

so this:

choice
"Short Dress" {
[outfit changing scene]

changes into this: (or whatever you want)

choice
"Short Dress" {
@CHARACTER changes into Outfit
@CHARACTER is blush
4 Likes

How do you reset gains

You can’t, unfortunately.

3 Likes

hi , I’m a little confused and i need your help.
it keeps saying that error and i don’t know what to do.

What’s after the “hell no” choice in your script?

1 Like

nothing , but another label.

Then there should be 1 more ending bracket at the end:

}
“Hell no!” {

goto choosing_outfits

}
}

4 Likes

Thank you so much!!! it finally worked :heart:

i’m sorry to bother you again but i have come across another problem.

3 Likes

“else” needs to be by itself

} else {

1 Like

I don’t get it , could you explain it a little more in depth?

1 Like

It’s all explained in the guide above. The word “else” needs to be by itself with nothing in parentheses next to it.

2 Likes

okay, thanks again,