News:

Forum changes: Editing of posts has been turned off until further notice.

Main Menu

Electronic money-changer

Started by Mokkurkalfe, April 23, 2003, 04:53:20 PM

Previous topic - Next topic

Jake Norwood

Youknow, as a linguistic expiriment, that actually intrigues me. I might actually put somehting like that together this week...

Jake
"Civilized men are more discourteous than savages because they know they can be impolite without having their skulls split, as a general thing." -R.E. Howard The Tower of the Elephant
___________________
www.theriddleofsteel.NET

Jason

Wouldn't it be more straight forward to handle all the money as bits, and then just convert it when you display it? Then you'd only have to munge with gold, silver, etc when you actually show the money, the behind the scenes stuff would be simple arithmetic. In a bad form of psuedocode, it would be like this.



Function Convert to bits
  takes gold,silver, pennies, bits
  returns bits

return gold*960 + silver*48 + pennies*4 + bits

end function


function bits to others
    takes bits
    returns gold,silver,pennies,bits

load bits to temp value

gold=bits div 960 (div is integer answer only)

tempbits=tempbits-(gold*960)  //removes part that was turned to gold


silver=tempbits div 48

tempbits=tempbits-(silver*48) //removes silver

pennies=tempbits div 4

bits=tempbits-(pennies*4)

end function



This might be a simpler way to do it, and it would make the different coins types easier to implement. Just store the bits as halfweight coin and you wouldn't lose any data converting up.

Jason

Brian Leybourne

Quote from: JasonWouldn't it be more straight forward to handle all the money as bits, and then just convert it when you display it?

Yes, that would, except that when you're talking multiple different currencies and different coin weights etc, it's desirable to know how many of each coin the PC has rather than an abstract number based on bits. Hell, if nothing else it could be important for encumbrance rules, assuming anyone bothers with encumbrance in RPG's these days.

Brian.
Brian Leybourne
bleybourne@gmail.com

RPG Books: Of Beasts and Men, The Flower of Battle, The TROS Companion

Lance D. Allen

Indeed. A given PC might know that he's better off with 5 gold pieces than 3 gold, 39 silver, 11 copper and 4 bits weight-wise, but he may also find it difficult to spend that gold in a common inn, or even to find a money-changer outside of the big cities who even carries gold.

Then when you consider that that 5 gold's worth may be spread across the coins of different nationalities...

Hm. It seems like it would be best to display a player's coins as a string value, or else you'll have to have display spots for dozens of different coins, from Stahlnish Pfennigen to Ahrian Gold Disks. Perhaps for spending down money, you could have a selection box which you can choose the nation you're in, so when you spend, it detracts from the currency accepted by that nation.
~Lance Allen
Wolves Den Publishing
Eternally Incipient Publisher of Mage Blade, ReCoil and Rats in the Walls

Jason

Brian,
I was referring more to your psuedo code, which does convert money up as well. Keeping track of every type of money, while possible, causes many other situations that would need to keep track of. Questions like which coins to spend first, what if certain merchants won't take certain coins, etc. (teeth come to mind.)

Now, back to geek coding.

I would use a linked list to store the money. Each item would be a record that noted the name of the coin, its type(gold,silver,penny,bit) and its weight (light,normal,heavy). Then you could have as many types of coins as you wanted. Some concessions would be in order regarding the sum value of these coins, perhaps your could choose a country value equivalent. Ooh, and when you'd buy something, you could drag money types over until you had enough to cover it, and the merchant would have a currency type that he would make change in, or give him a  motley of coins and a preference of what to give to who.

Now we've gone behind a generator program and into a role playing game framework. Gosh computers are fun sometimes.

Jason

Lance D. Allen

I was thinking it'd be simpler just to determine how money is spent outside of the program, then just inputting it. For example, if I am in Stahl, and I buy something costing 13 silver, I might give the man a gold. So I'll minus 1 Stahlnish mark, and then add 7 funten. The program still does what it's supposed to do, but isn't required to be quite so complex.
~Lance Allen
Wolves Den Publishing
Eternally Incipient Publisher of Mage Blade, ReCoil and Rats in the Walls

Mokkurkalfe

Slowly but surely the program is taking shape. I've had o deal with a dose of real life, which slowed things down a bit, but hopefully, I'll be able to get some more coding done soon.

Currently, I've allowed for 40 different currencies, including those in the book plus generic light, generic imperial and generic heavy. That leaves 9 or 10 (depending on wether teeth will be included) empty currencies which you can make into your own.

The thing that Wolfen suggests is finished. That is, you can Transfer Cash, which means you "physically" transfer coins from one player purse to another, or to the "world". No changing is done.
The next thing I'm gonna do is the Transfer Value bit. That will be more like "transfer money equal to 10s and 6c(Cyrinthmeiran, Imperial weight) into my purse.". There, you can tell it to do some changing in order to make it as few coins as possible.
Other options here might include exchange rates for different currencies as well as being able to give different currencies different priorities. Perhaps you want to get rid of your foreign coins before you start using native ones. Or maybe you want to *hide* your foreign coins until you get out of the country?
Oh, BTW, can anyone come up with better names than Transfer Cash and Transfer Value?

Each purse can store some 17 (I think) different coin types. I could have made it more, or limitless, but it felt unnecessary.
Joakim (with a k!) Israelsson