# I'm getting an error, please help

**URL:** <https://forum.choiceofgames.com/t/im-getting-an-error-please-help/31842>\
**Category:** ChoiceScript Help\
**Created:** [October 30, 2017, 1:18pm UTC](https://forum.choiceofgames.com/t/im-getting-an-error-please-help/31842 "2017-10-30T13:18:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Red\_Eyes](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/red_eyes/32/147079_2.png) [@Red\_Eyes](https://forum.choiceofgames.com/u/Red_Eyes)\
**Post date:** [October 30, 2017, 1:18pm UTC](https://forum.choiceofgames.com/t/im-getting-an-error-please-help/31842/1 "2017-10-30T13:18:13Z")

</div>

I’m getting an error like is:…  
 ![8614cf05b2d0a7e06fd670e0c76f076eaecc7ae4_1_690x305](https://global.discourse-cdn.com/choiceofgames/original/3X/1/3/139eb85a974ef87ab98a1700f899de3db33db01e.png)

My code looks like this:

 ![edffefefef](https://global.discourse-cdn.com/choiceofgames/original/3X/a/c/acfaa756282678878f80ba694bd35b194cc0d244.PNG)

Any help would be lovely

---

<div class="post-metadata">

**Author:** ![Gower](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/gower/32/21972_2.png) [@Gower](https://forum.choiceofgames.com/u/Gower)\
**Post date:** [October 30, 2017, 1:20pm UTC](https://forum.choiceofgames.com/t/im-getting-an-error-please-help/31842/2 "2017-10-30T13:20:48Z")

</div>

Instead of \*elseif (gender = “boy”) try simply \*else.

You want \*if statements to go like this:

\*if/\*else  
or  
\*if/\*elseif/\*else

But it’s never just \*if/\*elseif.

---

<div class="post-metadata">

**Author:** ![Gower](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/gower/32/21972_2.png) [@Gower](https://forum.choiceofgames.com/u/Gower)\
**Post date:** [October 30, 2017, 1:25pm UTC](https://forum.choiceofgames.com/t/im-getting-an-error-please-help/31842/4 "2017-10-30T13:25:00Z")

</div>

Also a potential problem is there is another option for Clay besides “boy” and “girl”–quicktest may think there may be another option and bug out. Another reason it is better to use \*else.

---

<div class="post-metadata">

**Author:** ![ParrotWatcher](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/parrotwatcher/32/49963_2.png) [@ParrotWatcher](https://forum.choiceofgames.com/u/ParrotWatcher)\
**Post date:** [October 30, 2017, 1:53pm UTC](https://forum.choiceofgames.com/t/im-getting-an-error-please-help/31842/5 "2017-10-30T13:53:39Z")

</div>

This isn’t exactly an answer to your question, but here’s something else you can do to make your coding easier: instead of the whole `*if (gender = "girl")... *else...` phrase, you could use ${} or @{} notation:

With ${} notation, you define a variable in the `startup.txt` file, e.g.:

`*create himher ""`

And then set it along with the `gender` variable as “him” or “her”, before using it in your code like this:

`Get away from ${himher}!" he yelled, with a dangerous look in his eyes.`

You could then use it over and over again within the script.

@{} notation isn’t initialised at startup, but instead defined as needed in the script, as so:

`Get away from @{(gender = "girl") her | him}!" he yelled, with a dangerous look in his eyes.`

(Note the pipe symbol “|” between “her” and “him”.) This is probably less useful in this situation, as you’d need to write it out every time you use it.

---

<div class="post-metadata">

**Author:** ![Red\_Eyes](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/red_eyes/32/147079_2.png) [@Red\_Eyes](https://forum.choiceofgames.com/u/Red_Eyes)\
**Post date:** [October 30, 2017, 2:24pm UTC](https://forum.choiceofgames.com/t/im-getting-an-error-please-help/31842/6 "2017-10-30T14:24:42Z")

</div>

Thank you so much! I have it fixed now!

---

<div class="post-metadata">

**Author:** ![Minnow](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Minnow](https://forum.choiceofgames.com/u/Minnow)\
**Post date:** [October 30, 2017, 2:24pm UTC](https://forum.choiceofgames.com/t/im-getting-an-error-please-help/31842/7 "2017-10-30T14:24:56Z")

</div>

Since ChoiceScript has no way to know if `"girl"` and `"boy"` are the only possible values for the `gender` variable, it’s going to assume, rightly or wrongly, that it’s possible for the player to have a value for their `gender` variable that’s something else. Likewise, CS has no way to know if 80, 90, and 100 are the only possible values for the `Health` variable. You know why `Health` cannot be 92 or 77 or 13 or, well, anything else… but CS doesn’t know that.

As @Gower mentioned, you can fix this by using `*else` instead of both `*elseif (gender = "boy")` statements and the `*elseif (Health = 100)` statement.

However, I notice that every single one of these `*if` and `*elseif` statements send the game to the same scene. You may be able to replace all of your `*elseif` statements with `*if` statements, which will allow you to remove or consolidate the `*goto` commands. You also have some repeated text that could be condensed. Something like so:

```choicescript
Clay stands at the Mart doorway in shock.
The bag in his hands drops as he rushes over
*if Health = 80
    to your injured form. "Get away from
    *if gender = "girl"
        her!"
    *if gender = "boy"
        him!"
    He yelled, with a dangerous look in his eyes.
*if Health = 90
    to pry the guy away from you. "Get away from
    *if gender = "girl"
        her!"
    *if gender = "boy"
        him!"
    He yelled, with a dangerous look in his eyes, lifting him easily by the collar and throwing him to the side.
*if Health = 100
    to your side.
*goto_scene page20

```

How does that trick work? Fairly simple, actually. If two lines of narration or dialog have nothing between them, ChoiceScript will automatically display them to the player as a single line with a single space between them. Examples:

```choicescript
This is actually
all one line,
at least when
the player sees it.

This is a separate line, because of the empty lines above and below.

This will display as two lines that touch,
*line_break
because of the line break command.

```

That will display as:

> This is actually all one line, at least when the player sees it.
> 
> This is a separate line, because of the empty lines above and below.
> 
> This will display as two lines that touch,  
> because of the line break command.

As @ParrotWatcher says, you can also create variables just for displaying pronouns for characters. So at the beginning you may have:

```choicescript
*create gender ""
*create they ""
*create them ""
*create their ""
*create theirs""

```

Then a bit later, when the player defines their character’s gender, your code may look something like:

```choicescript
*fake_choice
    #I'm a woman.
        *set gender "girl"
        *set they "she"
        *set them "her"
        *set their "her"
        *set theirs "hers"
    #I'm a man.
        *set gender "boy"
        *set they "he"
        *set them "him"
        *set their "his"
        *set theirs "his"

```

With pronoun variables like that, you could simplify your code even more. Like so:

```choicescript
Clay stands at the Mart doorway in shock.
The bag in his hands drops as he rushes over
*if Health = 80
    to your injured form. "Get away from ${them}!"
    He yelled, with a dangerous look in his eyes.
*if Health = 90
    to pry the guy away from you. "Get away from ${them}!"
    He yelled, with a dangerous look in his eyes,
    lifting him easily by the collar and throwing him to the side.
*if Health = 100
    to your side.
*goto_scene page20

```
