Removing decimal points(solved)
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.
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.
- JQuartz
- Eileen-Class Veteran
- Posts: 1265
- Joined: Fri Aug 31, 2007 7:02 am
- Projects: 0 completed game. Still haven't made any meaningfully completed games...
- Contact:
Removing decimal points(solved)
How do you remove decimal points from integers. Something like 1.0 becoming 1.
Last edited by JQuartz on Sat Jan 03, 2009 10:03 am, edited 1 time in total.
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.
-
iichan_lolbot
- Veteran
- Posts: 206
- Joined: Tue Dec 30, 2008 9:18 am
- Projects: iichan erogame
- Contact:
Re: Removing decimal points
Code: Select all
float = 10.81
text = "%d" % float
//1.0...1.99 ->1
If you want the values to be rounded properly, add 0.5 to them:
Code: Select all
float = 10.81
text = "%d" % (float+0.5)
//0.50...1.49 ->1
- JQuartz
- Eileen-Class Veteran
- Posts: 1265
- Joined: Fri Aug 31, 2007 7:02 am
- Projects: 0 completed game. Still haven't made any meaningfully completed games...
- Contact:
Re: Removing decimal points
Thanks a lot. It works. I owe you one iichan_lolbot!
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.
Who is online
Users browsing this forum: No registered users
