# Making "Coins" or wealth similar to an inventory stat (RESOLVED)

So I’ve got my wealth set up as:

*label coins
*if charnum = 1
*set coins 0
*if charnum = 2
*set coins 25
*if charnum = 3
*set coins 0
*if charnum = 4
*set coins 300
*if charnum = 5
*set coins 300

Coins: \${Coins}

But when I try to add money to the coins in the stat screen throughout the game it doesn’t work. It keeps it at the set coins with each charnum.

So if let’s say one of the characters (in charnum 2) steals a bag of coins and I want to add +10 in wealth, then in the game I code: *set coins +10
but nothing happens…the coins in the stats screen still says Coins: 25 rather than 35.

The charnums are based off of various characters/groups of characters the reader can play depending on the choices they make

You’ve probably got a conflict. On one hand you’re linking the coins to the charnum so you’re saying charnum = 2 = 25.
You’re then trying to manually alter the coin value while charnum still = 2.
(I suspect that’s the case anyway, can you do if charnum =2, set coins +25 and see if it will then let you alter it manually?)

I figured that was the case, I was hoping there was a way around it. I’ll try the +25. Thanks!

1 Like

It works in a way…but every time I restart the game on the index file it has a weird glitch…first it’ll be 25, and then all of a sudden it’ll be 50. and then when I go to the choice where I’m trying to add +10 it makes it 85 and then 120…

Maybe if I try +0 in the stats screen and then just add +25 at the beginning of the screen and then +10 at the choice…I’m going to play around with it for a bit

Every time I restart it adds on to the coin value of what I had before I restarted unless I close the browser completely

Don’t `*set` the coin numbers in the Stat Screen. If you do that, your wealth will grow proportionate to the number of times you check stats. All you (probably?) want in the Stats Screen is

`Coins: \${Coins}`

to display coin totals. Do the actual setting of the coin numbers in your game txt files.

3 Likes

I thought any changes made in the stats screen do not, in fact, carry over when one returns to the game? Is that not true?

Also, does {Coins} versus {coins} make any difference at all?

2 Likes

That’s been changed. See here (point 2).

3 Likes

Okay I fixed it. I needed to simplify it. I swear I did this before and it didn’t work…but I must not have.

In the startup I did *create Coins 0

and then in the stats screen I did
*label Coins
Coins: \${Coins}

and then in the game I just did *set Coins +25 at the beginning of the scene and *Set Coins +10 at the next choice.

Worked perfectly. I swear I tried that before…whatever though I’m just happy it’s working now, thanks guys!

1 Like