Post by Virgil Sovereign on Mar 14, 2016 17:31:56 GMT -8
Sure. You'd have to give me the spec, though.
I'm almost thinking I could drop the select-one and put in a field that accepted a string like 1G 17S 29K which would act both as the formatting string for the currency and as the conversion spec (29 K to the S; 17 S to the G). Hence if somebody wants to transact in Crowns, Silvers, Coppers, and Bits, with 10 Silvers to a Crown, 100 Coppers to a Silver, and 10 Bits to a Copper, they'd enter a spec like Ye Loot: 1 Cr, 10 Si, 100 C, 10 B. Any transactions would be assumed to be in the lowest units unless users specified a unit when transacting (e.g. "1 Cr").
But let's see if Peter is amenable to my bulking up his plugin first.
Or are you going to make it where it does the base currency and you can sub-divide it into bigger units from there with some fancy text?
one_bit = 1
one_copper = 10*one_bit // A
one_silver = 100*one_copper // B
one_crown = 10*one_silver // C
one_woozle = 17*one_crown // D
function to_bling_string( number_of_bits )
woozles = floor( number_of_bits / one_woozle )
number_of_bits -= woozles*one_woozle
crowns = floor( number_of_bits / one_crown )
number_of_bits -= crowns*one_crown
...
bits = number_of_bits
return "Yo cash: $[woozles]W $[crowns]Cr ... $[bits]B"
end
The constants in A, B, C, D are read off the formatting string from right to left, as many as desired. Each one could be an arbitrary integer >= 2 expressed in base 10.
Peter and I have been discussing via PM and it looks like there are going to be some issues with his upgrading the plugin to v6 that makes this patch a no-go. Hence it looks like you ladies and gentlemen will have to wait a while longer yet.
But... all good things come to they who wait.