It is possible to have $ sign in stats? (for example: money: $500)

I want to have money in stats. It is easy to have: money: 500 . I can use *set and visualize expenses or earnings in choices. But I want to add currency, to have not just money: 500 but money: 500$ / 500. I think it will just look better. It is possible or not? I know that is used in choice script coding and due that it could be just impossible. I didn’t find answer for this anywhere.

I just checked because I was curious and it seems to be as simple as this:

*create money "$0"

*set money "$500"

You have ${money}!

Which will be displayed as

You have $500!

Meaning it should also show in the stats that way if you use ${money} or whatever you want to use ^^

You can do this on the stat page and it will display with a $ infront of the money value.

*temp moneysign "$"
*temp full_money ""
*set full_money (moneysign&money)

Money: ${full_money}

Note “(moneysign&money)” money should be the name of the original value you created in startup. So if you named your money value gold, it would be (moneysign&gold)

It will display like this if the player has 100 dollars.

Money: $100

Hope this helps.

Thanks for answer but, it is not working. I add this in startup:

and this in choicescript_ stats:

Did I this like it should be, or wrong?

Thanks for answer. But I have mistake: Non-existent variable ‘money’
Should it be like that?
In startup:

And in choicescript stats:

Startup: First create the global money value.

*create money ""

Stats: The *temp values just help put the global value together with the $.

*temp moneysign "$"
*temp full_money ""
*set full_money (moneysign&money)

Money: ${full_money}

If it’s all in one line then it’s wrong yes
in statup:

*create money ""

in stats:

You have ${money}

or whatever you want to write there

When you want to change the value

*set money "$500"

or another amount you want to display

The problem with setting money “$500” changes it from a integer to a string. Basically that means you can not use math functions with it from now on. So you can’t do *set money +5, it will crash the game since its treating money from this point on like a word, not a number.


That is of course true :sweat_smile: didn’t think about that one tbh never used any money/gold values myself x)

Guys, you’re over-complicating things. Just do this:

*temp money 500

It will print this:


I tried do it,
In startup:

and in stats:

But I had mistake in stats : invalid line; this line should start with ‘percent’, ‘text’, or ‘opposed_pair’

So I add text :

But then I have mistake : Invalid expression, couldn’t extract another token: $${money}

Sorry for the windy reply.
Ok, two things.

In the startup.txt you should declare the global variables. It’s not that you can’t declare temporary ones, but once you leave a scene (this includes startup.txt), any temporary variable will be erased.

I only used *temp as an example.

So in startup.txt, you should declare the variable using *create, to create a global variable that will be used throughout the whole game.

*create money 500

Second thing, in the stats page, you’re trying to use the *stat_chart command, which works in a very specific way. In general, I always suggest to print text stats as simple text instead of using *stat_chart. Do it even if you have to use more than one *stat_chart, there’s no problem.


      percent charisma Charisma

Money: $${money}

      percent stealth Stealth

However, if you must use *stat_chart, then you have to understand how it works.

*stat_chart is a function that takes up to three arguments. Bear with me.

  • First argument is the “data type”: percentile, text or opposed pair.
  • Second is the name of the variable. Pure and simple.
  • Third is the display label. In case of opposed pairs, you can add a forth argument for the label of the opposed pair.

Let’s examine the example above:

      percent charisma Charisma
  • 1: percent is the “data type”. This means that ChoiceScript will display this value as a stat bar.
  • 2: charisma is the name of the variable.
  • 3: Charisma is the label, i.e. the name that CS will actually display on the stat bar. I could change this to something different, for example, “Charming” instead of “Charisma”, and not change the name of the variable.

When the name of the variable and the label are the same, you can omit the third argument. I kept it for the sake of the explanation.

In the case of text, it should look something like this:

      text money Money

The output will be:

Money: 500

Note that you cannot add the dollar sign like this. Even if you did something like this:

      text money Money $

The output would be:

Money $: 500

To sum it up:

  1. declare you global variables using the *create command. Global variables are used throughout the game. Local variables are declared using *temp and are erased as soon as the ChoiceScript Engine leaves a scene.
  2. For text stats, avoid using the *stat_chart command. If necessary, break the *stat_chart into smaller sections with text in between.
  3. However, if you decide to use *stat_chart to print text values, keep in mind that *stat_chart will always add a label to the value, and that you cannot format the way the value is displayed. So no dollar signs this way!

Hope that helps. :hugs:


Thank you so much! It works! Your answer is amazing. It explained everything greatly.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.