History Scrollbar - How to start from latest dialogue? [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
Demetis
Regular
Posts: 134
Joined: Mon Jul 22, 2013 3:56 pm
Contact:

History Scrollbar - How to start from latest dialogue? [SOLVED]

#1 Post by Demetis »

Hi, I'm currently trying to customize the history screen and can't seem to figure out how to make the scrollbar start from the latest dialogue instead of from the top. I'm wondering if there's some kind of state that needs to be enabled for the scrollbar for that.

Image

As for the code I'm currently using, it's like this.

Code: Select all

    tag menu
    predict False
    
    add "/gui/bg_history.png"
    
    side "c b r":
        area (230, 140, 720, 520)
        
        viewport id "history_box":
            draggable True
            mousewheel True

            vbox:
                for h in _history_list:
                    if h.who:
                        text h.who.upper() + ":" 
                    text h.what
                if not _history_list:
                    label _("The dialogue history is empty.")
            
    vbar value YScrollValue("history_box")
I wonder what changes needs to be made to the vbar? >w< Help would be very much appreciated! Thank you.
Last edited by Demetis on Sat Jun 23, 2018 4:26 pm, edited 1 time in total.

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 Scrollbar - How to start from latest dialogue?

#2 Post by mitoky »

Yes its possible! You need to add this to the viewport:

Code: Select all

yinitial 1.0
So your code would be:

Code: Select all

    tag menu
    predict False
    
    add "/gui/bg_history.png"
    
    side "c b r":
        area (230, 140, 720, 520)
        
        viewport id "history_box":
            draggable True
            mousewheel True
            yinitial 1.0

            vbox:
                for h in _history_list:
                    if h.who:
                        text h.who.upper() + ":" 
                    text h.what
                if not _history_list:
                    label _("The dialogue history is empty.")
            
    vbar value YScrollValue("history_box")

User avatar
Demetis
Regular
Posts: 134
Joined: Mon Jul 22, 2013 3:56 pm
Contact:

Re: History Scrollbar - How to start from latest dialogue? [SOLVED]

#3 Post by Demetis »

@mitoki:
Yes it worked! Thank you very much >w<b

Post Reply

Who is online

Users browsing this forum: Google [Bot]