How to use Show Stats

I’m having trouble with the ‘Show Stats’ portion

The error I’m getting is: line 4 of choicescript_stats: Non-existent variable ‘name’

My code looks like this:
This is a stats screen!

*stat_chart
text name
percent intelligence
percent wisdom

I followed the one on the mygame folder from ChoiceScript. I was wondering if the mistake was the location of this code. Like, which page do I even input this code, in the choicescript_stats or startup?

Send help. I need help. Please. Thanks. Bless your kind soul. :smiley:

1 Like

Hi, you need to have all stats and variables listed in your startup.txt file. You list stats in your startup.txt file by using the *create command. So you would need to put

*create name ""

in your startup file for the name stat to work. The same goes for all your other stats. You can see more examples here on the ChoiceScript wiki. Do your best to try these tutorials out as well as utilizing the Ultimate Noob Coding thread!

4 Likes

Help sent. May this be helpful to you.

7 Likes

thank you for this very much. bless you.

1 Like

Hi. I’m having the same problem.
This is what I put in my startup file:
*create firstname “unknown”
This is what i put in my choicescript_stats file:
Name: $!{firstname}

And this is the error message I keep getting:
"line 5 of choicescript_stats: Non-exixtent variable ‘firstname’

I have no idea what to do. Shouldn’t it just show the Name as blank? It won’t even go to the stats page, at all. Thank you, David.

That’s weird! First thing I’d ask is: how are you coding? Did you save your startup file before running the game? Is your startup file named startup.txt and in the right place—e.g. in your game folder?

Yes, I saved the game before running. And, yes, the file is startup.txt - Maybe should i restart?

This kinda stuff happens to me all the time. Ugh

Are you using CSIDE or another way to run your game?

Yes. Does the error occured in dashingdon or in your computer locally?

Yes, I am using CSIDE

I’m sorry. I don’t know what dashingdon is.

Dashingdon is a website created by the user @dashingdon and it’s purpose is to give authors a free and easily accessible way to post demos of their WiP.

https://dashingdon.com

https://dashingdon.com - ← RE: Thank you.

And, if this helps anyone, here are screen shots of what’s happening with me. Does anyone know why this is happening? Thanks, David. .

Hi @DavidMonster I think the problem is that you have *finish before your scene list or the creation of your variables in your startup file. That command makes the scene end before the game can read and establish the variables you create underneath it. Try moving *finish to the very end of your startup file and hopefully that solves the problem. :slight_smile:

3 Likes

Thanks. I’ll try it out, and let you know what happens. THANKS.
— I did this, and went all the way back to just the 1st step. Took everything out, and started over and that worked. THANKS!