Annoying warning when using a background for text

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
Florian

Annoying warning when using a background for text

#1 Post by Florian »

Hello again,

I'm starting to hesitate to ask further questions, because I have already taken so much of your time... unfortunately, we have yet another problem. *blush*


We get a strange error message as soon as one leaves the game. It says that there was an error and that more information is in renpy.exe.log. This is the content of the log:
D:\Flo\renpy-6.3.1-full\renpy-6.3.1\renpy\display\im.py:593: DeprecationWarning: integer argument expected, got float

Dennis found out, that this error goes away if

Code: Select all

style.window.background = Solid((0, 0, 0, 128))
is replaced by

Code: Select all

style.window.background = None
in options.rpy.

Unfortunately, we want this background. Any idea what might be the reason for the error? It only appears after the game ended, I can't find any real error inside the game. But we don't want that the last thing a user sees of the game is an error message. :)


Greetings,
Florian

P.S.: Our deadline is this Friday, so you'll probably soon get rid of us... :)

Florian

Re: Annoying warning when using a background for text

#2 Post by Florian »

Oh, I forgot to mention: This happens also with the latest version of renpy.

Blue Lemma
Forum Founder
Posts: 2005
Joined: Sat Jan 25, 2003 2:32 pm
Completed: ToL, Shoujo Attack!, Lemma Ten
Projects: [RETIRED FROM FORUM ADMINISTRATION - CONTACT PYTOM WITH ISSUES]
Contact:

Re: Annoying warning when using a background for text

#3 Post by Blue Lemma »

I was curious, so I took a fresh Ren'Py 6.3.1 and put that line you said causes the problem in the config file for "The Question" (example game). I ran it twice, but I never got any error on exit. :? Maybe there's another line somewhere that's affecting that line? Hard to tell without the script, although I'm not an expert.

(btw, we don't want to get rid of you - join the community :D )
“Among those who dislike oppression are many who like to oppress.”
- Napoleon Bonaparte


I've retired from forum administration. I do not add people to the "adult" group, deactivate accounts, nor any other administrative task. Please direct admin/mod issues to PyTom or the other mods : )

Dennis
Newbie
Posts: 11
Joined: Sun Jul 08, 2007 4:37 pm
Location: Esslingen, Germany
Contact:

Re: Annoying warning when using a background for text

#4 Post by Dennis »

Hmmm, what can I add to what Florian already said about our problem? Since this concerns the text window, it might be helpful to know what we're doing to it:

Code: Select all

if ((target_data[3]) <= 1.4): # i.e. if the user has a 4:3 screen resolution
  style.window.yminimum = 0.125
else: # i.e. if the user has a different, e.g. 16:9 screen resolution
  style.window.yminimum = 0.20
Admittedly we are using float (relative) values here, but it did work before with a yminimum of 0.26.

The part of im.py that throws the float/integer warning and thus causes the crash at quitting the game reads:

Code: Select all

if self.color[3] != 255:
    sample = renpy.game.interface.display.sample_surface
else: # this is the case with us, since the text window is transparent
    sample = renpy.game.interface.display.window
        
rv = pygame.Surface((self.width, self.height), 0, sample)
Somehow sample causes something to be float when it should be int, but why??

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Annoying warning when using a background for text

#5 Post by PyTom »

Are you using imouto-mode scaling, or just straight up Ren'Py. It's probably that the size of the window is somehow becoming a float.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Florian

Re: Annoying warning when using a background for text

#6 Post by Florian »

PyTom: Erm... since I'm not sure what imouto is, I think we're just using straight up renpy.

But I think I might have found a solution:
Dennis wrote:

Code: Select all

if ((target_data[3]) <= 1.4): # i.e. if the user has a 4:3 screen resolution
  style.window.yminimum = 0.125
else: # i.e. if the user has a different, e.g. 16:9 screen resolution
  style.window.yminimum = 0.20
Admittedly we are using float (relative) values here, but it did work before with a yminimum of 0.26.
I tested 0.26 and it still gives an error. Then I tested 270 and there was no error.

So I created this workaround, which seems to work at least on my system:

Code: Select all

        
        if ((target_data[3]) <= 1.4):
          style.window.yminimum = int(float(config.screen_height) * 0.125)
        else:
          style.window.yminimum = int(float(config.screen_height) * 0.20)
It basically takes the former float values and transforms them into absolute values.

Thanks for your help! :)

Post Reply

Who is online

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