CREATE YOUR AI CUM SLUT ON CANDY.AI TRY FOR FREE
x

Ren'Py [SOLVED] Help with using tooltips

SPkiller31

Professional Degenerate
Game Developer
Dec 20, 2020
145
203
Hi,

I'm trying to change choice menus when visiting characters with icons that will show whether or not that character has new content.
I think that the best option is using Tooltips/Nearrect for that but I'm kinda dumb.
(I suspect it's something obvious that I've missed but the tooltip section for Renpy looks a bit barebones without different scenario examples.)

What I'm trying to achieve: I have few imagebuttons, in this case: doors, leading to 5 different rooms and when hovered each would display two character icons.
Each character has either an their icon AND exclamation mark or just their icon depending on if there's new content for them. So displayed png changes depending on the state of where player is in the game.

+/- Example of what I mean(The same imagebutton, leading to the exact same place, tooltip changing depending on player progression):
Python:
if test_flag1 == False:
    imagebutton xalign 0.5 yalign 0.5:
        focus_mask True
        idle "door1_idle"
        hover "door1_hover"
        tooltip (#Value here)                               
        action Jump("room1")#Leads to label that divides to  character 1 or 2, not sure if there's way to display choice menu with imagebutton
        $ tt = GetTooltip()
        if tt:
               add "images/character1_exclamation.png" xpos 300 ypos 100
               add "images/character2.exclamation.png" xpos 300 ypos 350
#For pure example, both characters have new content because of the same flag
#Because of that, I display version of their icons with "!" sign added
else:
    imagebutton xalign 0.5 yalign 0.5:
        focus_mask True
        idle "door1_idle"
        hover "door1_hover"
        tooltip (#Value here)                               
        action Jump("room1") #Same way, leads to the label that checks flag and lets the player choose who to visit
        $ tt = GetTooltip()
        if tt:
               #In this case I want characters to have basic icon as there's nothing new to see, something like:
               #add "images/character1.png" xpos 300 ypos 350
               #add "images/character2.png" xpos 300 ypos 350
####################
#Another imagebutton at different location, depending on different flags
####################

I'm having problems when trying to add more flags and rooms that use tooltips the same way, at the same time.
(Different imagebuttons at a different position would need tooltips to be shown next to that door, not at the set pos.)

AFAIK I can't define multiple variables that way, like: $ tt_1, $ tt_2 etc. or put multiple tooltips inside single imagebutton.
I probably don't understand the basics but I'm not sure how to display multiple tooltips that would depend on different flags as currently, every icon gets copied and shows the same thing.
Given the fact that there'll be multiple doors, that will check for both characters and their variables, I'm trying to make as little mess in code as possible as there'll be a lot of text.

I know that there are at least 2 braindead workarounds: Either using "hovered" or creating a "hover" version of imagebutton with every outcome possible: Door with icon, door with icon and "!" baked into png etc. but that would be quite ugly code-wise and require a ton of if/else.

Big thanks if someone knows the most elegant solution and is willing to explain it like talking to a toddler.
 
Last edited:

gojira667

Member
Sep 9, 2019
327
324
The choice screen is a . Style it to your heart's desire, extend as applicable, but it needs to handle all the menu statements in your script. I.E. Just call a custom screen and leave choice alone. Particularly as your example action doesn't work as expected with menu.

The other problem is you don't show any of the state machine code you are using. That will be 90% of your screen code. Then it will be simple enough to limit showing them only when hovering on a button. This AON post actually closely details what you need. Just ignore the overlay part as you will be using a regular screen.

As far as answering the question you asked, tuples. tooltip returns the value and you can make the value what you like (mostly). Have another AON post. ;)
 
  • Heart
Reactions: SPkiller31

SPkiller31

Professional Degenerate
Game Developer
Dec 20, 2020
145
203
As far as answering the question you asked, tuples. tooltip returns the value and you can make the value what you like (mostly). Have another AON post. ;)
Hi, thanks a lot for the comment. I solved the issue some time ago by learning the basics with the examples from Jnx's version of that he sent me but AON's posts also saved me hours of struggling. (I needed a visual example for my brain to start braining)

I also wanted a quick solution to troubleshoot later parts of my game without jumping back and forth in labels. I'll leave the link in case someone's might find it useful and set the post to solved.
 
  • Hey there
Reactions: gojira667