Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
The obvious way: transform number to string, insert separator as needed and print that string instead of raw number. You can easily do that using format: $ money_string = '{:,}'.format(money)
Correct way would be to define your class to hold money, with proper methods to add and substract money with invariant checking and override __repr__() magic method, so your class would be properly displayed whenever you need it with actual values.
Ocelot wrote:The obvious way: transform number to string, insert separator as needed and print that string instead of raw number. You can easily do that using format: $ money_string = '{:,}'.format(money)
Correct way would be to define your class to hold money, with proper methods to add and substract money with invariant checking and override __repr__() magic method, so your class would be properly displayed whenever you need it with actual values.
Thanks!
I used the transform number to string method, and it works great.
Imperf3kt wrote:I looked at the explanation and scratched my head. I guess I don't even understand a lot of python yet.
I don't really understand the 2nd method too
But the 1st method is simple enough.
You just need to display money_string variable after transforming it instead of the previous money variable.
I primarily want to use this in an inventory screen (where the coding may be different) but I figure if I need to get that working in regular dialogue first and then hopefully it won't be different for the other screen.