Kwevin wrote:Update: Implemented my chunk. It works just like a shop!
7500 coppers is:
4 plats.
64 gold.
637 silvers.
0 coppers.
Aaaannnnd... 637 silver is something like 7600 copper.
Looks like you might have some recursive addition going on..
When you calculate the remainder from the next tier, it's adding that to the previous count.
So you end up with coins out of nowhere.
You should be an accountant; making money from nothing is their specialty!
If you're looking for a total, then you need to work backwards.
Calculate Plats first. Then use the remainder to calculate Gold. Then use that remainder to calculate Silver. Then the last remainder is your Copper.
What you have above is:
7500 coppers is 4 Plats. (Plus a bit, so the remainder re-adds to the Gold pile)
7500 coppers is 52 Gold. (You rounded down, so you ended up with an extra 12 from the remainder calculation.)
7500 coppers is 625 Silver. (Same as above.)
If that's what you want, excellent, just toss out the remainders.
Or, you can keep the remainders, just calculate every one of them separately and keep them in-line with the base calculation.
You would end up with something similar as below:
Code: Select all
gwc.output.append(copp + "Copper Coins is" + c2pPlats + "Platinum Coins," + c2pGold + "Gold Coins," + c2pSilv + "Silver Coins, and" + c2pCopp + "Copper Coins.");
gwc.output.append(copp + "Copper Coins is" + c2gGold + "Gold Coins," + c2gSilv + "Silver Coins, and" + c2gCopp + "Copper Coins.");
gwc.output.append(copp + "Copper Coins is" + c2sSilv + "Silver Coins, and" + c2sCopp + "Copper Coins.");
And you'd need to calculate all of them separately. Hence the "c2(p|g|s)" variables.
And the remainder should never be 12 or more. So, the most you could get is "x Plats, 11 Gold, 11 Silver, and 11 Copper"
You could also add a dozen "if" statements to see if each remainder is above zero and adjust the output accordingly.
You're on the right track, though!