# If this then that?

**URL:** <https://forum.choiceofgames.com/t/if-this-then-that/2674>\
**Category:** ChoiceScript Help\
**Created:** [August 21, 2014, 2:50pm UTC](https://forum.choiceofgames.com/t/if-this-then-that/2674 "2014-08-21T14:50:14Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![RockStarPenguin](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/rockstarpenguin/32/1842_2.png) [@RockStarPenguin](https://forum.choiceofgames.com/u/RockStarPenguin)\
**Post date:** [August 21, 2014, 2:50pm UTC](https://forum.choiceofgames.com/t/if-this-then-that/2674/1 "2014-08-21T14:50:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Samuel\_H\_Young](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/samuel_h_young/32/275971_2.png) [@Samuel\_H\_Young](https://forum.choiceofgames.com/u/Samuel_H_Young)\
**Post date:** [August 21, 2014, 2:53pm UTC](https://forum.choiceofgames.com/t/if-this-then-that/2674/2 "2014-08-21T14:53:19Z")

</div>

```

*if brother
     brother stuff
*if sister
     sister stuff

```

---

<div class="post-metadata">

**Author:** ![RockStarPenguin](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/rockstarpenguin/32/1842_2.png) [@RockStarPenguin](https://forum.choiceofgames.com/u/RockStarPenguin)\
**Post date:** [August 21, 2014, 3:01pm UTC](https://forum.choiceofgames.com/t/if-this-then-that/2674/3 "2014-08-21T15:01:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Samuel\_H\_Young](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/samuel_h_young/32/275971_2.png) [@Samuel\_H\_Young](https://forum.choiceofgames.com/u/Samuel_H_Young)\
**Post date:** [August 21, 2014, 3:22pm UTC](https://forum.choiceofgames.com/t/if-this-then-that/2674/4 "2014-08-21T15:22:12Z")

</div>

It checks certain variables. So like this:

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

```

---

<div class="post-metadata">

**Author:** ![Havenstone](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/havenstone/32/198451_2.png) [@Havenstone](https://forum.choiceofgames.com/u/Havenstone)\
**Post date:** [August 21, 2014, 3:25pm UTC](https://forum.choiceofgames.com/t/if-this-then-that/2674/5 "2014-08-21T15:25:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Lordirish](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/lordirish/32/238051_2.png) [@Lordirish](https://forum.choiceofgames.com/u/Lordirish)\
**Post date:** [August 21, 2014, 3:36pm UTC](https://forum.choiceofgames.com/t/if-this-then-that/2674/6 "2014-08-21T15:36:19Z")

</div>

```

*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

```

---

<div class="post-metadata">

**Author:** ![Doctor](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/doctor/32/29886_2.png) [@Doctor](https://forum.choiceofgames.com/u/Doctor)\
**Post date:** [August 21, 2014, 5:08pm UTC](https://forum.choiceofgames.com/t/if-this-then-that/2674/7 "2014-08-21T17:08:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Samuel\_H\_Young](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/samuel_h_young/32/275971_2.png) [@Samuel\_H\_Young](https://forum.choiceofgames.com/u/Samuel_H_Young)\
**Post date:** [August 21, 2014, 5:16pm UTC](https://forum.choiceofgames.com/t/if-this-then-that/2674/8 "2014-08-21T17:16:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RockStarPenguin](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/rockstarpenguin/32/1842_2.png) [@RockStarPenguin](https://forum.choiceofgames.com/u/RockStarPenguin)\
**Post date:** [August 21, 2014, 5:24pm UTC](https://forum.choiceofgames.com/t/if-this-then-that/2674/9 "2014-08-21T17:24:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![distracteddad](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/distracteddad/32/34163_2.png) [@distracteddad](https://forum.choiceofgames.com/u/distracteddad)\
**Post date:** [August 21, 2014, 5:35pm UTC](https://forum.choiceofgames.com/t/if-this-then-that/2674/10 "2014-08-21T17:35:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Samuel\_H\_Young](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/samuel_h_young/32/275971_2.png) [@Samuel\_H\_Young](https://forum.choiceofgames.com/u/Samuel_H_Young)\
**Post date:** [August 21, 2014, 6:02pm UTC](https://forum.choiceofgames.com/t/if-this-then-that/2674/11 "2014-08-21T18:02:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![VoiD](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/void/32/111450_2.png) [@VoiD](https://forum.choiceofgames.com/u/VoiD)\
**Post date:** [August 21, 2014, 9:54pm UTC](https://forum.choiceofgames.com/t/if-this-then-that/2674/12 "2014-08-21T21:54:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MutonElite](https://avatars.discourse-cdn.com/v4/letter/m/43a26b/32.png) [@MutonElite](https://forum.choiceofgames.com/u/MutonElite)\
**Post date:** [August 22, 2014, 3:20am UTC](https://forum.choiceofgames.com/t/if-this-then-that/2674/13 "2014-08-22T03:20:07Z")

</div>

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

> **[Tutorial : Basic Choice of Genders in Games](https://forum.choiceofgames.com/t/2609)**
>
> This simple tutorial will show you the basics of a binary gender selection, male or female. If there is interest for it, I could make an advanced version detailing a third or no gender option as well, but this should still be enough to give you an...
