Can't write headlines over stats?


#1

I’m having some issues with the stats. I can’t have a headlines above them, basically. I had to go over to the startup file and add the phrase with a value (I guess? I think I’m using the right terminology) after it for me to be able to get to the stat page. Without it, the message “Non-existent variable” comes up.

So I went ahead to startup and added: *create Character_traits 0, but then it says 0 in the title when I try to run the game. I guess that’s logical but how come the text command won’t do?

What am I missing? My statfile looks like this:
*stat_chart
text Character_Traits
opposed_pair Open
Withdrawn
opposed_pair Hasty
Deliberate
opposed_pair Optimistic
Pessimistic
opposed_pair Biting
Absolute

I tried finding topics about this but I couldn’t. If there has been a post about this then I’m sorry! :sweat:
/Toco


#2

In your case, the [Character_Traits] is the container. The jar. The variable. :card_file_box:

And what you’re looking for is the cookie. The content. :cookie:


What you’d want to do is

*create Character_Traits "Somerandomotexto"

*stat_chart
   text Character_Traits Your Traits

This should give you

Your Traits: Somerandomotexto

#3

@Szaal Sorry, I don’t get it. Am I placing the text wrong? What should I add after “*create Character_Traits”?

By brain is too tired to understand coding rn, but I’ll be back as soon as I’ve had some sleep. Thanks for the reply! :slightly_smiling_face:


#4

Umm… I’ll try using a real-life analogue.
If you want to make a bread, you’ll need flours. Not just any flour, but a flour that suits your needs.

In programming language, you’ll need variables. Not just any variables, but a variable that suits your needs.


In ChoiceScript, there’re 3 kinds of variable: text, number, and on/off (boolean or true/false)

*create [varname] "lul" gives you a text variable
*create [varname] 1945 gives you a number variable
*create [varname] true gives you a boolean variable

For a quick explanation, you can only use

*stat_chart
   text varname

on a text variable.


If you want to get familiarized with the basics,

Click me ah

So, we got 3 kinds of variables. Hurray!
In :point_up_2:t4: above example, the variable is called [varname]. The contents are “lul” for text variable, 1945 for number, and true for boolean.

Now, in CScript, you’re not allowed to *create a blank variable. You need to specify their type.
That’s why you need to add text after the *create Character_Traits (Of course, you can put any text inside it. Doesn’t have to be “lul”)

The others are just the same, except number or true/false instead of texts.


#5

In the stat_chart variables you want to be as text have to be strings.

For example

*create rank “General”

Where as if you want it to be a bar the variable has to be a number.

for example

*create kills 50

Then in the stat_chart you have it look like this;

*stat_chart
    text Rank
    percent Kills

This will appear when someone looks at the stat screen like this;

Rank: General
Kills 50

edit: for your current stats you would set it like this;

[In startup.txt]
*create character_traits "Enter trait here"
*create open 50
*create hasty 50
*create optimistic 50
*create biting 50

[in choicescript_stats]
*stat_chart
    text character_traits Character Traits
    opposed_pair Open
        Withdrawn
    opposed_pair Hasty
        Deliberate
    opposed_pair Optimistic
        Pessimistic
    opposed_pair Biting
        Absolute

#6

@Szaal
@Nocturnal_Stillness

Y’know, I just realised I got it wrong from the beginning. I just wanted to write a headline over the stats, and that was possible without any code. Gosh, now I feel stupid. But atleast I know more about variables. Thank you so much for taking the time to answer! :hugs:

So I just had to erase what create commands I had in the startup file (related to this), and add “Character Traits” in the stat file:

Character Traits

*stat_chart
opposed_pair Open
Withdrawn
opposed_pair Hasty
Deliberate
opposed_pair Optimistic
Pessimistic
opposed_pair Biting
Absolute

And now it’s functioning perfectly! :upside_down_face: