Viewport questions & help

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
renpyhelp
Regular
Posts: 71
Joined: Tue Feb 27, 2018 2:01 am
Contact:

Viewport questions & help

#1 Post by renpyhelp »

Hi. I have two questions about viewports that I can't quite figure out.

I have a viewport set up right now, and the text goes past the visible barriers that I have set up, but right now is draggable/scrollable. I'd like it to automatically scroll to the bottom whenever I append new text to it. Is that possible? Right now, it appends the text to it, but doesn't display it. The player has to manually scroll downwards to see anything new that is added.

Here is the viewport code I'm using right now:

Code: Select all

frame:
        background "transparent.png"    # or use any semi-transparent image you like

        side "c r":
            area (1015, 162, 1250, 400)

            viewport id "vp":
                draggable True
                mousewheel True
                yinitial 1.0

                vbox:
                    spacing 5
                    for k in viewport_test:
                        text k
Another questions is... is it possible to append new text to the TOP of a viewport, rather than automatically to the bottom? As the viewport gets more text, it's kind of a hassle to see new stuff by scrolling down a decent ways.


Thanks to anyone who helps me out. It would be GREATLY appreciated.
Last edited by renpyhelp on Fri Feb 15, 2019 11:40 pm, edited 1 time in total.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Viewport questions & help

#2 Post by Imperf3kt »

I've no idea how its used as I've not looked into it yet, but Scroll() might be what you need
https://www.renpy.org/doc/html/screen_a ... tml#Scroll
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

renpyhelp
Regular
Posts: 71
Joined: Tue Feb 27, 2018 2:01 am
Contact:

Re: Viewport questions & help

#3 Post by renpyhelp »

It seems to have the right idea in mind, but it's an action. I kind of want it to happen automatically on screen. Unsure how I can action assign Scroll to a displayed viewport on screen automatically

edit: The viewport is within a screen, so hide screen / show screen between the append statement seems to work as a bandaid fix (when using "yinitial 1.0") to have it start from the bottom of the viewport.

User avatar
Alex
Lemma-Class Veteran
Posts: 3090
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Viewport questions & help

#4 Post by Alex »

If you need to show new stuff at the top of viewport you have two options: either reverse the order of items in viewport_test list or insert new stuff at the beginning of viewport_test list rather than add it.

https://docs.python.org/2.7/tutorial/da ... structures

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]