Page 1 of 1

Calculating Multiple Currencies?

Posted: Mon Jul 09, 2018 4:30 pm
by Gryphbear
Alright. I am sort of stumped. I tested out this feature from this thread for calculating different 'currencies' - viewtopic.php?f=8&t=48109&p=477537&hili ... es#p477537

My question is - I do not want to show that I have a "possible" amount for all of the different coinages. Just 2-3 types of coins out of 5, but I want to make sure all of them are included, in case I decide to make the rarest coin available to my funds. My character in my VN is going to be doing shopping, eventually, and There's six different coin currencies. But the character will probably not get the 'rarer' currencies. So, I was wondering if there was an alternate way to maybe calculate a certain set?

For example: My character will probably deal with Copper Coins, Gold/Silver, and an occasional Steel. In this universe, steel is more rarer/valued than gold. I want to make sure the character is actually 'getting' their change if they pay with a higher valued coin, but this method just feels like I'm just re-arranging the coin values into the different values.

Code: Select all

$ cp_funds = 1000
    
    $ renpy.say(None, "I have {0} Platinum, {1} Steel, {2} Iron, {3} Silver, {4} Gold, and {5} Copper Pieces.".format(cp_funds / 500, cp_funds / 100, cp_funds / 10, cp_funds / 5, cp_funds / 0.4, cp_funds))
    $ cp_funds +=500
    $ renpy.say(None, "I have {0} Silver pieces.".format(cp_funds / 5))
    $ renpy.say(None, "I have {0} Steel, or {1} Copper pieces.".format(cp_funds / 100, cp_funds))
As the code shows above, you can probably selectively 'pick' which 'funds' you want to showcase, but... I was wondering if there were a simpler way? Like assign variables, or...? something?

If you have questions, just ask :) I'll try to clarify things if I can.

Re: Calculating Multiple Currencies?

Posted: Wed Jul 11, 2018 2:01 pm
by namastaii
Maybe I'm misunderstanding (because I'm a little confused - probably not your fault lol) but instead of having all coin types under one variable, would it be simpler to have a variable for each coin type and then another variable that represents them added up? Or am I totally off of what you're trying to do?

Basically cp_funds equals steel, iron, silver, gold, and copper coins added up and each have their own variable so you can keep track of each one and how much they're worth etc

Re: Calculating Multiple Currencies?

Posted: Wed Jul 11, 2018 3:08 pm
by Remix
I would actually advise against trying to separate wealth and coins...

For the programming math it really is easiest to just store lowest denomination... after all £13 52p is 1352p so why store the values apart. Evaluating whether a player can afford a sword is easier too if sword is just a set number of the lowest denomination.

If you really want to add Silver Coins I would suggest making them something like Krugerrands or Doubloons ... not directly usable as money just they can be sold for high prices to the right people. You could even make a side quest after the person finds one, to find a buyer...

Re: Calculating Multiple Currencies?

Posted: Wed Jul 11, 2018 7:30 pm
by Gryphbear
Thank you for the feedback. It does look like I'll have to at least keep track of their funds - converting CP (lowest value) to Silver, or Steel, etc. in code/in game. And as for Silver - this game is going to be set in the universe of Dragonlance, so I can't exactly call them Krugerrands/Doubloons, but thanks for the suggestion :)