How do I do a if NOT variable?


#1

So if I’m asking for a input (enter name) to choose a person in my episode, how do I make it so if the player inputs a name that is not one of the character’s name it resets or something?

EG.

Characters to choose from are: Brittney, John, Tyler, Jessica, Alec

If player inputs say: “Max”, which is NOT one of the characters, how do I reset the input thing or cause an event?


#2

Is Max a random name or is he also a character? Cuz there is a way to make sure certain names aren’t chosen. But if you’re looking to make sure the reader chooses one name out of a specific list of names, you’re better of using choice commands.


#3

You can put a choice of the names you want them to use


#4

Max is a random name. So I want to make an event that happens if the player inputs a name that is random and not one of the characters listed above.


#5

Okay, so you want the reader to choose a name that doesn’t exist in you story?


#6

Okay here’s an example:

If the player’s best friend is “Alex” and there is a question asking the player the name of the best friend.

If player answers “Alex” an event happens that says correct or something.

If player answers with any other name, an event happens that says wrong or something. :slight_smile:


#7

Okay so, let’s take that example and build a code out of it:

label best_friend

NARR
Who’s you best friend?

choice
“Alex” {

NARR
Correct!

continue

} “Jason” {

NARR
Incorrect!

goto best_friend

}


#8

This code will reset if they choose Jason instead of Alex


#9

Thank you. But I meant with the input text :slight_smile:

Like in some episodes they say “What is your name?” and you answer something.


#10

It’ll be more complicated but I guess I can give you a code for that too, hold on


#11

Thank you so much :slight_smile:


#12

label best_friend

input What is your best friend’s name? | What is your best friend’s name? | Done (BFF_NAME)

if (BFF_NAME is “Alex”) {

NARR
Correct!

} else {

NARR
Incorrect!

goto best_friend

}


#13

Oh my god this is perfect!!! Thank you!!


#14

You’re welcome, as with all the codes I help people with, I suggest you read through it and learn how it works, that way you can figure the next one out without a problem :relieved:


#15