Tooltip Being Overwritten?

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
vitriolic_crux
Newbie
Posts: 23
Joined: Mon May 13, 2019 11:24 pm
Contact:

Tooltip Being Overwritten?

#1 Post by vitriolic_crux »

Having some more troubles with tooltips. The code below generates imagebuttons based on the contents of the list in halls. However, it seems like the tooltip for each button is being overwritten by the last imagebutton to be created. So if I have four items in halls, then four buttons are created, the tooltips for each button are all set to the tooltip being generated for the fourth item.

Code: Select all

screen master_overlay():
        $ halls = Amerigo.getConnections()
        $ toolTip = GetTooltip()

        zorder 50
        modal False
        frame: # Information Display Panel, LHS
            background "hud_leftbar.png"
            xsize 120
            ysize 1080
            viewport:
                xoffset 5
                yoffset 120
                vbox:
                    yalign 0.5
                    spacing 40
                    if menu_access:
                        for hall in halls:
                            python:
                                caption = ""
                                connection = hall[0]
                                caption = Amerigo.getDisplayName(name=connection)
                            fixed:
                                xalign 0.5
                                xsize 100
                                ysize 100
                                imagebutton:
                                    focus_mask True
                                    action [Function(Amerigo.moveTo, roomName=hall[0]), Jump('overworld')]
                                    tooltip "move [hall[0]], [hall[1]]"
                                    idle "panel_action_button.png"
                                    hover "panel_action_button_hovered.png"
                                text caption:
                                    xalign 0.5
                                    yalign 0.5
                                    style "movement_button_text"

        if toolTip:
            textbutton toolTip:
                text_style "interaction_text"
                xalign 0.5
                yalign 0.25
I'm attempting to parse the tooltip for each button so that each tip can have a different effect, but I'm unable to do this as each button's tooltip is being set to the same unicode string. So I need to know how to make every tooltip unique to each button. Strangely enough, the actions of the buttons are all working as intended.

As a side question, can anyone tell me why I'm unable to convert a slice of the tooltip to an int? The slice comes back as type 'unicode', and even after turning that into a string, using int() still gives me a typeerror.

Post Reply

Who is online

Users browsing this forum: Google [Bot]