How would you approach In game multiple currencies conversion

Hi

I am developping a plugin and I am kinda pretty rusty

So what I want to develop is a multiple currency system where the user can add more than just gold

so far we could though well just do an array and it's fine.

The bigger problem is the currency conversion

So let's separate the idea.

if 1 gold = 100 silver and 1000 copper
but that 1 silver = 100 copper.


It could be ideal to just let the user to enter manually each value but the problem is Now : the interface of the plugin manager doesn't let the user take two param and interact with each other

so how would you approach this math problem? or a way to make that you can cross convert currencies while letting the user add the amount of currencies they want?

wouldn't it be 'exponential?'

thank you for your further answer
there is one of this for vx / vx ace version, but you have also YEP_MoreCurrency, which allow this kind of this.

the bad thing (in my opinion) is that it need the shop core to work, but there isn't a seperate one.
if you know the MoreCurrency plugin of yanfly, you can make it so, you can input any kind of currency (multiple)
so you can do gold, silver, copper, ruby, diamonds etc etc.

but Idk how to handly this kind. I know you can event the big bunch, but plugin would be much nicer though.
Hum to be honest the thing was for a plugin not for event.

but if yanfly already did it I will focus another script then
Don't configure the relationship between every currency, for every currency you add, it would add (N-1) additional "relationships" where N is the total number of currencies.

Instead, each new currency would configure 1 value that's reference to a central currency. The central currency would never be given to a player, but you can use maths to calculate the exchange rate between any two currencies using the central currency.

there is one of this for vx / vx ace version, but you have also YEP_MoreCurrency, which allow this kind of this.

the bad thing (in my opinion) is that it need the shop core to work, but there isn't a seperate one.
if you know the MoreCurrency plugin of yanfly, you can make it so, you can input any kind of currency (multiple)
so you can do gold, silver, copper, ruby, diamonds etc etc.

but Idk how to handly this kind. I know you can event the big bunch, but plugin would be much nicer though.

That plugin doesn't have exchange rates like @nio kasgami was thinking about where 1 gold is 100 silver. The More Currencies plugin you have to manually set the price for every item for every currency -- this is an interesting idea and it's not the same plugin, you should try to make it!
@Aloe Guvner I actually figured out how to do the currency exchange rate by using Exponantial and off course using ratio if people want to set manually.

THe way to calculate every ratio even example silver to gold is by transferring the silver to Cooper then transfers to the desired unit.

so pretty much like this :
Spoiler: Code
Code:
    /**
     * Convert the currency to the lowest
     * @param {currencyStruct} currency
     */
    convertToLowestCurrency(currency) {
        if (currency.id != 1) continue;
        const ratio = Math.pow(10, currency.id);
        let conversion = Math.floor(currency.ammount * ratio);
        return conversion;
       
    }

    convertToHighestCurrency(currency) {
        const ratio = Math.pow(10, this._currencies.length + 1); // make sure that people understand the ID should be the same as the array but + 1?
        let conversion = this.convertToLowestCurrency(currency);
        const prices = Math.floor(conversion + ratio);
        return prices
    }

don't mind the messiness I was testing I will refactor the coding later

my problem is that risk of losing money sinces I convert to integer and not to float and it risk to lose money by transfering

Original thread: https://forums.rpgmakerweb.com/threads/how-would-you-approach-in-game-multiple-currencies-conversion.114788/