[SOLVED] Trying to make a scrolling menu within a screen

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.
Message
Author
Maou Zenigame
Regular
Posts: 66
Joined: Thu Nov 09, 2017 3:09 am
Contact:

[SOLVED] Trying to make a scrolling menu within a screen

#1 Post by Maou Zenigame »

I'm trying to make a screen that has a scrolling list of imagebuttons off to one side, navigated with a vertical scrollbar.

Here's the mockup of what it's supposed to end up looking like:
extrascreen.png
I'm guessing that the way to pull this off would have something to do with viewports, but how exactly would I go about it?
Last edited by Maou Zenigame on Thu May 07, 2020 2:29 pm, edited 1 time in total.

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Trying to make a scrolling menu within a screen

#2 Post by isobellesophia »

Can you show the code about the scrolling?
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Trying to make a scrolling menu within a screen

#3 Post by isobellesophia »

I think you could try this one.

Code: Select all

screen ....:
tag menu
use game_menu(scroll="viewport"):
I am a friendly user, please respect and have a good day.


Image

Image


Maou Zenigame
Regular
Posts: 66
Joined: Thu Nov 09, 2017 3:09 am
Contact:

Re: Trying to make a scrolling menu within a screen

#4 Post by Maou Zenigame »

That's the thing, I don't know where I'd even start with this.

I know I want a smaller window along where the "name of title" parts in the example image are that would scroll through a list of these:
testbutton.png
but I don't know what I'd even do to start making such a thing.

Maou Zenigame
Regular
Posts: 66
Joined: Thu Nov 09, 2017 3:09 am
Contact:

Re: Trying to make a scrolling menu within a screen

#5 Post by Maou Zenigame »

Bumping for help.

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Trying to make a scrolling menu within a screen

#6 Post by isobellesophia »

Could you be specific? I mean.. i am bad at english so... you mean you wanted a scrolling menu inside of the textbutton itself right?
I am a friendly user, please respect and have a good day.


Image

Image


Maou Zenigame
Regular
Posts: 66
Joined: Thu Nov 09, 2017 3:09 am
Contact:

Re: Trying to make a scrolling menu within a screen

#7 Post by Maou Zenigame »

Where I want the active area of the screen to be is in the red rectangle here:
extrascreenb.png
There, I want to have a scrollable list of imagebuttons that link to certain parts of the script.

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

Re: Trying to make a scrolling menu within a screen

#8 Post by Imperf3kt »

You want to use either a viewport, or a vpgrid.
https://www.renpy.org/doc/html/screens.html#viewport
There is an included example at the end of the section. Try that and see how it goes. If you need further help, I can probably be more specific soon (™)
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

Maou Zenigame
Regular
Posts: 66
Joined: Thu Nov 09, 2017 3:09 am
Contact:

Re: Trying to make a scrolling menu within a screen

#9 Post by Maou Zenigame »

This is the code that I have right now.

Code: Select all

screen nicosensei():
    tag menu
    imagemap:
        ground "gui/Extra/nicosensei_bg.png"
        idle "gui/Extra/nicosensei_idle.png"
        hover "gui/Extra/nicosensei_hover.png"
        
        alpha False
        # This is so that everything transparent is invisible to the cursor. 
        
        hotspot (1078, 646, 172, 41) action ShowMenu("extra")

        side "c":
            area (640, 200, 600, 370)

            viewport id "nicomenu":
                scrollbars "verticalr"
                mousewheel True
                arrowkeys True





Like I said before, I know that the way to do what I want involves viewports but I don't know how to get it to work properly.
All this does is create a window with scrollbars, I don't know how to get the imagebuttons within it working or the text on top of it denoting what they're supposed to lead to or how to change the scrollbars or any of that.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 755
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Trying to make a scrolling menu within a screen

#10 Post by Milkymalk »

Code: Select all

            viewport id "nicomenu":
                scrollbars "vertical"
                mousewheel True
                arrowkeys True
                vbox:
                    imagebutton idle "button1.png" action MyAction()
                    imagebutton idle "button2.png" action MyAction()
                    imagebutton idle "button3.png" action MyAction()
                    # and so on
Changing how the scrollbars look is a style thing, I don't have a firm grasp on that myself atm ;)
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

Maou Zenigame
Regular
Posts: 66
Joined: Thu Nov 09, 2017 3:09 am
Contact:

Re: Trying to make a scrolling menu within a screen

#11 Post by Maou Zenigame »

What I have now:

Code: Select all

screen nicosensei():
    tag menu
    imagemap:
        ground "gui/Extra/nicosensei_bg.png"
        idle "gui/Extra/nicosensei_idle.png"
        hover "gui/Extra/nicosensei_hover.png"
        
        alpha False
        # This is so that everything transparent is invisible to the cursor. 
        
        hotspot (1078, 646, 172, 41) action ShowMenu("extra")

        side "c":
            area (640, 200, 600, 370)

            viewport id "nicomenu":
                scrollbars "vertical"
                mousewheel True
                arrowkeys True
                vbox:
                    imagebutton:
                        idle "gui/Extra/extrabox_idle.png"
                        hover "gui/Extra/extrabox_hover.png"
                        action Replay("interlude1")
                    imagebutton:
                        idle "gui/Extra/extrabox_idle.png"
                        hover "gui/Extra/extrabox_hover.png"
                        action Replay("interlude2")
                    imagebutton:
                        idle "gui/Extra/extrabox_idle.png"
                        hover "gui/Extra/extrabox_hover.png"
                        action Replay("interlude3")
My intention was to have the same two image as the hover/idle since it's supposed just be a list of the same imagebutton repeated (in the same way that in-game choices are displayed), but it doesn't seem to want to allow multiple instances of the same image.
And then there's the issue of getting the text in there as well, which I still can't figure out.

Regarding the scrollbar, I already have custom ones replacing the defaults for my history screen so I know I'm going to need to make a new style entirely, but that's something else that I don't know how to get working properly.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 755
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Trying to make a scrolling menu within a screen

#12 Post by Milkymalk »

You can use button instead of imagebutton and layer images and text inside it:

Code: Select all

button:
    add "button.png"
    text "Click Me"
    action MyAction()
    # other button stuff
But then you can't use idle, hover etc.
It IS possible to use an image and text as we see in the choice screens, but that uses styles and I don't really understand how those work.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

Maou Zenigame
Regular
Posts: 66
Joined: Thu Nov 09, 2017 3:09 am
Contact:

Re: Trying to make a scrolling menu within a screen

#13 Post by Maou Zenigame »

Which leads me right back to the problems that I've been having.

So both the buttons themselves and the scrollbar for this screen require me to make custom styles for them, but I don't know how to do so.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 755
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Trying to make a scrolling menu within a screen

#14 Post by Milkymalk »

You can use idle_background, hover_background etc. in a button to set those images.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

Maou Zenigame
Regular
Posts: 66
Joined: Thu Nov 09, 2017 3:09 am
Contact:

Re: Trying to make a scrolling menu within a screen

#15 Post by Maou Zenigame »

Now I have a "button," but only the text is active.
Also, it's still not letting me reuse the images themselves.
notworking.png

Code: Select all

screen nicosensei():
    tag menu
    imagemap:
        ground "gui/Extra/nicosensei_bg.png"
        idle "gui/Extra/nicosensei_idle.png"
        hover "gui/Extra/nicosensei_hover.png"
        
        alpha False
        # This is so that everything transparent is invisible to the cursor. 
        
        hotspot (1078, 646, 172, 41) action ShowMenu("extra")

        side "c":
            area (640, 200, 600, 370)

            viewport id "nicomenu":
                scrollbars "vertical"
                mousewheel True
                arrowkeys True
                vbox:
                    button:
                        idle_background "gui/Extra/extrabox_idle.png"
                        hover_background "gui/Extra/extrabox_hover.png"
                        text "testing 1 2 3"
                        action Replay("interlude1")
                    button:
                        idle_background "gui/Extra/extrabox_idle.png"
                        hover_background "gui/Extra/extrabox_hover.png"
                        text "testing 2 2 3"
                        action Replay("interlude2")
                    button:
                        idle_background "gui/Extra/extrabox_idle.png"
                        hover_background "gui/Extra/extrabox_hover.png"
                        text "testing 3 2 3"
                        action Replay("interlude3")

Post Reply

Who is online

Users browsing this forum: Google [Bot], Ocelot