# Unsure how to use \*choice

**URL:** <https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044>\
**Category:** ChoiceScript Help\
**Created:** [February 5, 2018, 2:55pm UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044 "2018-02-05T14:55:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Speedy-Scout](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@Speedy-Scout](https://forum.choiceofgames.com/u/Speedy-Scout)\
**Post date:** [February 5, 2018, 2:55pm UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/1 "2018-02-05T14:55:45Z")

</div>

I’m having trouble with the \*choice feature. So, I used it and tried to make it work, but it just keeps giving me an error message.

The error I’m getting is: startup line 25: invalid indent, expected at least one ‘choice’

My code looks like this:

```
*choice
#Explore and discover this strange thing.. I'm not scared!
You peek outside by, to your confusion, nothing is wrong; instead, the world has turned white
with something that you don't yet understand; snow. Now that you've established that everything
is safe, you retreat to the den.
*finish
#That seems scary.. I'll just stay in the lair.
It's warm inside the lair. You stretch and curl up to sleep.
*finish

```

---

<div class="post-metadata">

**Author:** ![RETowers](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/retowers/32/21477_2.png) [@RETowers](https://forum.choiceofgames.com/u/RETowers)\
**Post date:** [February 5, 2018, 2:56pm UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/2 "2018-02-05T14:56:43Z")

</div>

Indents are important in ChoiceScript, your code should look like this:

```
*choice
    #Explore and discover this strange thing.. I'm not scared!
        You peek outside by, to your confusion, nothing is wrong; instead, the world has turned white with something that you don't yet understand; snow. Now that you've established that everything is safe, you retreat to the den.
        *finish
    #That seems scary.. I'll just stay in the lair.
        It's warm inside the lair. You stretch and curl up to sleep.
        *finish

```

---

<div class="post-metadata">

**Author:** ![Speedy-Scout](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@Speedy-Scout](https://forum.choiceofgames.com/u/Speedy-Scout)\
**Post date:** [February 5, 2018, 3:03pm UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/3 "2018-02-05T15:03:38Z")

</div>

Ok, I’ll try~ Thanks for the advice!  
It worked, thanks!!  
Ok, so, I’m really sorry but… now I’m struggling with something else. \>.\<

I have a code like this:

```
*choice
    #Male
        Ok.
        *set gender male
        *page_break
    #Female
        Ok.
        *set gender female
        *page_break

```

But it says that " It is illegal to fall out of a \*choice statement; you must \*goto or \*finish before the end of the indented block." when I try to use this script…  
Any help?

---

<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:** [February 5, 2018, 3:18pm UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/4 "2018-02-05T15:18:00Z")

</div>

After using \*choices and \*ifs you have to finish with a \*goto, so that the code knows where to go after it reaches that point.

The \*gotos go to \*label of a name you can define.

```choicescript
*choice
    #Male
        Ok.
        *set gender male
        *page_break
        *goto afterGender
    #Female
        Ok.
        *set gender female
        *page_break
        *goto afterGender

*label afterGender

Continue your game here...

```

Alternatively you can use \*fake\_choice, which doesn’t require a \*goto at the end, and it will simply continue down when it finishes the choice code.

Also use this program to make coding easier, as well as handling indenting.

> [@\[CSIDE\] The ChoiceScript IDE (v1.3.3 Now Available — 05/09/2022)](https://forum.choiceofgames.com/t/cside-the-choicescript-ide/27622):
>
> The new version of CSIDE (The ChoiceScript IDE) is now available! CSIDE (seaside) is an unofficial application designed to help writers of interactive novels who use ChoiceScript, from Choice of Games. Desktop Downloads: [Release ChoiceScript IDE - Public Release · ChoicescriptIDE/main · GitHub](https://github.com/ChoicescriptIDE/main/releases/tag/v1.0.1) Web Version (Requires a Dropbox Account) [ChoiceScript IDE](https://choicescriptide.github.io/web/) More information available at: [https://choicescriptide.github.io/](https://choicescriptide.github.io/)[https://twitter.com/ChoiceScriptIDE](https://twitter.com/ChoiceScriptIDE) And Discord for real-time discussio…

---

<div class="post-metadata">

**Author:** ![Speedy-Scout](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@Speedy-Scout](https://forum.choiceofgames.com/u/Speedy-Scout)\
**Post date:** [February 5, 2018, 3:57pm UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/5 "2018-02-05T15:57:33Z")

</div>

Thank you! You’re all so helpful.  
I was confused since my previous code didn’t want it, I don’t think…  
Thanks soooo much!!!

---

<div class="post-metadata">

**Author:** ![Speedy-Scout](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@Speedy-Scout](https://forum.choiceofgames.com/u/Speedy-Scout)\
**Post date:** [February 6, 2018, 1:54pm UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/6 "2018-02-06T13:54:49Z")

</div>

Oh. Hey. GUESS WHO’S HAVING PROBLEMS AGAIN \>.\<  
My script looks like this:

```
*choice
    #Claim the kingdom!
        You grin. "I'll go for the kingdom!"
        *goto KingdomClaim
    #Claim more small villages.
        You take to the air. "Starting small is a good idea."
        *goto Town2Claim

```

And the error message is:

```
"It is illegal to fall out of a *choice statement; you must *goto or *finish before the end of the indented block."

```

And there is a \*label for both of the \*goto’s…

---

<div class="post-metadata">

**Author:** ![Carlos.R](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/carlos.r/32/75837_2.png) [@Carlos.R](https://forum.choiceofgames.com/u/Carlos.R)\
**Post date:** [February 6, 2018, 7:49am UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/7 "2018-02-06T07:49:21Z")

</div>

Is the line number on your error message the same as the choice you posted?  
Maybe it’s getting caught up somewhere else?

---

<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:** [February 6, 2018, 9:11am UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/8 "2018-02-06T09:11:44Z")

</div>

Was about to say that. Always look at the line number it mentions first. (Someone it’ll be elsewhere but more likely that’s where the problem is and you can work the problem out more easily.)

---

<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:** [February 6, 2018, 10:03am UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/9 "2018-02-06T10:03:52Z")

</div>

You must missed this one `#choice`, hidden below the pile of hay.

Try to look for it.

* * *

And btw, if you encountered multiple problems, try to ask them in a single thread instead. You know, keep things tidy.

---

<div class="post-metadata">

**Author:** ![Speedy-Scout](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@Speedy-Scout](https://forum.choiceofgames.com/u/Speedy-Scout)\
**Post date:** [February 6, 2018, 1:55pm UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/10 "2018-02-06T13:55:40Z")

</div>

Ok, so someone already gave me a solution to this, it didn’t seem to work!!

Code:

```
*choice
    #Male
        Ok.
        *set gender male
        *page_break
        *goto afterGender
    #Female
        Ok.
        *set gender female
        *page_break
        *goto afterGender

*label afterGender

```

Error message:

```
"It is illegal to fall out of a *choice statement; you must *goto or *finish before the end of the indented block."

```

---

<div class="post-metadata">

**Author:** ![needs-to-be-loved](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/needs-to-be-loved/32/47215_2.png) [@needs-to-be-loved](https://forum.choiceofgames.com/u/needs-to-be-loved)\
**Post date:** [February 5, 2018, 6:55pm UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/11 "2018-02-05T18:55:23Z")

</div>

It should work like that, i cant see any problems. Also you don’t need to use \*page\_break after a choice as it does that automatically. Hope someone can help with that 🙂

---

<div class="post-metadata">

**Author:** ![Stormheart](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/stormheart/32/90985_2.png) [@Stormheart](https://forum.choiceofgames.com/u/Stormheart)\
**Post date:** [February 5, 2018, 7:03pm UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/12 "2018-02-05T19:03:12Z")

</div>

Actually wondering if removing the \*page\_break will fix your problem for you! Give us an update when you can! 🙂

---

<div class="post-metadata">

**Author:** ![needs-to-be-loved](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/needs-to-be-loved/32/47215_2.png) [@needs-to-be-loved](https://forum.choiceofgames.com/u/needs-to-be-loved)\
**Post date:** [February 5, 2018, 7:06pm UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/13 "2018-02-05T19:06:48Z")

</div>

Also, if your gender variable is a **string** variable, it wont recognise \*set gender male . male should be “male” .

```
*choice
    #Male
        *set gender "male"
        *goto scene
    #female
        *set gender "female"
        *goto scene
    
*label scene

```

This should work. But the one you posted shouldn’t have been giving that error but non-existent variable error. So im not sure whats the problem there…

Also dont forget to create your variable first 🙂

---

<div class="post-metadata">

**Author:** ![N1GHTMAR3](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/n1ghtmar3/32/142049_2.png) [@N1GHTMAR3](https://forum.choiceofgames.com/u/N1GHTMAR3)\
**Post date:** [February 5, 2018, 7:53pm UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/14 "2018-02-05T19:53:33Z")

</div>

It’s probably that.  
So maybe “male” an “female”. Assuming the startup variables are already made.  
Edit: Nevermind, read the error message and it has nothing to do with that. I can only blame page\_break.  
Edit 2x: I tried creating variants of what you did, nope, no error messages at all. You might want to show us your startup variables.

---

<div class="post-metadata">

**Author:** ![N1GHTMAR3](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/n1ghtmar3/32/142049_2.png) [@N1GHTMAR3](https://forum.choiceofgames.com/u/N1GHTMAR3)\
**Post date:** [February 5, 2018, 8:01pm UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/15 "2018-02-05T20:01:16Z")

</div>

Yeah, page\_break isn’t necessary, but inserting one before \*goto has no effect at all and thus shouldn’t have any errors either.

---

<div class="post-metadata">

**Author:** ![Speedy-Scout](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@Speedy-Scout](https://forum.choiceofgames.com/u/Speedy-Scout)\
**Post date:** [February 5, 2018, 9:27pm UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/16 "2018-02-05T21:27:30Z")

</div>

Ok, here’s my startup thingy:

```
*title [here]
*author [here]
*create strength "20"
*create stamina "20"
*create speed "20"
*create gender "0"
*create name "0"

*scene_list
  startup

```

---

<div class="post-metadata">

**Author:** ![MeltingPenguins](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/meltingpenguins/32/255855_2.png) [@MeltingPenguins](https://forum.choiceofgames.com/u/MeltingPenguins)\
**Post date:** [February 5, 2018, 9:30pm UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/17 "2018-02-05T21:30:59Z")

</div>

Did removing \*page\_break help?  
If not:

1. Put the scenelist before the creates (iirc this might not be the source of the prob but might cause trouble down the line)
2. Remove 0 from the create for gender. “” will do iirc.
3. Check the indents

---

<div class="post-metadata">

**Author:** ![Speedy-Scout](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@Speedy-Scout](https://forum.choiceofgames.com/u/Speedy-Scout)\
**Post date:** [February 5, 2018, 9:45pm UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/18 "2018-02-05T21:45:28Z")

</div>

Ok guys. I’m very new, so forgive me, but I’ve just discovered I was being an idiot.  
The script BEFORE the gender was the one being wrong, NOT the gender script. Oh golly. I don’t know how I did that. Sorry guys~  
❤

---

<div class="post-metadata">

**Author:** ![MeltingPenguins](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/meltingpenguins/32/255855_2.png) [@MeltingPenguins](https://forum.choiceofgames.com/u/MeltingPenguins)\
**Post date:** [February 5, 2018, 9:54pm UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/19 "2018-02-05T21:54:14Z")

</div>

Don’t worry.  
Did you manage to fix the problem?

Also, on a note before, cause i think no one corrected that:  
If you have flavor-text (like the ok) a page\_break is okay.  
In fact:  
If you have flavor-text, a page\_break might help with the flow of the story if the text is not part of the narrative as such.  
Otherwise it’ll appear above the next text body

---

<div class="post-metadata">

**Author:** ![Speedy-Scout](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@Speedy-Scout](https://forum.choiceofgames.com/u/Speedy-Scout)\
**Post date:** [February 6, 2018, 6:53am UTC](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044/20 "2018-02-06T06:53:23Z")

</div>

Yes, I did fix the problem!  
And thanks for the advice.

[Next page](https://forum.choiceofgames.com/t/unsure-how-to-use-choice/35044.md?page=2)
