Tara explains: Ifs, elses, gains, labels, gotos and the points system!

I guess I’ll do that then… Thank you again! haha

1 Like

Yea sorry there’s no way of excluded names. :blue_heart:

image

1 Like

@Olive and @RudeInception

Hi both of you! I’ve read through your replies, and it seems like your questions are answered, but I thought I’d just explain how to exclude names, because there is a way to do it.

So, let’s say that your current characters’ names are, um, Bob, Sally, John, Tess, Mia and Jake.

Here’s what you’d do:

label name_input

input What’s your name?|What’s your name?|Done (YOURNAME)

if (YOURNAME is " "){

NARRATOR
Error! Please enter a name!

goto name_input

}if (YOURNAME is “Bob”) {

NARRATOR
Sorry, but you can’t call your avatar Bob - there’s someone else in the story with that name!

NARRATOR
Please try again and type in a different name.

goto name_input

}if (YOURNAME is “Sally”) {

NARRATOR
Sorry, but you can’t call your avatar Sally - there’s someone else in the story with that name!

NARRATOR
Please try again and type in a different name.

goto name_input

}if (YOURNAME is “John”) {

NARRATOR
Sorry, but you can’t call your avatar John - there’s someone else in the story with that name!

NARRATOR
Please try again and type in a different name.

goto name_input

}if (YOURNAME is “Tess”) {

NARRATOR
Sorry, but you can’t call your avatar Tess - there’s someone else in the story with that name!

NARRATOR
Please try again and type in a different name.

goto name_input

}if (YOURNAME is “Mia”) {

NARRATOR
Sorry, but you can’t call your avatar Mia - there’s someone else in the story with that name!

NARRATOR
Please try again and type in a different name.

goto name_input

}if (YOURNAME is “Jake”) {

NARRATOR
Sorry, but you can’t call your avatar Jake - there’s someone else in the story with that name!

NARRATOR
Please try again and type in a different name.

goto name_input

} else {

goto continue_story

}

label continue_story

#Start story here

Hopefully that coding makes sense, but essentially, I’ve just used ifs and elses to recognise if a certain name is entered, and then I’ve used labels to either send the reader to re-enter their name, or to continue with the story once they’ve entered a valid name. I personally don’t like using elifs so I’ve repeatedly used normal ifs, but you can replace them with elifs if you prefer!

Hopefully this makes sense to you both, and let me know if you still need help with anything!

Tara xx

8 Likes

Amazing!

image

2 Likes

Thank you so much! I really appriciate it!!!

1 Like

Your topics are very useful :heart_eyes:
I have a question:
In my story I want to create choices that will affect the future.
For example:

  1. if you choose to trust your best friend in episode 1, then in episode 3 he will remember that you trusted him and he will help you.
  2. if you choose to don’t trust your best friend in episode 1, then in episode 3 he will remember it and he won’t help you.

I thought I had to use gains, like:
EPISODE 1
Choice
“Trust him” {
MC talks…

gain trust_friend
}

“Don’t trust him” {
MC talks…

gain notrust_friend
}

EPISODE 3
if (trust_friend) {
Friend “I’ll help you!”

} else {
Friend “I won’t help you”

}

Will it work or I have to change something? Do I have to use labels or goto?

2 Likes

That’ll work as long as you’re willing to write separate stories within those brackets. If you don’t you can use goto and label to split the story and go from there. Either way it’ll work

1 Like

@crib yep, it should work, like @RudeInception said you will need to write two sets of coding but if you’re happy to do that, then it should work!

1 Like

Thank you! You explain it in way that makes it easy to understand!
This will totally improve my story ~ I’m a beginner!
Thanks so much once again!

2 Likes

Your topics are very useful :heart_eyes:
I have a question:
In my story I want to create choices that will affect the future.
For example:

if you choose to trust your best friend in episode 1, then in episode 3 he will remember that you trusted him and he will help you.
if you choose to don’t trust your best friend in episode 1, then in episode 3 he will remember it and he won’t help you.
as Same like realtionships, friendships etc.

I thought I had to use gains, like:
EPISODE 1
Choice
“FREAK OUT” {
MC talks…

gain FREAKOUT
}

“Calm down and sound like pi**ed off” {
MC talks…

gain Calm down and sound like pi**ed off
}

EPISODE 3
if (FREAKOUT) {
Friend “I’ll help you!”

} else (Calm down and sound like pi**ed off) {
Friend “I won’t help you”

}

AND

In my story I want to create choices that will affect the future.
For example:

if you choose to trust your best friend in episode 1, then in episode 3 he will remember that you trusted him and he will help you.
if you choose to don’t trust your best friend in episode 1, then in episode 3 he will remember it and he won’t help you.
I thought I had to use gains, like:
EPISODE 1
Choice
“Trust him” {
MC talks…

gain trust_friend
}

“Don’t trust him” {
MC talks…

gain notrust_friend
}

EPISODE 3
if (trust_friend) {
Friend “I’ll help you!”

} else {
Friend “I won’t help you”

}

Will it work or I have to change something? Do I have to use labels or goto?
Does not working! and i’m so confused. _ Im just beginner to gains, trust and etc. I know how to easy to basic choices.

1 Like


Here’s my screenshot.

And then

I add EPISODE 8

IF (FREAKOUT) {
CATHLYN “BALH BALH”

} else (Calm down and sound like pi**ed off) {
CATHLYN “BALH BLAH”

For you information i need help :sob:

1 Like

your gains can’t contain spaces, also I’m not sure if it will work with * as well

1 Like

Thank you so much for helping me Ape! :slight_smile:

1 Like

Hi

I have a question, what happens if I want to use if/elif/else using gains from two different choices. Can this be done, if so how?

For example:

Episode 2 - First Choice:
a) Respond to the text
b) Don’t respond to the text

I then have another choice in the next episode, which is only available to the reader if they chose not to respond to the text.

Episode 3 - Second Choice:
a) Name drop
b) Blag it

In another episode I want to use if/elif/else across both choices but I didn’t realise you could merge branches and now my story is published :\ I do have gains for each choice chosen.

This is basis of:

If - Respond to the text (Episode 2,choice 1)
Elif - Name Drop (Episode 3, choice 2)
Else - Blag it (Episode 3, choice 2)

I hope I have explained this clearly, any help/guidance would be much appreciated.

Many thanks, H xxx

1 Like

Have a look here, hope my example will help you :slight_smile:

3 Likes

Basically, your if/elif/else needs to look like this:

if (Respond to the text)
if (Name Drop) {
[script for respond to text and name drop here]
} else {
[script for respond to text and blag it here]
}
} else {
[script for don’t respond to the text here]
}

2 Likes

So example of my code wouldn’t work here if you would use gains for every option? :thinking:

1 Like

Thank you so much Dara.Amarie and Apes - both work for me!

You are literally life savers :heart:

I can’t thank you enough! xx

2 Likes

No problem, I’m glad you found this article helpful and do let me know if you need help with anything! xx

1 Like

I think your gains ideally need to be non-capitals and contain no spaces or symbols. I myself do not use gains very often, and I’m a larger fan of the points system; but if you wanted to use gains in this scenario, your coding looks right, I’d just maybe call the gain “freakout” and “calm_down” to make them easier to type and to ensure they work. Let me know if you have any problems!

1 Like