Custom Say Screen, strange behavior with frames

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
vitriolic_crux
Newbie
Posts: 23
Joined: Mon May 13, 2019 11:24 pm
Contact:

Custom Say Screen, strange behavior with frames

#1 Post by vitriolic_crux »

So I want a frame instead of a window for the say screen, so that the text box can grow and shrink according to what's inside it. My solution to this, which probably wouldn't work, is to try and replace the outer window of the say screen with a frame.

However, I'm seeing some very strange behavior from the frame. The background doesn't scale to fill the frame, and the text of the "who" and the "what" are overlapping one another. I can sort of understand why the text is breaking, but I do not understand why the frame background isn't scaling. And, just as strangely, when I create a frame without defining a background, instead of simply using the frame in the GUI folder, it shows nothing at all.

Code: Select all

screen say(who, what):
    # modal True
    zorder 80
    frame:
        xalign 0.5
        xsize 1680
        yoffset 860
        ymaximum 220
        id "window"
        # background "gui/frame.png"
        if who is not None:
            window:
                id "namebox"
                style "cybermenu"
                text who id "who"

        text what id "what" style "cybertext"


    ## If there's a side image, display it above the text. Do not display on the
    ## phone variant - there's no room.
    if not renpy.variant("small"):
        add SideImage() xalign 0.0 yalign 1.0
Yes, I know it's a garbled mess. Still, that doesn't explain why the frame's behavior is all out of whack. If someone could explain why the frame is behaving this way, or could just point me to an example of someone setting a frame as a background, I would be very grateful.

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Custom Say Screen, strange behavior with frames

#2 Post by Remix »

Your frame: (container) would want a background that is a Frame() (displayable)

See: https://github.com/RenpyRemix/speech-bu ... ing-frames

Note though that your frame has id "window" which will cause it to take styles defined for that name
Frameworks & Scriptlets:

Post Reply

Who is online

Users browsing this forum: Google [Bot]