If this then that?

In my game, I have a lot of dialog that sets what kind of character you are. For example you are asked if you have a brother or sister. Later in the game there will be a scene including either your bother or sister depending on what you picked…but how do I code for that to make it match up with all the different options?


*if brother
     brother stuff
*if sister
     sister stuff

Thanks but I don’t fully understand how the *if commands work?

It checks certain variables. So like this:

 
*if stealth = 75
     your stealth is 75/100. 

In Sam’s first example,

*if brother

is the same as writing

*if brother=true

It assumes you created brother as a true/false (or “Boolean”) variable.


*create brother false
*create sister false
*create sib ""

*choice
 #Do you have a brother 
  *set  brother true
  *set sib "brother"
  *goto some_place
 #or sister?
  *set sister true
  *set sib "sister"
  *goto some_place

*label some_place
I talked to your ${sib} yesterday.
*goto next_some_place

*label next_some_place
"I hate you!"
*if (brother)
 Go rot in hell!
 *finish
*if (sister)
 You're so silly when I make you mad.
 *finish


And to think all this time, I’ve been putting true/false in parenthesis.

@Doctor
It’s not necessary, but it’s also useful because it’s easy to spot.

oh thanks… I think I am getting it…kinda? O.o

I’ve been going in a different direction. I like to assign numerical values to these sorts of variables, because that way you can change the number a bunch of times to reflect different conditions.

So, for example, the game might ask whether you have a brother. If you say yes, then *set brother 1 (from its starting point of 0).

If you later get in a fight with your brother and he now hates you, you can *set brother 2. If he dies, then *set brother 3, and so on. The “brother” variable now can mean 4 different things during the story, rather than just be true/false.

So down the road you might have a scene where someone asks about your brother. If the brother variable is 0, you might answer “what brother?!?” and then *goto the corresponding scene. If it’s 1 you just talk about him. If it’s 2 you say “I freaking hate the guy” and if it’s 3 you say “no, he was smothered to death by Morgana the Kissing Bandit” etc.

@distracteddad
“no, he was smothered to death by Morgana the Kissing Bandit” Lol xD

But for things like that, I just create variables like “brother_dead” and then I would use a percentile stat to track our relationship, since that’s more dynamic and accurate than just 1 or 2.

Assigning numerical values to variables is probably the easiest way to code for conditional scenes like the one you seem to be attempting. Like @distracteddad explained, create a variable, and depending on the choice someone makes, assign a value to that variable (for example, *set response 1). When you want that choice to determine which scene a player reaches, you can run a check on that variable and then direct them to the correct scene with a *goto command.

I made a tutorial on the matter, the same principles for the mc can be applied to a brother/sister situation.