Stats screen coding help

So, a bit of background. I’m really very new to choicescript, I only just started using it a few days ago. I was working on the stats screen and wanted to see how everything was coming along, so I started up my game in Firefox. The main game screen is working just fine, but errors kept popping up when I attempted to open the stats screen. Now it’ll open but it won’t show my stats, it just shows the original, filler stats. If someone could give me some insight on what I’m doing wrong, that would be much appreciated.

Here’s my code right now:

Stats

stat_chart

Character
Text Name
Text Gender

Virtues
opposed_pair Valor
Self preservation
Percent Strength
opposed_pair Leadership
Cowardice
opposed_pair Superstitious
Realistic
opposed_pair Charisma
Bluntness
Percent Honesty

Relationships
Percent Ansy
Percent Forrest
Percent Isabella
Percent Christopher

Dragon
(WIP)
Oh, please don’t comment on the stat names. They’re really just fillers right now. They’ll all be getting more poetic names later on.

Ok, I got this to work on mine.
In order to create bold lettering in ChoiceScript, you do a [ b ] TEXT [ /b ]
But you don't have any spaces, so you'll write it as [b]TEXT[/b]

In your **startup.txt** you will want to add this:

*create name "name"
*create gender "gender"
*create Valor 50
*create Self_Preservation 50
*create Strength 0
*create Leadership 50
*create Cowardice 50
*create Superstitious 50
*create Realistic 50
*create Charisma 50
*create Bluntness 50
*create Honesty 0
*create Ansy 0
*create Forrest 0
*create Isabella 0
*create Christopher 0

In your **choicescript_stats.txt** you will want to add this:

[b]Stats[/b]

[b]Character[/b]
*line_break
${name}
*line_break
${gender}

[b]Virtues[/b]
*line_break
*stat_chart
 opposed_pair Valor
  Self_Preservation
 percent Strength
 opposed_pair Leadership
  Cowardice
 opposed_pair Superstitious
  Realistic
 opposed_pair Charisma
  Bluntness
 percent Honesty

*line_break
[b]Relationships[/b]
*line_break
*stat_chart
 percent Ansy
 percent Forrest
 percent Isabella
 percent Christopher
2 Likes

This is incorrect. An opposed pair is not two different stats. An opposed pair is one stat that displays under two names. *create valor 50 is enough, *create self_preservation 50 isn’t needed. Also note; if Valor and Self_Preservation are opposed, if one is 0 the other must be 100. They cannot both be 0 (unless they’re not opposed.)

That aside, what you suggest for the choicescript_stats file will work. It could also look like this:

[b]Character[/b]
*stat_chart
  text Name
  text Gender
*line_break

[b]Virtues[/b]
*stat_chart
  opposed_pair Valor
    Self Preservation
  opposed_pair Leadership
    Cowardice
  opposed_pair Superstitious
    Realistic
  opposed_pair Charisma
    Bluntness
  percent Strength
  percent Honesty
*line_break

[b]Relationships[/b]
*stat_chart
  percent Ansy
  percent Forrest
  percent Isabella
  percent Christopher
2 Likes

Thanks for catching that @Minnow. Corrected the code in my post.

That’s much better!

Unfortunately, the new version is still creating extra variables that won’t be used. If you still have the sample startup.txt you built for testing, try replacing that column of *create commands with the following one, then re-test it. Don’t make any changes to your choicescript_stats.txt file, though!

Just edit the startup.txt a little, then see what happens without the extra variables.

*create name "name"
*create gender "gender"
*create valor 50
*create leadership 50
*create superstitious 50
*create charisma 50
*create strength 50
*create honesty 50
*create ansy 50
*create forrest 50
*create isabella 50
*create christopher 50

If you’ve already deleted the startup.txt and choicescript_stats.txt you used for testing, it’s fine. You don’t need to write them all over again for this! Just know that an opposed_pair actually uses one variable, and “creates” the second purely for the sake of the player viewing the stats page. The “second variable” doesn’t actually exist as far as the rest of the game is concerned.

So, for the sake of education…

Let’s say we had an opposed pair of Left and Right…
and I only created the variable Left…
then if I wanted to increase or decrease Right…
would I actually be doing math with Left?

That’s exactly correct. You’ll only ever need to worry about the math for one, never both!

If you’re starting with *create left 50, then an opposed pair stat chart will display 50% left and 50% right. Using a *set command to adjust left — for example, *set left +10 — will adjust both sides of the start chart, causing it to read 60% left and 40% right.

Thanks for the insight, @Minnow!

@ScatteredA, does this help?

Yes, very much! However, I edited everything and it’s still coming up as this:

Oh, and if it helps, here’s my startup file:

Are you sure you saved the text files and reloaded the browser once you made changes?
I know it sounds obvious, but you’d be surprised how many times that fixed issues I was having with the stat screen… :wink:

1 Like

Possibly. I for sure reloaded the browser, but could you by chance tell me how to save? I think I did, but I’m really kind of terrible with computers. Also, if it helps, I’m on a Mac.

Ah, I haven’t really used mac, but… Which word-processor are you writing in? Like, Notepad++, the choice script writer…? You can probably use the control+S command once you click in your word processor to make it the active window…

Atom usually, but right now the choice script writer.

Is the startup.txt file you edited in the correct folder?

If that doesn’t work, try going under file and then save that way…

It’s in the wrong file. I’ll move it and try again.

And it’s fixed! Thank y’all so much for your help!

1 Like

Looks pretty good…See how that stat_chart is still visible? If you put character on a line below, the stat_chart command will be invisible to the player…:wink:

1 Like

Also, in startup.txt, I noticed there were spaces between chapter and number, like this chapter 1.

When you try to *goto_scene chapter 1, there will be an error…

It should look like chapter_1 or chapter1.

Either of these will work when you *goto_scene chapter_1 or *goto_scene chapter1…

Choicescript doesn’t like extra spaces in file names and commands… :wink:

1 Like

Some more help would be appreciated.

I tried to play through my game to see how everything was going and there was an error.

This is line 15, 14 and 13.