Making the history screen shorter? [SOLVED]

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
sasquatchii
Miko-Class Veteran
Posts: 552
Joined: Fri Jul 04, 2014 7:48 am
Completed: A Day in the Life of a Slice of Bread
Deviantart: sasquatchix
Soundcloud: sasquatchii
itch: sasquatchii
Location: South Carolina
Contact:

Making the history screen shorter? [SOLVED]

#1 Post by sasquatchii »

Hi,

I am trying to make the history screen in my game slightly shorter. As it is right now, it runs all the way to the bottom of the page, which I do not like since my game menu is at the very bottom of the page. The history screen is running into the game menu and it's a bit of an eyesore:

Image

I was wondering if it's possible to change the menu so that the text doesn't run all the way to the bottom of the page? And if so, how? I've tried playing with padding and margins but that didn't seem to work. Here is the code for the history in my gui.rpy file:

Code: Select all

define config.history_length = 500

## The height of a history screen entry, or None to make the height variable at
## the cost of performance.
define gui.history_height = 80

## The position, width, and alignment of the label giving the name of the
## speaking character.
define gui.history_name_xpos = 140
define gui.history_name_ypos = 75
define gui.history_name_width = 150
define gui.history_name_xalign = 0

define gui.history_window_height = 300



## The position, width, and alignment of the dialogue text.
define gui.history_text_xpos = 140
define gui.history_text_ypos = 115
define gui.history_text_width = 922
define gui.history_text_height = 317
define gui.history_text_xalign = 0.0
And here's what I have in my screens.rpy file:

Code: Select all

screen history():

    tag menu
    

    ## Avoid predicting this screen, as it can be very large.
    predict False


    use game_menu(_(""), scroll=("vpgrid" if gui.history_height else "viewport")):

        style_prefix "history"
        

        for h in _history_list:
            
    

            window:

                ## This lays things out properly if history_height is None.
                has fixed:
                    yfit True

                if h.who:

                    label h.who:
                        style "history_name"

                        ## Take the color of the who text from the Character, if
                        ## set.
                        if "color" in h.who_args:
                            text_color h.who_args["color"]

                text h.what

        if not _history_list:
            label _("The dialogue history is empty.")

    add "gui/history-menu-title.png"
style history_window is empty

style history_name is gui_label
style history_name_text is gui_label_text
style history_text is gui_text

style history_text is gui_text

style history_label is gui_label
style history_label_text is gui_label_text

style history_window:
    xfill True
    ysize gui.history_height
    bottom_padding 300
    bottom_margin 300





style history_name:
    xpos gui.history_name_xpos
    xanchor gui.history_name_xalign
    ypos gui.history_name_ypos
    xsize gui.history_name_width
    bottom_padding 190
    

style history_name_text:
    min_width gui.history_name_width
    text_align gui.history_name_xalign
    font gui.history_name_text_font
    size gui.history_name_text_size
    bottom_padding 40

    

style history_text:
    xpos gui.history_text_xpos
    ypos gui.history_text_ypos
    xanchor gui.history_text_xalign
    xsize gui.history_text_width
    min_width gui.history_text_width
    text_align gui.history_text_xalign
    layout ("subtitle" if gui.history_text_xalign else "tex")
    size gui.history_text_size
    top_padding 30



style history_label:
    xfill True

style history_label_text:
    xalign 1.0
Any help or ideas are always very much appreciated!
Last edited by sasquatchii on Sun Aug 20, 2017 3:15 pm, edited 1 time in total.
ImageImage

TheChatotMaestro
Regular
Posts: 91
Joined: Mon Jul 31, 2017 8:33 am
Deviantart: LedianWithACamera
Contact:

Re: Making the history screen shorter?

#2 Post by TheChatotMaestro »

Have you tried moving the body text slightly farther up so it's closer to the word 'History', or does that not work? I'm not sure about the technicalities of moving things around on screen...
My only other suggestion would be a smaller font size as a temporary fix.

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: Making the history screen shorter?

#3 Post by PyTom »

So, part of the thinking with the new GUI is that it's meant for three people.

- Beginners, who want to just have something acceptable out of the box.
- Intermediate creators, who want to make "easy" customizations, changing fonts, colors, and backgrounds.
- Advance creators, who need to change the layouts of the screens.

You're in that third group here. The new GUI supports creators by making screens easy to edit and replace. In this case, we can go ahead and reuse most of the new GUI infrastructure, even as we're laying the screen out differently.

Code: Select all

screen history():

    tag menu

    ## Avoid predicting this screen, as it can be very large.
    predict False

    use game_menu(_("")):
        pass

    vpgrid:
        style_prefix "history"

        cols 1
        yinitial 1.0

        scrollbars "vertical"
        mousewheel True
        draggable True

        side_ysize 552
        side_xsize 940
        side_xpos 300
        side_ypos 120


        for h in _history_list:

            window:

                background "#f002"

                ## This lays things out properly if history_height is None.
                has fixed:
                    yfit True

                if h.who:

                    label h.who:
                        style "history_name"

                        ## Take the color of the who text from the Character, if
                        ## set.
                        if "color" in h.who_args:
                            text_color h.who_args["color"]

                text h.what

        if not _history_list:
            label _("The dialogue history is empty.")
What we're doing here is taking the vpgrid out of the game_menu screen, and putting it by itself in the history screen. Now that it's at the top level, you can use the side_ properties (which control the Side layout that contains the vpgrid and its scrollbars) to size and position it where you'd like on the screen.

(The background "#f002" is just a little debugging thing to make it easier to see where the history is, and should probably go away when it's in the right place.) Hope this helps.
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

User avatar
sasquatchii
Miko-Class Veteran
Posts: 552
Joined: Fri Jul 04, 2014 7:48 am
Completed: A Day in the Life of a Slice of Bread
Deviantart: sasquatchix
Soundcloud: sasquatchii
itch: sasquatchii
Location: South Carolina
Contact:

Re: Making the history screen shorter?

#4 Post by sasquatchii »

PyTom wrote: Sun Aug 20, 2017 12:37 pm You're in that third group here
I don't make it easy for myself, do I? :D

Thank you so much, though, PyTom!! Your code worked like a charm and you saved me a lot of time and head scratching!
ImageImage

Post Reply

Who is online

Users browsing this forum: No registered users