[Solved]Display integer value with a decimal point

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.
Post Reply
Message
Author
User avatar
Dark79
Regular
Posts: 63
Joined: Sun Apr 18, 2021 2:21 pm
Contact:

[Solved]Display integer value with a decimal point

#1 Post by Dark79 »

Hello,

Is there a way to display integer value with a decimal point? It's like you can place decimal point anywhere in the integer value for display purposes.

For example.

Code: Select all

default var= 100

screen TestScreen():
    text "[var]" xalign 0.5 #here show as if the value is being displayed as 1.00 instead 100
	
Last edited by Dark79 on Thu Apr 25, 2024 11:07 am, edited 2 times in total.

User avatar
Dark79
Regular
Posts: 63
Joined: Sun Apr 18, 2021 2:21 pm
Contact:

Re: Display integer value with a decimal point

#2 Post by Dark79 »

Figured it out. Just in case if someone else needs it.

Code: Select all

default var= 100

screen TestScreen():
    text "{0:.2f}".format(var / 100) xalign 0.5



Post Reply

Who is online

Users browsing this forum: decocloud, Semrush [Bot]