Non-Existent Variable Error is blocking my stats code!


#1

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!


#2

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


#3

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

#4

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”.


#5

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.


#6

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.


#7

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

#8

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.


#9

Wow! Thank you

The stats screen works! Now we’re getting somewhere! :slight_smile:

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”?`


#10

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.


#11

Awesome!

Thanks so much for the support!