I want to create two numbers that are combined. Gold and silver (number of coins) are numbers where 1 gold = 10 silver. When combined, my currency is G.S.
For example, 3 gold plus 7 silver = 3.7 money. However, I am having difficulty with the calculation. The parser says it doesn’t understand the expression.
My (edited) source code is
An adventurer has a number called gold. Gold is initially 0.
An adventurer has a number called silver. Silver is initially 0.
Every turn when stage is stInven:
now money of player is initMoney of player;
say "init money = [money of player]";
. . .
To decide what real number is initMoney of (p - a person):
let G be a number;
now G is a 5 d 4 roll; [gold pieces]
say "init gold = [G] ";
let G be the gold of p;
let S be a number;
now S is a 5 d 4 roll; [silver pieces]
let S be S;
say "init silver = [S] ";
now S is the silver of p;
let initCash be a real number;
now initCash is initCash + G + S/ 10.0;
decide on initCash;
I know this isn’t your initial question, but I was wondering if you had studied the Nickel and Dimed example from the documentation, which seems to offer an integrated management system for monetary activities (structuring, ownership, transactions…) that is quite comprehensive and easily transferable to fantasy settings.
You’re welcome. I’m probably going to use this example as a basis to integrate the monetary system into my WIP by the end of October. If you’d like, we could share our feedback and experiences.
Collaboration is always a plus. I did look into Nickel and Dimed and it is more complicated than I need. However, one of the simpler examples is what I used in my story.