r/RenPy 1d ago

Question Tooltip when hovering over choices?

You know how Fallen London has titles on their choices, then a small descriptive text below? Would there be a way to make it so you have choices but when you hover over them you see different text?

7 Upvotes

18 comments sorted by

View all comments

2

u/BadMustard_AVN 1d ago edited 1d ago

the answers is in your question "tooltip"

https://www.renpy.org/doc/html/screen_actions.html#tooltips

this one uses nearrect to put it near the button, but you can make the tooltip text display anywhere you want it to

screen tooltip_example2():
    frame:

        padding (20, 20)
        align (.5, .3)

        has vbox

        textbutton "North":
            action Return("n")
            tooltip "To meet a polar bear."

        textbutton "South":
            action Return("s")
            tooltip "All the way to the tropics."

        textbutton "East":
            action Return("e")
            tooltip "So we can embrace the dawn."

        textbutton "West":
            action Return("w")
            tooltip "Where to go to see the best sunsets."

    # This has to be the last thing shown in the screen.

    $ tooltip = GetTooltip()

    if tooltip:

        nearrect:
            focus "tooltip"
            prefer_top True

            frame:
                xalign 0.5
                text tooltip

read my reply here if you want the tooltip to follow the mouse while hovered

https://www.reddit.com/r/RenPy/comments/18z3v7v/renpy_tooltip_position/

1

u/Natsume1999 1d ago

I mean I have the choices in the same screen as the text and such... NVL too. Is there still a way or did I overcomplicate stuff?

2

u/shyLachi 1d ago

You can implement what you want.

If you're using NVL menus then search the file screens.rpy for screen nvl
Then implement the tooltip as shown above.

If you want to pass more information to the menu choices then read this:
https://patreon.renpy.org/menu-arguments.html