# Nonexistent Variable Error

**URL:** <https://forum.choiceofgames.com/t/nonexistent-variable-error/10224>\
**Category:** ChoiceScript Help\
**Created:** [June 26, 2015, 9:44am UTC](https://forum.choiceofgames.com/t/nonexistent-variable-error/10224 "2015-06-26T09:44:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zenith8](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/zenith8/32/57853_2.png) [@zenith8](https://forum.choiceofgames.com/u/zenith8)\
**Post date:** [June 26, 2015, 9:44am UTC](https://forum.choiceofgames.com/t/nonexistent-variable-error/10224/1 "2015-06-26T09:44:34Z")

</div>

When I was creating the health bar, it created a Nonexistent variable error.

When I was in the startup menu, I wrote:

> \*create sanity 0  
> \*create insanity 0  
> \*create hypersomnia 0  
> \*create morality 0  
> \*create immorality 0  
> \*create relationship 0  
> \*create hunger 0  
> \*create health 100

When I was in the choicescript\_stat menu, I wrote:

> \*stat\_chart  
> text Name  
> text Gender  
> text Hair  
> text Nationality  
> text Personality  
> text Family  
> text Type  
> text Specialization  
> text Quirk  
> text Realm  
> text Weapon  
> opposed\_pair Sanity  
> Insanity  
> opposed\_pair Morality  
> Immorality

> percent Psyche

> percent Health  
> \*if (health \<=100) and (health \> 95)  
> Fine  
> \*if (health \<=95) and (health \> 70)  
> Good  
> \*if (health \<=70) and (health \> 50)  
> Okay  
> \*if (health \<=50) and (health \> 30)  
> Danger  
> \*if (health \<=30) and (health \> 10)  
> Grave Danger  
> \*if health \<=10  
> Critical

Yet it still says variable 21 “health” is non-existent when I open the choicescrip\_stat page only when I open the page in Google Chrome. How do I fix this error?

---

<div class="post-metadata">

**Author:** ![cvaneseltine](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cvaneseltine/32/4047_2.png) [@cvaneseltine](https://forum.choiceofgames.com/u/cvaneseltine)\
**Post date:** [June 26, 2015, 11:19am UTC](https://forum.choiceofgames.com/t/nonexistent-variable-error/10224/2 "2015-06-26T11:19:22Z")

</div>

Chrome doesn’t play nicely with ChoiceScript. From [http://choicescriptdev.wikia.com/wiki/Development\_Tools:](http://choicescriptdev.wikia.com/wiki/Development_Tools:)

> Note that Google Chrome is considered a poor choice for most ChoiceScript authors as this browser does not  
> support local scripting and does not give out error messages. Although a  
> technical workaround is known to exist to allow it to work offline,  
> most ChoiceScript authors using Chrome can only test their game by  
> uploading it online. This is inefficient in comparison, and is not  
> recommended.

If it works in Firefox, call it good and keep going.

---

<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:** [June 26, 2015, 11:55am UTC](https://forum.choiceofgames.com/t/nonexistent-variable-error/10224/3 "2015-06-26T11:55:28Z")

</div>

I’m not sure but you might need a space between the \</=/\> and the number. Also I found I had to use double brackets to get things to work often.  
ie: \*if (( ) and ( ))  
Also you only need one variable for opposed stats (ie immorality or morality, not both).

Not sure if this will fix the problem but worth a go.

---

<div class="post-metadata">

**Author:** ![Silverstone](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/silverstone/32/9901_2.png) [@Silverstone](https://forum.choiceofgames.com/u/Silverstone)\
**Post date:** [June 26, 2015, 12:02pm UTC](https://forum.choiceofgames.com/t/nonexistent-variable-error/10224/4 "2015-06-26T12:02:34Z")

</div>

It may be your brackets?  
For instance:

```
*if ((variable <= 100) and (variable > 90))
   Fine
```

Also it’s good habit to put brackets around the

```
*if (variable <= 10)
   Critical
```

Also did you create a health variable in startup.txt?

---

<div class="post-metadata">

**Author:** ![zenith8](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/zenith8/32/57853_2.png) [@zenith8](https://forum.choiceofgames.com/u/zenith8)\
**Post date:** [June 26, 2015, 12:05pm UTC](https://forum.choiceofgames.com/t/nonexistent-variable-error/10224/5 "2015-06-26T12:05:55Z")

</div>

I already created a health variable in startup.txt. And it seems to be working now. Thank you very much?

---

<div class="post-metadata">

**Author:** ![Silverstone](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/silverstone/32/9901_2.png) [@Silverstone](https://forum.choiceofgames.com/u/Silverstone)\
**Post date:** [June 26, 2015, 3:26pm UTC](https://forum.choiceofgames.com/t/nonexistent-variable-error/10224/6 "2015-06-26T15:26:11Z")

</div>

Not sure which thing you did to get it working but glad it’s working now for you.
