Ren'Py Dual-Tooltips

Khelben

New Member
Dec 8, 2018
5
0
Hi guys. I think this is my first post in the forums, or close-to, anyways (I've had an account for a while and lurked periodically though).
So I've been working on a game for a while now, and I'm trying to code up the map screen.

I've got my map pins showing, The tooltips pop up (both the text one and the image one), but I've hit two snags I'm trying to iron out.

  1. The text-tooltip background - I thought I had it set to tile my seamless texture I made, but its stretching instead and I'm not sure why. [Fixed, Updated the snippet]
  2. How can I communicate the id of the image for the map locale so I can get a different image to display for each location?
Here's the current tooltip code snippet.

Code:
    $ tooltip = GetTooltip()

    if tooltip:

        nearrect:
            focus "tooltip"
            prefer_top False

            frame:
                background Frame("images/gui/frame.png", 32, 32, tile="integer")*
                xalign 0.5
                left_padding 32 right_padding 32
                text tooltip
              
        nearrect:
            focus "tooltip"
            prefer_top True

            frame:
                background Solid("#0000")
                yoffset 12
                xalign 0.5
                left_padding 0 right_padding 0
                add "images/maps/map_pins/pin_18.png" yalign 1.0 xalign 0.5 zoom 0.20
Thanks if you have any suggestions on how to resolve this issue, or a better approach I might take.

1687427768847.png
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,172
The text-tooltip background - I thought I had it set to tile my seamless texture I made, but its stretching instead and I'm not sure why.
Well, it's titled... There's clearly six tiles, one for each corner, and two in the middle.
Then when the text is added, the corners are kept as it, as asked by the parameters, while the inside is stretched, as asked by the Frame behavior.

Keep your border, use it on a 22x22 image, with a 100% transparency outside and a 50% transparency (over whatever color you want) inside. It will give you a way better result than your current attempt, and will works 100% of the time.


How can I communicate the id of the image for the map locale so I can get a different image to display for each location?
I know it's not obvious, especially with the code example, but when the doc say that " ", it really mean value.

Therefore:
tooltip ( "Breuvagerie.", "map/icon/breuvagerie.png" )

then:
Python:
    [...]
            frame:
                [...]
                text tooltip[0]
    [...]
            frame:
                [...]
                add tooltop[1]
 

Khelben

New Member
Dec 8, 2018
5
0
Well, it's titled... There's clearly six tiles, one for each corner, and two in the middle.
Then when the text is added, the corners are kept as it, as asked by the parameters, while the inside is stretched, as asked by the Frame behavior.

Keep your border, use it on a 22x22 image, with a 100% transparency outside and a 50% transparency (over whatever color you want) inside. It will give you a way better result than your current attempt, and will works 100% of the time.
I figured out the fix. I needed to explicitly name the 'tile' property, not just list them in order, and then it started behaving as expected. I will try your approach if I have any other issues with it and will post updates with what it looks like soon.



I know it's not obvious, especially with the code example, but when the doc say that " ", it really mean value.

Therefore:
tooltip ( "Breuvagerie.", "map/icon/breuvagerie.png" )

then:
Python:
    [...]
            frame:
                [...]
                text tooltip[0]
    [...]
            frame:
                [...]
                add tooltop[1]
Oh WOW! It never occurred to me that I could do that. That's perfect. Thanks! I'll implement that fix right away. I look forward to having the scene preview images pop up correctly. Thanks a ton!