Viewport 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
BM90
Newbie
Posts: 15
Joined: Sat Mar 31, 2018 2:48 am
Contact:

Viewport Help

#1 Post by BM90 »

Can anyone provide a link to a tutorial for viewports, or perhaps just provide a quick explanation on how to customize them. Currently I have something akin to a quest screen with a background and a vbox containing variable amounts of text. All I'm looking to do is make the text section scrollable when needed. I've done some searching, read through some older posts, and done my best to understand how these work, but I'm still at a loss. I can get the viewport to technically function, but as soon as I make any changes to the given examples I start to run into problems. Any help would be appreciated.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Viewport Help

#2 Post by kivik »


BM90
Newbie
Posts: 15
Joined: Sat Mar 31, 2018 2:48 am
Contact:

Re: Viewport Help

#3 Post by BM90 »

I appreciate the link but sadly it still doesn't quite tell me what I need to know. Maybe it would be better to just ask more specifically for what I need. Here's an image of what I'm trying to achieve:

Image

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Viewport Help

#4 Post by kivik »

Sorry was in a rush to go to bed. Here's the sample code from the official documentation that I used myself:
https://www.renpy.org/doc/html/screens.html#viewport

I've added comments at the end of each line for info

Code: Select all

screen viewport_example():
    side "c b r": # https://www.renpy.org/doc/html/screens.html#side for more info
         area (100, 100, 600, 400) # x, y, width, height (https://www.renpy.org/doc/html/style_properties.html?highlight=area#style-property-area)

         viewport id "vp": # the id to be used by the scroll bar
             draggable True # allows player to drag this

             add "washington.jpg" # replace this with your vbox list of content.

         vbar value YScrollValue("vp") # scrollbar, style this with using the bar properties: https://www.renpy.org/doc/html/screens.html#bar, i.e. common, position and bar style properties.

BM90
Newbie
Posts: 15
Joined: Sat Mar 31, 2018 2:48 am
Contact:

Re: Viewport Help

#5 Post by BM90 »

Thanks you so much for spelling everything out for me. I probably spent three hours trying to figure this out on my own and with the links you provided I was able to get everything working in less than 10 minutes. Can't thank you enough.

Post Reply

Who is online

Users browsing this forum: Google [Bot], Ocelot