Ren'Py Non-Decimal Money System
A downloadable Ren'Py file
NOTE: The .rpy file will be the only one updated in between major overhauls.
NOTE: Files temporarily removed pending massive overhaul of code.
Have you ever thought, 'Wouldn't it be fun to not use gold or whatever boring single currency for a medieval setting, but proper pounds/shillings/pence?' I did, and so I created one. Turns out that was far more complex to put into execution than I initially thought.
After much trial and error, I succeeded. *
*It does what I want it to do well enough. And with some more tinkering, even better than before.
EDIT: It could be better, and wasn't as modular as I wanted. I'm currently in the process of updating key sections of the code for modularity. The majority of the logic and functions are sound, fortunately. It's mainly fixing variables, cleaning up classes and adding dictionaries.
What it is: A .rpy file that contains a money system focused on non-decimal units.
Note: Old Pence refers to non-decimal, and New Pence refers to decimal.
Features:
1. Non-Decimal Currency. Think classic GBP, with 240 pence per pound, 20 shillings per pound, and 12 pence per shilling.
1A. I'm on the fence about the Farthing, 1/4 of a Penny. Historically it was important and used in daily life by most people. But it's a lot of work to incorporate. And how many would use it, anyway? The ability to incorporate it is there, but it's too much effort at the moement.
2. Decimal Currency Toggle: Some people might have trouble understanding non-decimal money, so I included an option to convert to decimal. That way they can toggle back and forth and get a feel for what the equivalents are. The base unit is the penny, not the pound, so 1 pound/240 pence become 2.40 pounds in the decimal version. Currently, I recommend only allowing this change at the beginning for that reason. If I think it's worthwhile, I might put the effort in to get more accurate conversions between the two. I fixed/improved the conversion functions, so now it converts between the two, preserving the Pound value. 1 Pound/240 Pence becomes 1 Pound/100 Pence. It also works with custom non-decimal ratios. In testing the conversions were never off by more than a couple Pence, and only with the initial conversion due to rounding. The bias is towards adding value, not removing it. 1 Pound/1 Shilling/1 Penny converted to decimal becomes 1.06, but converted back becomes 1 Pound/1 Shilling/2 Pence.
2A. Because the point of this is for a non-decimal currency system, that's what the code is set up to do. If decimal is turned on, the ratio between the non-decimal code and decimal output is preserved. 1 Shilling becomes 5 New Pence. The rounding error with Pence is higher, due to the 2.4 Old Pence to New Pence ratio. So 3 Old Pence becomes 2 New Pence.
2A1. Slight modification to the code provides for a non-ratioed option for decimal presentation.
2B. After much debate, I've decided to keep the option to write the code in Decimal format. Initially I thought the code could just use the Pence option, but on some feedback I realized that wasn't enough. It still requires the coder to think in Non-Decimal. By allowing the option to write code in Decimal, it should make it easier to keep track of values and relative ratios and what not. This option was removed because it overly complicated the code for no discernable gains.
2C: Button added to the preferences screen to toggle between Decimal/Non-Decimal. If you only downloaded the .rpy, there's some cut/paste required first.
3. Editable Currency Names: There's a label to allow the names of the currency units to be changed in game. Don't like pounds/shillings/pence? Let your players change them to whatever they like. Or you can change it via the defaults if you don't want the players messing with the names.
3A: There's a button on the preferences screen to call the name change label. If you just downloaded the .rpy file, you have some cut/paste to do first.
4. Editable Currency Ratios: I added it for testing purposes and left it in because someone might find it useful. If you, the developer, don't like the ratios I recommend changing them via the default values. Want your players to be able to change the 240/20/12 ratios? You can let them do so via a label. Why? That's on you. If you let players decide, there's a chance it could lead to uneven ratios/break the system. For example, 11 shillings 3 pence to the pound instead of 11 shillings even. I fixed the divide by zero errors (mostly?) that could arise. But the system is liable to not function properly if there's a zero in the ratios. Example: 100 pence to the pound, and 101 pence to the shilling means there are zero shillings per pound. This causes the system to no longer track properly. Two of the menu choices are labeled 'EXPERIMENTAL' for a reason. Don't use them if you value stability. I might just remove them entirely, or hide them behind a debug menu.
4A. When changing the currency ratios in game, it doesn't change the total cash value in Pence. The only thing that changes is the long and short representations. For example, 10 Pounds(2400 Pence) at the 240/20/12 ratio. Change the ratio to 480/40/12, and it becomes 5 Pounds(2400 Pence). Again, don't know why you'd want people to do this, but the option's there.
5. Notifications: Whenever you change the value of the money via the relevant functions, you get a notification of how much was gained or lost in a readable format, X Pounds, X Shillings, X Pence. Adjust the X and Y values to change where the notification appears, and the timer for how long it's visible if you don't like the default.
6. Screens: It comes with a screen that displays the amount of money. You can change where this appears, and the format in which the money is displayed. The options are $X/X/X or X Pounds, X Shillings, X Pence. All you need to do is un/comment the relevant lines of text.
7. Default values: Comes with test_char variable for testing purposes. Also comes with wallet variable for regular use. You're of course welcome to create your own variables, but you don't have to if you don't want to. If you add your own variables, be sure to include them in the relevant list so the functions know to use them.
8. Test Labels: File comes with included labels for testing purposes. This should let you get a feel for how it works.
9. Self Contained: Everything* needed to run this file is included in the file. All the defaults, classes, screens, and relevant labels. You might need to do some copy/paste for full functionality.
10, Comments: There's a lot of comments, and I'll concede a chunk of them are probably unnecessary. I added them to help me as I went, and hopefully they're helpful to anyone using this file. Hopefully anything that you need to change to customize is clearly labeled as such. If not, let me know.
11. Calculator: Even though the function to adjust the self.cash value can take input in pounds, shilling, and pence, sometimes you may want/need to know how many pence a random amount of money is. There's an option to input pounds, shillings, and pence and get the total pence value. It can also tell you how many pounds, shillings, and pence a given amount of pence is. Just enter zeros for the pounds and shilling part.
12. Tutorial is in progress. This will walk you through all the available options, and how to use this.
Todo: A. I might remove the decimal conversion. As it currently stands, it causes an issue if the code is made for a non-decimal setup, but you switch to a decimal setup. Fixed conversion between decimal and non-decimal.
A1. If I do keep the decimal, I'll need a way to convert between the two using the existing Pound/Shilling/Pence function. You can use the existing function with just pennies, but it's easier if you don't have to do the math yourself. I'd much rather say "Subtract 17 Shillings" than work out that's equal to 204 Pence.
B. I've run into some issues with merchants. The current setup doesn't make it easy to display a variety of prices.
You may have noticed there's no link to it. That's because I'm still tweaking it, and a little nervous in all honesty. This post is to gauge if this is something others would be interested in. If so, I'll upload it.
I've reached the point where I'm willing to upload it. The file is self-contained, all you need to do is add the call to test it yourself. Call the label "currency_test" to explore the functions. I'll package it as a game as well, so you can just download and try it out. I don't know why they're so large, there's no pictures or video. Just the nature of Ren'Py I guess.
If you made it to the end, thank you. Because I've been working on this, things I think are intuitive might not be. Please leave comments on how I can improve either the comments or the code to improve usability.
This work is licensed under Creative Commons Attribution-ShareAlike 4.0 International
Updated | 23 days ago |
Status | In development |
Category | Assets |
Author | MockMicrobe |
Tags | asset, Asset Pack, currency, Game Design, money, Ren'Py, text |
Development log
- Update 158 days ago
- Log 1: Initial UploadsFeb 16, 2025
Leave a comment
Log in with itch.io to leave a comment.