New game - code advice regarding Wealth/Currency

@dinosw

That code is actually wrong, I must’ve copied and pasted the wrong one (I had several iterations going), this is the right code:


*temp gold 1
*temp silver 1523
*temp bronze 112

*set silver (silver + ((bronze - (bronze modulo 100)) / 100))
*set gold (gold + ((silver - (silver modulo 100)) / 100))
*set silver (silver modulo 100)
*set bronze (bronze modulo 100)

You have: ${gold} gold, ${silver} silver, ${bronze} bronze

You probably don’t really need to understand it, but those *set four lines will basically convert any excess bronze coins (over 99) into silvers, and excess silvers into gold.
The other lines are just variable definitions and a quick display, for example purposes.

In that example it’ll turn:

Gold: 1
Silver: 1523
Bronze: 112

into

Gold: 16
Silver: 24
Bronze: 12

Copy and paste all that into here, if you want to see it working.

You basically just slap those four lines in anytime you want to sort ‘top-heavy’ currencies.

1 Like