[SOLVED] History Screen Issue

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
mitoky
Veteran
Posts: 316
Joined: Sat Feb 07, 2015 9:12 pm
Projects: The Purring Demon's Love, circus eterie
Contact:

[SOLVED] History Screen Issue

#1 Post by mitoky »

Hello!

I have an issue with a history screen. I want the textbox content to be layed out based on each size + space inbetween rather than fixed sizes. Hence i though i should use viewport. However, it completly ignores it and simply places everything in once place at the top. I already tried everything i think could help but all didnt worked.
Its my first time making a history screen, so i am unsure if/what i did wrong so any help would be appreticiated!

The code:

Code: Select all

screen history():

    tag menu

    add "gui/overlay/white_overlay.png"
    add "gui/chatlog_bg.png" xanchor 0.5 xpos 390 yalign 0.5

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

    viewport:
        style_prefix "history"
        yinitial 1.0

        xanchor 0.5
        xpos 390
        yanchor 0.0
        ypos 150

        xmaximum 356
        ymaximum 610

        draggable True
        mousewheel True

        scrollbars "vertical"

        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"]

                $ what = renpy.filter_text_tags(h.what, allow=gui.history_allow_tags)
                text what

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

    ##Dont Change
    textbutton _("Close") action Return() xpos 390 xanchor 0.5 ypos 800 yanchor 0.5 style "history_close_button"

## History Style

## This determines what tags are allowed to be displayed on the history screen.
define gui.history_allow_tags = set()

## Removes Textbox
style history_window is empty

## Dialoge Boxes Inside History Box
style history_window:
    xfill True
    ysize None

## Name
style history_name:
    xpos 20
    xanchor 0.0
    yanchor 0.0
    ypos 0.0

style history_name_text:
    font "fonts/Crimson.ttf"
    yalign 0.5
    xalign 0.5
    size 26
    text_align 0.0

## Dialogue
style history_text:
    font "fonts/OpenSans.ttf"
    size 18
    xpos 50
    xanchor 0.0
    ypos 37
    yanchor 0.0
    xsize 240
    min_width 240
    text_align 0.0
    layout "tex"

style history_label:
    xfill True

style history_label_text:
    xalign 0.5

## Scrollbar
style history_vscrollbar:
    base_bar "gui/scrollbar/chatlog_scrollbar.png"
    thumb "gui/scrollbar/scroll_indicator.png"
    thumb_offset 17
    top_gutter 10
    bottom_gutter 5
    xmaximum 24
    ymaximum 610

## Close Menu Button
style history_close_button:
    xalign 0.5

style history_close_button_text:
    font "fonts/Crimson.ttf"
    size 19
    idle_color "#ad8568"
    hover_color "#d6c09c"
    selected_hover_color "#d6c09c"
    selected_idle_color "#d6c09c"
    xalign 0.5
Last edited by mitoky on Sat Jun 02, 2018 11:34 am, edited 1 time in total.

Rayne
Newbie
Posts: 7
Joined: Mon May 28, 2018 9:46 pm
Contact:

Re: History Screen Issue

#2 Post by Rayne »

I had a lot of issues while customizing History window, and I had something like this too.
Use a vbox there, like this.

Code: Select all

viewport:
        style_prefix "history"
        yinitial 1.0

        xanchor 0.5
        xpos 390
        yanchor 0.0
        ypos 150

        xmaximum 356
        ymaximum 610

        draggable True
        mousewheel True

        scrollbars "vertical"
        vbox:
            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"]

                    $ what = renpy.filter_text_tags(h.what, allow=gui.history_allow_tags)
                    text what

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

User avatar
mitoky
Veteran
Posts: 316
Joined: Sat Feb 07, 2015 9:12 pm
Projects: The Purring Demon's Love, circus eterie
Contact:

Re: History Screen Issue

#3 Post by mitoky »

Rayne wrote: Sat Jun 02, 2018 11:27 am I had a lot of issues while customizing History window, and I had something like this too.
Use a vbox there, like this.

Code: Select all

viewport:
        style_prefix "history"
        yinitial 1.0

        xanchor 0.5
        xpos 390
        yanchor 0.0
        ypos 150

        xmaximum 356
        ymaximum 610

        draggable True
        mousewheel True

        scrollbars "vertical"
        vbox:
            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"]

                    $ what = renpy.filter_text_tags(h.what, allow=gui.history_allow_tags)
                    text what

        if not _history_list:
            label _("The dialogue history is empty.")
It works! Thank you soo so much! Only thing i changed is i added too 4 spaces to the last two lines owo)b

Post Reply

Who is online

Users browsing this forum: Google [Bot]