Adding a scrollbar [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
Llunet1
Regular
Posts: 55
Joined: Mon Oct 21, 2013 8:56 pm
Projects: Reminiscence, Blood
Deviantart: llunet1
Location: USA
Contact:

Adding a scrollbar [SOLVED]

#1 Post by Llunet1 »

Hello! I'm trying to add a scrollbar into a screen. It's an information journal, an in order to avoid making pages (in case it goes over), it would be much better to be able to scroll!
Does anyone know how to do this?
Also, I'm going to be inputting all the writing in the screen. Will the text function work? Or is there another way to input the text?

If there isn't a way to do this, I can just avoid to go over, or simply make pages.

Thank you! :)
(Here's a diagram of what I'm trying to do)
Attachments
This is what I'm hoping to achieve.
This is what I'm hoping to achieve.
Last edited by Llunet1 on Tue Jan 06, 2015 11:14 pm, edited 1 time in total.

User avatar
Dragonstar89
Regular
Posts: 163
Joined: Mon Aug 12, 2013 11:28 pm
Projects: TBA
Organization: Self
IRC Nick: dstar89
Deviantart: senpai-jake
Skype: dstar_891
Location: West Virginia, USA
Contact:

Re: Adding a scrollbar

#2 Post by Dragonstar89 »

You can use Ren'Py's "Frame" code to add a scrollbar. For example, I added the code to my Music Room list to make the vbox list have a scrollbar. You could start out like this:

Code: Select all

    frame:
        side ("c r"):
            area (1,0,280,600)
            viewport id "music_list":
                draggable True mousewheel True
Then, after all of your text/inner content has been defined, use this:

Code: Select all

vbar value YScrollValue("music_list")
(but make sure it stays indented within the "viewport" block. Basically, a full section of code could look like this:

Code: Select all

    frame:
        side ("c r"):
            area (1,0,280,600)
            viewport id "my_scroller": #REMEMBER YOUR VIEWPORT ID SO THE SCROLLBAR IS PLACED FOR IT
                draggable True mousewheel True
                     text "this is my text."
                     textbutton "This is my Button" action Start()
            vbar value YScrollValue("my_scroller") #TAKES YOUR VIEWPORT ID AS THE ARG
    null height 20 #just a height set.
However, this is just how to do it in barebones. The official documentation has a much better explanation and example on things like what "side("c r")" is, what to use null height for, etc. Also this won't mess up your text. You can still display your text like any other screen. I forgot to mention that in a screen, (IIRC) you have to use

Code: Select all

text "my text here"
to display text because it is the screen code.
Beginning pre-production work on a project in Renpy. After being away for 5 years, it's time to get back in the game 8)

User avatar
Llunet1
Regular
Posts: 55
Joined: Mon Oct 21, 2013 8:56 pm
Projects: Reminiscence, Blood
Deviantart: llunet1
Location: USA
Contact:

Re: Adding a scrollbar

#3 Post by Llunet1 »

Thank you so much! I finally got it to work~

User avatar
Llunet1
Regular
Posts: 55
Joined: Mon Oct 21, 2013 8:56 pm
Projects: Reminiscence, Blood
Deviantart: llunet1
Location: USA
Contact:

Re: Adding a scrollbar [SOLVED]

#4 Post by Llunet1 »

Actually. The text isn't showing up. So, while the scrollbar is there... there seems to be nothing in it?

*Edit* Figured out what the problem was. The text statements should be on the same indent as the "draggable True..." line.
Once again, thank you~

User avatar
Dragonstar89
Regular
Posts: 163
Joined: Mon Aug 12, 2013 11:28 pm
Projects: TBA
Organization: Self
IRC Nick: dstar89
Deviantart: senpai-jake
Skype: dstar_891
Location: West Virginia, USA
Contact:

Re: Adding a scrollbar [SOLVED]

#5 Post by Dragonstar89 »

Llunet1 wrote:Actually. The text isn't showing up. So, while the scrollbar is there... there seems to be nothing in it?

*Edit* Figured out what the problem was. The text statements should be on the same indent as the "draggable True..." line.
Once again, thank you~
Yeah, sorry I forgot to mention that. You'r welcome :)
Beginning pre-production work on a project in Renpy. After being away for 5 years, it's time to get back in the game 8)

smrg
Newbie
Posts: 4
Joined: Wed Aug 09, 2023 6:03 pm
Contact:

Re: Adding a scrollbar [SOLVED]

#6 Post by smrg »

I'm trying to do it but I can't scroll down to see text below the seeing range

Code: Select all

screen quiz:
    add "wood.jpg"
    frame:
        xpos 200
        side ('c r'):
            area (0,0,1280,720)
            viewport id "quiz_sheet":
                draggable True mousewheel True
                add "sheet.jpg"
                text _("""{color=000}Sample text{/color}""")
                textbutton "Yes" ypos 100
                text _("{color=000}This is far below{/color}") ypos 1000
            vbar value YScrollValue("quiz_sheet")

Post Reply

Who is online

Users browsing this forum: Classy_Lemon, Google [Bot]