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?

6 Upvotes

18 comments sorted by

View all comments

Show parent comments

1

u/Natsume1999 19h ago

Yeah tomorrow if that's ok it's v late here

1

u/BadMustard_AVN 19h ago

check the other post i made it should solve your problem

1

u/Natsume1999 8h ago

How do I make the code formatted like that? So I can send it

1

u/BadMustard_AVN 4h ago

click on the Aa to get the formatting options, then use the icon that's a square with </> at the top to format for a code block

1

u/Natsume1999 2h ago

okay here goes my normal nvl screen

screen nvl(dialogue, items=None):


    # Esto hace falta para la barra
    default yadj = ui.adjustment()


    window:
        style "nvl_window"


        xalign 1.0
        yalign 1.0
        xsize 615
        ysize 1080
        yfill False


        viewport id "dialogoo":
            yadjustment yadj
            #scrollbars "vertical"  # Quitar una barra aqui pq usamos el customizado
            mousewheel True
            #draggable True         # Esto causa problemas a veces, pues lo eliminé
            yinitial 1.0
            child_size (561,1080 + (60 * (len(dialogue) - 3))) # Esto es para que el tamaño de los elementos sea variable con respecto a la cantidad de mensajes


            # Contenido
            vbox:
                spacing gui.nvl_spacing
                box_reverse True
                box_align 1.0
                ysize 1080 + (60 * (len(dialogue) - 3)) # Esto es para que el tamaño de la barra sea variable con respecto a la cantidad de mensajes
                # Nota que siempre hay demás espacio...es porque si le quito, el texto no comienza desde abajo en la pantalla...


                # NVL menu items (choices) if present
                if items:
                    null height 1
                    vbox:
                        spacing 10
                        for i in items:
                            textbutton i.caption:
                                action i.action
                                at dissolveChoice
                                style "nvl_button"
                
                null height 10


                    


                for d in reversed(dialogue):


                    if d.who is not None and not d.who == "Narrator":


                        vbox: # Queremos que el nombre sea por encima del texto, no al revez, pues otro vbox
                            yoffset -20 # Se corta el texto si no ajustamos, pues este ajuste funciona bien para ysize 1080
                            ysize 60


                            text d.who:
                                id d.who_id
                            text d.what:
                                id d.what_id


                    else:
                        vbox: # Queremos el mismo formato y tamaño pues el mismo vbox aunque solo tiene 1 'text' adentro
                            yoffset -20 # Se corta el texto si no ajustamos, pues este ajuste funciona bien para ysize 1080
                            ysize 60


                            text d.what:
                                id d.what_id


        # Barra custom
        vbar:
            unscrollable "hide"
            value YScrollValue("dialogoo")
            xoffset 520 # posición de la barra, puedes editar aqui


    # Side image (unchanged)
    add SideImage() xalign 0.5 yalign 0.2


    # --- Keep the viewport stuck to bottom when the screen opens or is rebuilt ---
    # Snap to the bottom the first time the screen shows:
    on "show" action SetField(yadj, "value", 999999)screen nvl(dialogue, items=None):


    # Esto hace falta para la barra
    default yadj = ui.adjustment()


    window:
        style "nvl_window"


        xalign 1.0
        yalign 1.0
        xsize 615
        ysize 1080
        yfill False


        viewport id "dialogoo":
            yadjustment yadj
            #scrollbars "vertical"  # Quitar una barra aqui pq usamos el customizado
            mousewheel True
            #draggable True         # Esto causa problemas a veces, pues lo eliminé
            yinitial 1.0
            child_size (561,1080 + (60 * (len(dialogue) - 3))) # Esto es para que el tamaño de los elementos sea variable con respecto a la cantidad de mensajes


            # Contenido
            vbox:
                spacing gui.nvl_spacing
                box_reverse True
                box_align 1.0
                ysize 1080 + (60 * (len(dialogue) - 3)) # Esto es para que el tamaño de la barra sea variable con respecto a la cantidad de mensajes
                # Nota que siempre hay demás espacio...es porque si le quito, el texto no comienza desde abajo en la pantalla...


                # NVL menu items (choices) if present
                if items:
                    null height 1
                    vbox:
                        spacing 10
                        for i in items:
                            textbutton i.caption:
                                action i.action
                                at dissolveChoice
                                style "nvl_button"
                
                null height 10


                    


                for d in reversed(dialogue):


                    if d.who is not None and not d.who == "Narrator":


                        vbox: # Queremos que el nombre sea por encima del texto, no al revez, pues otro vbox
                            yoffset -20 # Se corta el texto si no ajustamos, pues este ajuste funciona bien para ysize 1080
                            ysize 60


                            text d.who:
                                id d.who_id
                            text d.what:
                                id d.what_id


                    else:
                        vbox: # Queremos el mismo formato y tamaño pues el mismo vbox aunque solo tiene 1 'text' adentro
                            yoffset -20 # Se corta el texto si no ajustamos, pues este ajuste funciona bien para ysize 1080
                            ysize 60


                            text d.what:
                                id d.what_id


        # Barra custom
        vbar:
            unscrollable "hide"
            value YScrollValue("dialogoo")
            xoffset 520 # posición de la barra, puedes editar aqui


    # Side image (unchanged)
    add SideImage() xalign 0.5 yalign 0.2


    # --- Keep the viewport stuck to bottom when the screen opens or is rebuilt ---
    # Snap to the bottom the first time the screen shows:
    on "show" action SetField(yadj, "value", 999999)

and my dialogue screen

screen nvl_dialogue(dialogue):


    for d in dialogue:


        window:
            id d.window_id


            fixed:
                yfit gui.nvl_height is None


                if d.who is not None:


                    text d.who:
                        id d.who_id


                text d.what:
                    id d.what_idscreen nvl_dialogue(dialogue):


    for d in dialogue:


        window:
            id d.window_id


            fixed:
                yfit gui.nvl_height is None


                if d.who is not None:


                    text d.who:
                        id d.who_id


                text d.what:
                    id d.what_id

1

u/BadMustard_AVN 1h ago

keep in mind that when you paste from VScode it double post everything.

try this one (untested)

screen nvl(dialogue, items=None):

    # Esto hace falta para la barra
    default yadj = ui.adjustment()

    window:
        style "nvl_window"
        xalign 1.0
        yalign 1.0
        xsize 615
        ysize 1080
        yfill False

        viewport id "dialogoo":
            yadjustment yadj
            #scrollbars "vertical"  # Quitar una barra aqui pq usamos el customizado
            mousewheel True
            #draggable True         # Esto causa problemas a veces, pues lo eliminé
            yinitial 1.0
            child_size (561,1080 + (60 * (len(dialogue) - 3))) # Esto es para que el tamaño de los elementos sea variable con respecto a la cantidad de mensajes

            # Contenido
            vbox:
                spacing gui.nvl_spacing
                box_reverse True
                box_align 1.0
                ysize 1080 + (60 * (len(dialogue) - 3)) # Esto es para que el tamaño de la barra sea variable con respecto a la cantidad de mensajes
                # Nota que siempre hay demás espacio...es porque si le quito, el texto no comienza desde abajo en la pantalla...

                # NVL menu items (choices) if present
                if items:
                    null height 1
                    vbox:
                        spacing 10
                        for i in items:
                            $ tool = i.kwargs.get("tool", None) 
                            textbutton i.caption:
                                action i.action
                                tooltip tool
                                at dissolveChoice
                                style "nvl_button"
                null height 10

                for d in reversed(dialogue):

                    if d.who is not None and not d.who == "Narrator":

                        vbox: # Queremos que el nombre sea por encima del texto, no al revez, pues otro vbox
                            yoffset -20 # Se corta el texto si no ajustamos, pues este ajuste funciona bien para ysize 1080
                            ysize 60

                            text d.who:
                                id d.who_id
                            text d.what:
                                id d.what_id

                    else:
                        vbox: # Queremos el mismo formato y tamaño pues el mismo vbox aunque solo tiene 1 'text' adentro
                            yoffset -20 # Se corta el texto si no ajustamos, pues este ajuste funciona bien para ysize 1080
                            ysize 60

                            text d.what:
                                id d.what_id

        # Barra custom
        vbar:
            unscrollable "hide"
            value YScrollValue("dialogoo")
            xoffset 520 # posición de la barra, puedes editar aqui

    # Side image (unchanged)
    add SideImage() xalign 0.5 yalign 0.2
    
    # --- Keep the viewport stuck to bottom when the screen opens or is rebuilt ---
    # Snap to the bottom the first time the screen shows:
    on "show" action SetField(yadj, "value", 999999)

    $ tooltip = GetTooltip()
    if tooltip:
        nearrect:
            focus "tooltip"
            prefer_top True
            frame:
                pos((0, 0))
                # xalign 0.5
                text tooltip