# Non-Existent Variable Error is blocking my stats code!

**URL:** <https://forum.choiceofgames.com/t/non-existent-variable-error-is-blocking-my-stats-code/23814>\
**Category:** ChoiceScript Help\
**Created:** [February 7, 2017, 8:27pm UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-is-blocking-my-stats-code/23814 "2017-02-07T20:27:40Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![newyork1975ful](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@newyork1975ful](https://forum.choiceofgames.com/u/newyork1975ful)\
**Post date:** [February 7, 2017, 8:27pm UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-is-blocking-my-stats-code/23814/1 "2017-02-07T20:27:40Z")

</div>

Hello all, like my previous thread, I need help! Here’s my choicescript\_stats.txt code to see if there’s any issue with it.

```
*stat_chart
  opposed_pair strength
               Strength
               Dexterity
  opposed_pair hand-to-hand 
               Hand-to-Hand
    	       Swordsmanship
  percent archery
  percent magic
  percent patronage
  opposed_pair machiavellian
               Machiavellian
               Ogre 
  text Strength
  text Hand-to-Hand
  text Archery
  text Magic
  text Patronage
  text Machiavellian
  text Ogre

```

The program particularly highlighted the “hand-to-hand” variable as the problem.

_\*create strength 50_  
_\*create hand-to-hand 50_  
_\*create archery 50_  
_\*create magic 50_  
_\*create patronage 50_  
_\*create machiavellian 50_  
_\*create ogre 50_

Maybe the program is saying it can’t detect my variable from these startup commands? It could be the hyphens that their not detecting?

Idk…

Tell me if I coded this all wrong though!

---

<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:** [February 7, 2017, 8:30pm UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-is-blocking-my-stats-code/23814/2 "2017-02-07T20:30:56Z")

</div>

Variable names shouldn’t have hyphens in them. Try `handtohand` instead.

---

<div class="post-metadata">

**Author:** ![ChibaHateme](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/chibahateme/32/18011_2.png) [@ChibaHateme](https://forum.choiceofgames.com/u/ChibaHateme)\
**Post date:** [February 7, 2017, 8:33pm UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-is-blocking-my-stats-code/23814/3 "2017-02-07T20:33:07Z")

</div>

If there is no problem the way you set it up with strength dexterity than the only problem I could guess would be “-” this thing. Just try it with handtohand as a variable and keep the “Hand-to-Hand” naming.

```
*create handtohand 50

*opposed_pair handtohand
          Hand-to-Hand
          Schwordsmanship

```

---

<div class="post-metadata">

**Author:** ![newyork1975ful](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@newyork1975ful](https://forum.choiceofgames.com/u/newyork1975ful)\
**Post date:** [February 7, 2017, 8:40pm UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-is-blocking-my-stats-code/23814/4 "2017-02-07T20:40:54Z")

</div>

I think I may have just resolved said issue, not sure though because now the program is saying tabs and spaces is the issue with my stats.

```
This is a stats screen!

*stat_chart
  opposed_pair strength
               Strength
               Dexterity
  opposed_pair handtohand 
               Hand-to-Hand
    	       Swordsmanship
  percent archery
  percent magic
  percent patronage
  opposed_pair machiavellian
               Machiavellian
               Ogre 
  text Strength
  text Hand-to-Hand
  text Archery
  text Magic
  text Patronage
  text Machiavellian
_ text Ogre_

```

Particularly on line 8 of my code which is “Hand-to-Hand”.

---

<div class="post-metadata">

**Author:** ![Silhuetta](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/silhuetta/32/24847_2.png) [@Silhuetta](https://forum.choiceofgames.com/u/Silhuetta)\
**Post date:** [February 7, 2017, 8:45pm UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-is-blocking-my-stats-code/23814/5 "2017-02-07T20:45:17Z")

</div>

If it’s saying that you have problems with tabs and spaces, I would suggest going in and tabbing everything all over again or do the same with spaces. Normally that solves the problem, at least for me.

---

<div class="post-metadata">

**Author:** ![ChibaHateme](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/chibahateme/32/18011_2.png) [@ChibaHateme](https://forum.choiceofgames.com/u/ChibaHateme)\
**Post date:** [February 7, 2017, 8:48pm UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-is-blocking-my-stats-code/23814/6 "2017-02-07T20:48:10Z")

</div>

If you used tabs in your program and just copied my “fixed” version I created the problem. It is my fault so to speak since I used just regular spaces to place the Hand-to-Hand in the right position. Just do what @Silhuetta said. Just get everything back to the left and place tabs where they are needed.

---

<div class="post-metadata">

**Author:** ![newyork1975ful](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@newyork1975ful](https://forum.choiceofgames.com/u/newyork1975ful)\
**Post date:** [February 7, 2017, 8:57pm UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-is-blocking-my-stats-code/23814/7 "2017-02-07T20:57:29Z")

</div>

Now the program is saying there is an issue with line 17 which is “text Hand-to-Hand” , and it highlights ‘hand’ as a non-existent variable.

```
This is a stats screen!

*stat_chart
  opposed_pair strength
               Strength
               Dexterity
  opposed_pair handtohand 
               Hand-to-Hand
               Swordsmanship
  percent archery
  percent magic
  percent patronage
  opposed_pair machiavellian
               Machiavellian
               Ogre 
  text Strength
  text Hand-to-Hand
  text Archery
  text Magic
  text Patronage
  text Machiavellian
  text Ogre

```

---

<div class="post-metadata">

**Author:** ![ChibaHateme](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/chibahateme/32/18011_2.png) [@ChibaHateme](https://forum.choiceofgames.com/u/ChibaHateme)\
**Post date:** [February 7, 2017, 8:59pm UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-is-blocking-my-stats-code/23814/8 "2017-02-07T20:59:48Z")

</div>

change “`text Hand-to-Hand`” to “`text handtohand Hand-to-Hand`”. That should fix it. **Edit:** Please without the quotation marks. I have a feeling that how I presented the sentence it could be misunderstood.

---

<div class="post-metadata">

**Author:** ![newyork1975ful](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@newyork1975ful](https://forum.choiceofgames.com/u/newyork1975ful)\
**Post date:** [February 7, 2017, 9:05pm UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-is-blocking-my-stats-code/23814/9 "2017-02-07T21:05:39Z")

</div>

Wow! Thank you

The stats screen works! Now we’re getting somewhere! 🙂

Ok, lastly how would I upper case the percent variables? Because they’re lower cased as of now.

Should I do the same thing as I did with “`text Hand-to-Hand Hand-to-Hand`”?`

---

<div class="post-metadata">

**Author:** ![ChibaHateme](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/chibahateme/32/18011_2.png) [@ChibaHateme](https://forum.choiceofgames.com/u/ChibaHateme)\
**Post date:** [February 7, 2017, 9:09pm UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-is-blocking-my-stats-code/23814/10 "2017-02-07T21:09:04Z")

</div>

It should work if you just do it like this:

```
percent Archery
percent Magic
percent Patronage

```

At least it works in my game. However if it doesn’t work you can just use the same method like with the Hand-to-Hand variable, yes.

---

<div class="post-metadata">

**Author:** ![newyork1975ful](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@newyork1975ful](https://forum.choiceofgames.com/u/newyork1975ful)\
**Post date:** [February 7, 2017, 9:16pm UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-is-blocking-my-stats-code/23814/11 "2017-02-07T21:16:10Z")

</div>

Awesome!

Thanks so much for the support!
