The Forge Forums Read-only Archives
The live Forge Forums
|
Articles
|
Reviews
Welcome,
Guest
. Please
login
or
register
.
March 05, 2014, 07:05:00 PM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Forum changes:
Editing of posts has been turned off until further notice.
Search:
Advanced search
275647
Posts in
27717
Topics by
4283
Members Latest Member:
-
otto
Most online today:
55
- most online ever:
429
(November 03, 2007, 04:35:43 AM)
The Forge Archives
Inactive Forums
The Riddle of Steel
Electronic money-changer
Pages: [
1
]
2
« previous
next »
Author
Topic: Electronic money-changer (Read 1360 times)
Mokkurkalfe
Member
Posts: 340
Electronic money-changer
«
on:
April 23, 2003, 12:53:20 PM »
Personally, I like to fiddle with coins n' stuff in RPG's. Otherwise, you can't give the players the feeling that they're adventuring to get the next meal on the table. Which is what they're doing, at least in the beginning of my campaigns.
Anyway, the problem is that it's pretty boring to do the math involved every single time you buy a pint of beer. So, inspired by Brian and in a moment of creativity, I've coded a little money-changer. So far it's capable of improving the value:pound-ratio of your purse (i.e. transforming silver into gold as far as possible etc.) and transforming your coins into light, imperial or heavy weight.
When ready, it should also be able to do the eventual changes needed when adding or subtracting money. Perhaps will it also be able to do a little percent math.
Now, is there anyone else how might be interested in a program like this?
Logged
Joakim (with a k!) Israelsson
Brian Leybourne
Member
Posts: 1793
Electronic money-changer
«
Reply #1 on:
April 23, 2003, 01:01:54 PM »
If you want, I can send you some code or pseudo-code for the 1:12:20:4 (or, more properly, 1:12:240:960) conversions and calculations for Gold/Silver/Copper/Bits when adding or subtracting money. I had to do all that for the Character Generator for when you buy and sell stuff anyway.
(edit: I inspire you? Cool! :-))
Brian.
Logged
Brian Leybourne
bleybourne@gmail.com
RPG Books: Of Beasts and Men, The Flower of Battle, The TROS Companion
Mokkurkalfe
Member
Posts: 340
Electronic money-changer
«
Reply #2 on:
April 23, 2003, 01:20:52 PM »
The pseudo-code would be great.
Logged
Joakim (with a k!) Israelsson
Brian Leybourne
Member
Posts: 1793
Electronic money-changer
«
Reply #3 on:
April 23, 2003, 03:25:30 PM »
Here ya go. It's a bit messy, but you should be able to follow it easily enough.
Apologies to those who can't read Pseudocode or don't care to.
Code:
Function TakeMoney (receives string COST, returns boolean)
// This function deducts money from the characters total. The passed
// variable cost is assumed to be in the following format:
//
// Either a single value in brackets with g,s,c or b as the descriptor
// such as (3g) or (10s)
// Or two values, comma seperated such as (3g, 10s)
//
// Why in brackets? That's how it is the the book thus it gets passed
// that way.
//
// Gold, Silver, Copper, Bits are global variables which contain the
// current amount of money the character has. g,s,c,b are local
// variables which contain the amount of money to deduct. In the
// previous example, this would be g=3, s=10, c=0, b=0 for example.
Local Variables
g,s,c,b (integers)
cost2 (string)
begin
// divide up the COST string to remove the brackets. For a
// single value it ends up sans brqackets in cost (eg: 3g). For
// a double, the second element ends up in cost2. (eg: cost=3g
// and cost2=10s)
// Next, convert those to values so that the local variables
// end up with the right values in them. For example, g
// ends up with a value of 3 and the local variable s ends up
// with a value of 10. That's pretty easy. c and b should be
// assigned values of zero in that case of course.
call sortmoney // see function below, this smooths out the cash in
// case any strange values are in there (so 20 copper
// would be converted to 1 silver and 8 copper, for
// example.
Calculate the total amount to deduct in bits
Calculate the total amount of money possessed in bits
// the two above steps are just done by adding 960*g plus
// 48*s plus 4*c plus b
if money owned < money to deduct then
return false // not enough money, do nothing
else begin
// Bits component - basically it first checks if there is a cost
// in bits, if not it doesn't do anything. If there is, it checks
// if the character has enough bits to cover it. If the character
// does, it just subtracts b from Bits. If he doesn't, it calls the
// addbit function, which attempts to convert 1 copper into 4
// bits, if it can't, it simply just returns false and the purchase
// fails. Note that addbit can call addcopper if the character
// has no coppers but still has silvers to convert to coppers
// to then convert to bits, and so on.
//
// note - the ability to return false is just there for completeness
// there's no way it can because we already established that
// there was enough money to cover the entire cost
if b > 0 then
if b > Bits then
if not addbit then
return false
else
Bits := Bits - b
else Bits := Bits - b
end if
//now do the same with coppers
if c > 0 then
if c > Coppers then
if not addcopper then
return false
else
Coppers := Coppers - c
else Coppers := Coppers - c
// Ditto silver
if s > 0 then
if s > Silver then
if not addsilver then
return false
else
Silver := Silver - s
else Silver := Silver - s
// And gold
if g > 0 then
if g > Gold then
return false
else
Gold := Gold - g
else Gold := Gold - g
call sortmoney
return true // was able to deduct the money
end function // end of takemoney
Function Addbit (returns boolean)
// this function attempts to add 4 bits by subtracting 1 copper
// if there is no copper, add some from silver if possible
if Copper = 0 then
if not addcopper then
return false
// now subtract one from copper and add 4 to bits
Coppers := Coppers - 1;
Bits := Bits + 4;
return true
end function // end of addbits
Function Addcopper (returns boolean)
// this function attempts to add 12 copper by subtracting 1 silver
// if there is no silver, add some from gold if possible
if silver = 0 then
if not addsilver then
return false
// now subtract one from silver and add 12 to copper
Silver := Silver - 1;
Copper := Copper + 12;
return true
end function // end of addcopper
Function Addsilver (returns boolean)
// this function attempts to add 20 Silver by subtracting 1 Gold
if gold = 0 then
return false // no gold to convert
// subtract one from gold and add 20 to silver
Gold := Gold - 1;
Silver := Silver + 20;
return true
end function // end of addsilver
Procedure sortmoney
// Just shuffles money so that if there are more than 3 bits, it subtracts
// them in groups of 4 and adds 1 copper each time, and so on up the
// line
until Bits < 4 start loop
Bits := Bits - 4;
Copper := Copper + 1;
loop
until Copper < 12 start loop
Copper := Copper - 12;
Silver := Silver + 1;
loop
until Silver < 20 start loop
Silver := Silver - 20;
Gold := Gold + 1;
loop
end procedure // end procedure sortmoney
Procedure GiveMoney // add money to total
// this procedure doesn;t need to be pseudocoded. Just add whatever
// amount to each value, and then run sortmoney to balance it all out.
end proceudre // end of GiveMoney
I hope that's all readable.
Brian.
Logged
Brian Leybourne
bleybourne@gmail.com
RPG Books: Of Beasts and Men, The Flower of Battle, The TROS Companion
Lance D. Allen
Member
Posts: 1962
Electronic money-changer
«
Reply #4 on:
April 23, 2003, 03:31:41 PM »
Hell yeah I'd be interested. Money changing is a bugger.
Besides, it's another toy on the toolbelt... And you can never have too many toys.
"Yup yup, time to get the old arms hacked off." ~Toymeister
Edit: Oh, yeah.. You may want to keep in mind that, once you go into play, you may not always manage to get the most efficient coins in your purse, and you may not even have all your money in the same national currency. If you can come up with a program which takes into account all of that, I will publicly canonize you right next to (well, maybe just under) Brian as a Saint of TRoS support toys. Ooh, and if it can keep track of multiple purses, that'd kick ace too. It's not likely that everyone's going to bring a laptop to the game, so if one person can use the program to track every player's cash, that'd rock out.
::wanders off chanting "Toystoystoystoys..." under his breath::
Logged
~Lance Allen
Wolves Den Publishing
Eternally Incipient Publisher of Mage Blade, ReCoil and Rats in the Walls
Brian Leybourne
Member
Posts: 1793
Electronic money-changer
«
Reply #5 on:
April 23, 2003, 04:50:38 PM »
Yeah, sounds like an interesting project. Wish I had thought of it first :-)
Some other things you might want to put in there (to go along with Lance's list)
* A facility to change money from one currency to another, and have it work out all the details. This should include a variable "moneychangers charge", from 0% to 10% which will be deducted for each transaction.
* An ability to track which currencies are accepted in which other countries, that can be constantly updated as the campaign progresses. This should also have a facility to have alterable individual exchange rates for the situation (for example) where Gelure coins are accepted but only with a 2% surcharge or any Tegaarn coins are accepted but the rate of exchange for Tengokun coins is slightly higher this year because of rumors of coin shaving in that country. Etc.
Brian.
Logged
Brian Leybourne
bleybourne@gmail.com
RPG Books: Of Beasts and Men, The Flower of Battle, The TROS Companion
Salamander
Member
Posts: 450
umm...
«
Reply #6 on:
April 24, 2003, 09:47:45 AM »
Umm, in my book the ratios are 1:20:240:960, not 1:12:240:960... (Table 7.1 pg 201 DFW1001). But I see you have it correct in the Pseudo Code.
Logged
"Don't fight your opponent's sword, fight your opponent. For as you fight my sword, I shall fight you. My sword shall be nicked, your body shall be peirced through and I shall have a new sword".
Mokkurkalfe
Member
Posts: 340
Electronic money-changer
«
Reply #7 on:
April 24, 2003, 11:19:57 AM »
Lance
Well, I'll probably be able to get most of that stuff to work.
Multiple purses are already in there, as is the "infrastructure" for different currencies.
And I'll be dissapointed if I can't make it ignore gold coins when changing, for example.
Other things you'll probably be able to do is to transfer money between different player's purses.
Brian
I had already planned for it to be able to handle percents, so I'll be dissapointed with myself if the currency-changer doesn't make it.
What you suggested about which currencies are accepted in which countries seems to be a lot of (monotonous) work... But hell, if you can code for every damn wound in the appendix, then I should be able to do this.
Whew! Seems like a lot of work. But this is fun, and I like the challenge.
Logged
Joakim (with a k!) Israelsson
Brian Leybourne
Member
Posts: 1793
Electronic money-changer
«
Reply #8 on:
April 24, 2003, 04:19:04 PM »
Quote from: Mokkurkalfe
But hell, if you can code for every damn wound in the appendix, then I should be able to do this.
Heh... you should see the code block that handles the wounds in the Combat Sim. It's several thousand lines of code... :-)
Brian.
Logged
Brian Leybourne
bleybourne@gmail.com
RPG Books: Of Beasts and Men, The Flower of Battle, The TROS Companion
prophet118
Member
Posts: 315
Electronic money-changer
«
Reply #9 on:
April 24, 2003, 06:28:26 PM »
it'd be nice if you guys were able to release all of this in a massive generator... something similiar to how the AD&D core rules cd was laid out... where you opened it up, and had all your options laid out before you...
combat sim, character gen, money changing.... add a map tool and it'd rock
Logged
"Congratulations you have won, its a years subscription of bad puns.."
Check out my art site!
http://prophet118.deviantart.com
Wanna Buy a Poster?
http://www.deviantprints.com/~prophet118/
Jake Norwood
Member
Posts: 2261
Electronic money-changer
«
Reply #10 on:
April 24, 2003, 09:41:49 PM »
I agree, prophet. Eventually we'd like to put it on disk with a nice autorun menu and everything.
Jake
Logged
"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
prophet118
Member
Posts: 315
Electronic money-changer
«
Reply #11 on:
April 24, 2003, 09:51:42 PM »
that would be spiff... course since i know nothing about coding (im a grphics guy)... i dont know all the code side logistics. ya know, making sure every little program could work with the other...
i think it would be great though, course for us visual people, a great GUI would be nice... i like visually pleasing things... course, i honestly can say that i hope the celtic patterns would be involved (the various designes in the book and on the wesite.. i really like those
Logged
"Congratulations you have won, its a years subscription of bad puns.."
Check out my art site!
http://prophet118.deviantart.com
Wanna Buy a Poster?
http://www.deviantprints.com/~prophet118/
Brian Leybourne
Member
Posts: 1793
Electronic money-changer
«
Reply #12 on:
April 25, 2003, 03:51:50 AM »
Quote from: Jake Norwood
Eventually we'd like to put it on disk with a nice autorun menu and everything
Hell, that stuff's easy. I can handle that.
I might need some help with the graphic design though. As you've all likely noticed, I can do the functional stuff but I'm not so hot at making it pretty.
Brian.
Logged
Brian Leybourne
bleybourne@gmail.com
RPG Books: Of Beasts and Men, The Flower of Battle, The TROS Companion
Salamander
Member
Posts: 450
Electronic money-changer
«
Reply #13 on:
April 25, 2003, 07:02:04 AM »
Quote from: Jake Norwood
I agree, prophet. Eventually we'd like to put it on disk with a nice autorun menu and everything.
Jake
"and they rejoiced" (a-one, a-two...) "Yay"....
=D
You know I have to add that you guys are putting some excellent work out there in support of TRoS. I for one really appreciate it!
Logged
"Don't fight your opponent's sword, fight your opponent. For as you fight my sword, I shall fight you. My sword shall be nicked, your body shall be peirced through and I shall have a new sword".
Mokkurkalfe
Member
Posts: 340
Electronic money-changer
«
Reply #14 on:
April 25, 2003, 08:51:06 AM »
Some questions.
What do the countries call their copper bits. Do they just call them bits?
And should Odeon Teeth be included? If so, are they Light, Imperial or Heavy wheight (whale teeth?).
And do you say one Marluki Dollmar or one Otarmarluki Dollmar or one Marluk Dollmar or what?
The last question might also become another problem with other countries as well...
Edit: Oh, and what's the plural of all these coins n' currencies?
Edit again: Oh, damnit. I'm more or less gonna need to know how to write all the countries' currencies in plural, as in "42 Cyrinthmeiran pennies". Anyone who could help here?
Logged
Joakim (with a k!) Israelsson
Pages: [
1
]
2
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Welcome to the Archives
-----------------------------
=> Welcome to the Archives
-----------------------------
General Forge Forums
-----------------------------
=> First Thoughts
=> Playtesting
=> Endeavor
=> Actual Play
=> Publishing
=> Connections
=> Conventions
=> Site Discussion
-----------------------------
Archive
-----------------------------
=> RPG Theory
=> GNS Model Discussion
=> Indie Game Design
-----------------------------
Independent Game Forums
-----------------------------
=> Adept Press
=> Arkenstone Publishing
=> Beyond the Wire Productions
=> Black and Green Games
=> Bully Pulpit Games
=> Dark Omen Games
=> Dog Eared Designs
=> Eric J. Boyd Designs
=> Errant Knight Games
=> Galileo Games
=> glyphpress
=> Green Fairy Games
=> Half Meme Press
=> Incarnadine Press
=> lumpley games
=> Muse of Fire Games
=> ndp design
=> Night Sky Games
=> one.seven design
=> Robert Bohl Games
=> Stone Baby Games
=> These Are Our Games
=> Twisted Confessions
=> Universalis
=> Wild Hunt Studios
-----------------------------
Inactive Forums
-----------------------------
=> My Life With Master Playtest
=> Adamant Entertainment
=> Bob Goat Press
=> Burning Wheel
=> Cartoon Action Hour
=> Chimera Creative
=> CRN Games
=> Destroy All Games
=> Evilhat Productions
=> HeroQuest
=> Key 20 Publishing
=> Memento-Mori Theatricks
=> Mystic Ages Online
=> Orbit
=> Scattershot
=> Seraphim Guard
=> Wicked Press
=> Review Discussion
=> XIG Games
=> SimplePhrase Press
=> The Riddle of Steel
=> Random Order Creations
=> Forge Birthday Forum