[solved] xsize(1000*0.5)

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
Kia
Eileen-Class Veteran
Posts: 1040
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

[solved] xsize(1000*0.5)

#1 Post by Kia »

I tried to scale a frame in a screen and i noticed it doesn't do the math correctly, isn't that how percentage is done it python?
do I have to do x*.5 the crude way?: x*50/100
Last edited by Kia on Tue Jul 31, 2018 1:21 am, edited 1 time in total.

rames44
Veteran
Posts: 233
Joined: Sun May 29, 2016 4:38 pm
Contact:

Re: xsize(1000*0.5)

#2 Post by rames44 »

You haven’t posted the exact code you’re using, so it’s hard to know exactly what to advise you to do. However, Renpy frequently interprets integers and floating point numbers to mean different things. (Pixels vs screen fractions)

1000*0.5 will result in a float, while 1000/2 or 1000*50/100 will result in integers. This might be part of your issue.

User avatar
Kia
Eileen-Class Veteran
Posts: 1040
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: xsize(1000*0.5)

#3 Post by Kia »

I didn't notice the type mismatch, thanks ^_^
here's the full, fixed code:

Code: Select all

screen titledwindow(fac):
    frame:
        background "#0008" xsize int(1000*fac)
        vbox:
            text "title"
it was just a test to see if it's possible

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]