Tooltip help

mickydoo

Fudged it again.
Game Developer
Jan 5, 2018
2,446
3,557
Python:
if talk:
            imagebutton:
                idle "icons/talk_button.webp"
                hover "icons/talk_button.webp"
                xalign 0.83
                yalign 0.95
                tooltip "Talk"
                action Jump ("girl")

            $ tooltip = GetTooltip()
            if tooltip:
                text "[tooltip]":
                    xanchor 0.5
                    xalign 0.9
                    yalign 0.95



        if wink:
            imagebutton:
                idle "icons/wink_button.webp"
                hover "icons/wink_button.webp"
                xalign 0.9
                yalign 0.95
                tooltip "Smart Arse"
                action Jump ("girl")

            $ tooltip = GetTooltip()
            if tooltip:
                text "[tooltip]":
                    xanchor 0.5
                    xalign 0.84
                    yalign 0.98
That brings up both the "Talk and "Smart Arse at there respective locations at the same time.

Python:
if talk:
            imagebutton:
                idle "icons/talk_button.webp"
                hover "icons/talk_button.webp"
                xalign 0.83
                yalign 0.95
                tooltip "Talk"
                action Jump ("girl")

            



        if wink:
            imagebutton:
                idle "icons/wink_button.webp"
                hover "icons/wink_button.webp"
                xalign 0.9
                yalign 0.95
                tooltip "Smart Arse"
                action Jump ("girl")

            $ tooltip = GetTooltip()
            if tooltip:
                text "[tooltip]":
                    xanchor 0.5
                    xalign 0.84
                    yalign 0.98
That brings "Talk" and "Smart Arse" individually but in the same postion.

Basically I have an image buttons, when you hover over them I want the tooltip associated with it to show under each separate image button. How do I get this to happen.
 

mickydoo

Fudged it again.
Game Developer
Jan 5, 2018
2,446
3,557
This hack does work
tooltip "{alpha=0}xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx{/alpha}Talk"

And using different amounts invisible text for each button across the bottom, but there must be a pro way?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,957
16,190
Basically I have an image buttons, when you hover over them I want the tooltip associated with it to show under each separate image button. How do I get this to happen.
I haven't played with it yet, nor even tested to be honest, but the 7.5.x/8.0.x branch added a "what happened to KiSS" bunch of statements to the script language that more or less focus on this kind of thing. Among them, that is supposed to do what you want.

Now that this is said, and once you'll come back to your sense after having took a look at the example in the doc, there's other way to do. Less automatic than nearrect, but way easier.
Everything rely on the fact that tooltip expect a value, whatever value. Therefore, you just pass the position of the tooltip in the same time that its value:
Code:
if talk:
    imagebutton:
        idle "icons/talk_button.webp"
        hover "icons/talk_button.webp"
        xalign 0.83
        yalign 0.95
        tooltip ( "Talk", 0.83, 0.98 )
        action Jump ("girl")

if wink:
    imagebutton:
        idle "icons/wink_button.webp"
        hover "icons/wink_button.webp"
        xalign 0.9
        yalign 0.95
        tooltip ( "Smart Arse", 0.9, 0.98 )
        action Jump ("girl")

$ tooltip = GetTooltip()
if tooltip:
    text "[tooltip[0]]":
        xalign tooltip[1]
        yalign tooltip[2]

Side note:

I removed the xanchor. It update the position of the displayable, what have near to no interest when you can directly give a position to the said displayable.

When you use:
Code:
xanchor 0.5
xalign 0.84
yalign 0.98
You ask Ren'Py to position the displayable at 84% x and 98% y, then to change the x position by 50% of the displayable width. Using:
Code:
xalign 0.88
yalign 0.98
instead would have the same result.
At least, assuming that here 50% of the displayable width correspond to 4% of the screen width.
 

mickydoo

Fudged it again.
Game Developer
Jan 5, 2018
2,446
3,557
I haven't played with it yet, nor even tested to be honest, but the 7.5.x/8.0.x branch added a "what happened to KiSS" bunch of statements to the script language that more or less focus on this kind of thing. Among them, that is supposed to do what you want.

Now that this is said, and once you'll come back to your sense after having took a look at the example in the doc, there's other way to do. Less automatic than nearrect, but way easier.
Everything rely on the fact that tooltip expect a value, whatever value. Therefore, you just pass the position of the tooltip in the same time that its value:
Code:
if talk:
    imagebutton:
        idle "icons/talk_button.webp"
        hover "icons/talk_button.webp"
        xalign 0.83
        yalign 0.95
        tooltip ( "Talk", 0.83, 0.98 )
        action Jump ("girl")

if wink:
    imagebutton:
        idle "icons/wink_button.webp"
        hover "icons/wink_button.webp"
        xalign 0.9
        yalign 0.95
        tooltip ( "Smart Arse", 0.9, 0.98 )
        action Jump ("girl")

$ tooltip = GetTooltip()
if tooltip:
    text "[tooltip[0]]":
        xalign tooltip[1]
        yalign tooltip[2]

Side note:

I removed the xanchor. It update the position of the displayable, what have near to no interest when you can directly give a position to the said displayable.

When you use:
Code:
xanchor 0.5
xalign 0.84
yalign 0.98
You ask Ren'Py to position the displayable at 84% x and 98% y, then to change the x position by 50% of the displayable width. Using:
Code:
xalign 0.88
yalign 0.98
instead would have the same result.
At least, assuming that here 50% of the displayable width correspond to 4% of the screen width.
You are brilliant, works like a charm, thank you very kindly