# How do you code choices within choices

**URL:** <https://forum.choiceofgames.com/t/how-do-you-code-choices-within-choices/56784>\
**Category:** ChoiceScript Help\
**Created:** [May 13, 2019, 2:59pm UTC](https://forum.choiceofgames.com/t/how-do-you-code-choices-within-choices/56784 "2019-05-13T14:59:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![confusedwriter](https://avatars.discourse-cdn.com/v4/letter/c/90ced4/32.png) [@confusedwriter](https://forum.choiceofgames.com/u/confusedwriter)\
**Post date:** [May 13, 2019, 2:59pm UTC](https://forum.choiceofgames.com/t/how-do-you-code-choices-within-choices/56784/1 "2019-05-13T14:59:11Z")

</div>

Hi everyone,

So I just started using ChoiceScript today and I’ve already given myself a massive headache. How do I create choice options within choice options. I tend to alright for the first one when I’m just building on top of the example code but after that the whole thing comes crashing down and I find myself in a sea of error messages.

Thanks in advance,

Confusedwriter

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [May 13, 2019, 3:03pm UTC](https://forum.choiceofgames.com/t/how-do-you-code-choices-within-choices/56784/2 "2019-05-13T15:03:45Z")

</div>

It’s just a matter of getting the indentation correct. That said, for exactly this reason, I’d personally avoid nesting more than two choices deep. Just use \*goto with \*label to jump to the next choice(s).

---

<div class="post-metadata">

**Author:** ![Latraytray](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/latraytray/32/112912_2.png) [@Latraytray](https://forum.choiceofgames.com/u/Latraytray)\
**Post date:** [May 13, 2019, 3:33pm UTC](https://forum.choiceofgames.com/t/how-do-you-code-choices-within-choices/56784/3 "2019-05-13T15:33:25Z")

</div>

Generally I would just go

```
*choice
    #Option   
          Text
          *choice
              #Option
              #Option
              #Option
    #Option
    #Option

```

And so on.

---

<div class="post-metadata">

**Author:** ![hustlertwo](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/hustlertwo/32/34230_2.png) [@hustlertwo](https://forum.choiceofgames.com/u/hustlertwo)\
**Post date:** [May 13, 2019, 7:01pm UTC](https://forum.choiceofgames.com/t/how-do-you-code-choices-within-choices/56784/5 "2019-05-13T19:01:37Z")

</div>

I have literally never nested choices. I just use gotos and send it to different labels for the next choice. But no one accused me of being a code wizard.

---

<div class="post-metadata">

**Author:** ![Szaal](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/szaal/32/112202_2.png) [@Szaal](https://forum.choiceofgames.com/u/Szaal)\
**Post date:** [May 13, 2019, 8:16pm UTC](https://forum.choiceofgames.com/t/how-do-you-code-choices-within-choices/56784/6 "2019-05-13T20:16:28Z")

</div>

If you’re using non-default text editor, there should be option to turn whitespace marking visible; are you using default notepad?

---

<div class="post-metadata">

**Author:** ![ashestoashes018](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/ashestoashes018/32/144436_2.png) [@ashestoashes018](https://forum.choiceofgames.com/u/ashestoashes018)\
**Post date:** [May 14, 2019, 2:17am UTC](https://forum.choiceofgames.com/t/how-do-you-code-choices-within-choices/56784/7 "2019-05-14T02:17:27Z")

</div>

@Latraytray i feel like the indentation in your example is off. Shouldn’t the orginal, non-nested #options be at the same indentation of the first #option in the \*choice?

---

<div class="post-metadata">

**Author:** ![Latraytray](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/latraytray/32/112912_2.png) [@Latraytray](https://forum.choiceofgames.com/u/Latraytray)\
**Post date:** [May 14, 2019, 2:53am UTC](https://forum.choiceofgames.com/t/how-do-you-code-choices-within-choices/56784/8 "2019-05-14T02:53:12Z")

</div>

Lol yeah. I wrote it on mobile and forgot to double check I changed the spacing for everything

---

<div class="post-metadata">

**Author:** ![Jacic](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/jacic/32/7061_2.png) [@Jacic](https://forum.choiceofgames.com/u/Jacic)\
**Post date:** [May 14, 2019, 3:48am UTC](https://forum.choiceofgames.com/t/how-do-you-code-choices-within-choices/56784/9 "2019-05-14T03:48:22Z")

</div>

> [@hustlertwo](#):
>
> I have literally never nested choices. I just use gotos and send it to different labels for the next choice. But no one accused me of being a code wizard.

@hustlertwo is smart. Be like Hustlertwo 😁  
(Seriously though I nest choices all the time, and have also forgotten how many times I’ve had to go looking for an error or misdirect because I’ve ended up nesting a dozen different choices at different levels. Using a goto keeps things simpler.)

If you do want to nest, I personally recommend using tabs over spaces. They’re bigger and easier to see where you’ve made a mistake instead of looking for the place where you put 2 instead of 3 spaces. (But that’s up to you.)

---

<div class="post-metadata">

**Author:** ![GoldenSilver](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/goldensilver/32/110153_2.png) [@GoldenSilver](https://forum.choiceofgames.com/u/GoldenSilver)\
**Post date:** [May 14, 2019, 5:28am UTC](https://forum.choiceofgames.com/t/how-do-you-code-choices-within-choices/56784/10 "2019-05-14T05:28:37Z")

</div>

A way to avoid nesting is to use \*gosubs. If the nesting gets too big you can just use a \*gosub and put nested stuff there and simply come back to where you were.

I use this a lot recently and keep them all stored at the bottom of the file. This is very useful for dialogue which has a lot of nesting due to responses to specific options taken by the player and usually long blocks of text. Makes it more organized and less of an eyesore especially when the indentation gets messy.

---

<div class="post-metadata">

**Author:** ![confusedwriter](https://avatars.discourse-cdn.com/v4/letter/c/90ced4/32.png) [@confusedwriter](https://forum.choiceofgames.com/u/confusedwriter)\
**Post date:** [May 14, 2019, 1:01pm UTC](https://forum.choiceofgames.com/t/how-do-you-code-choices-within-choices/56784/11 "2019-05-14T13:01:16Z")

</div>

@Szaal Yes, I’m using the default
