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.
I'm working on a very hotspot-heavy project (basically, where vbox work would kind of be impossible) and my biggest problem is that an empty button hangs around when one of the hotspots is not selected. I'm sure there's a proper way to do this with a combo of "unhover" and "Hide," but all my searches have led to a lot of archaic info and elements that contradict my current setup. I'm hoping I don't have to redo all of them (cue silent screaming face) but if I have a handle on what I'm doing, I'm good with that.
#### Character Select ####
screen port_int_imagemap:
default tt = Tooltip("")
default x = 500 # add three lines to get mouse position
default y = 400
$ x,y = renpy.get_mouse_pos()
imagemap:
ground "images/backgrounds/WaitingRoom_Base_Ground_Frame.png"
hover "images/backgrounds/WaitingRoom_Base_Hover_Frame.png"
hotspot (1235, 10, 170, 330) clicked Return("Thief") hover_sound "audio/sounds/_menu_over2.wav" activate_sound "audio/sounds/_menu_over.wav" hovered tt.Action("Confident Thief") unhovered tt.Action("")
hotspot (875, 375, 445, 690) clicked Return("Traveler") hover_sound "audio/sounds/_menu_over2.wav" activate_sound "audio/sounds/_menu_over.wav" hovered tt.Action("Weary Traveler") unhovered tt.Action("")
hotspot (490, 175, 230, 345) clicked Return("Scientist") hover_sound "audio/sounds/_menu_over2.wav" activate_sound "audio/sounds/_menu_over.wav" hovered tt.Action("Scared Scientist") unhovered tt.Action("")
frame:
pos(x, y) # this positions the frame at the mouse position - you can adjust by using x + 10 or whatever to fine tune.
xsize 160 # just made the width 50 so you could see how the frame being small makes the text wrap. Add more styles to the frame as necessary
text tt.value # style text as necessary
May I suggest using "imagebutton" or "button" instead of "imagemap"? it will make your work much easier and you can give the buttons absolute positions the same way you position the hotspots
AnnieDB wrote: ↑Sat Nov 30, 2019 4:32 pm
I'm working on a very hotspot-heavy project (basically, where vbox work would kind of be impossible) and my biggest problem is that an empty button hangs around when one of the hotspots is not selected. I'm sure there's a proper way to do this with a combo of "unhover" and "Hide," but all my searches have led to a lot of archaic info and elements that contradict my current setup. I'm hoping I don't have to redo all of them (cue silent screaming face) but if I have a handle on what I'm doing, I'm good with that.
#### Character Select ####
screen port_int_imagemap:
default tt = Tooltip("")
default x = 500 # add three lines to get mouse position
default y = 400
$ x,y = renpy.get_mouse_pos()
imagemap:
ground "images/backgrounds/WaitingRoom_Base_Ground_Frame.png"
hover "images/backgrounds/WaitingRoom_Base_Hover_Frame.png"
hotspot (1235, 10, 170, 330) clicked Return("Thief") hover_sound "audio/sounds/_menu_over2.wav" activate_sound "audio/sounds/_menu_over.wav" hovered tt.Action("Confident Thief") unhovered tt.Action("")
hotspot (875, 375, 445, 690) clicked Return("Traveler") hover_sound "audio/sounds/_menu_over2.wav" activate_sound "audio/sounds/_menu_over.wav" hovered tt.Action("Weary Traveler") unhovered tt.Action("")
hotspot (490, 175, 230, 345) clicked Return("Scientist") hover_sound "audio/sounds/_menu_over2.wav" activate_sound "audio/sounds/_menu_over.wav" hovered tt.Action("Scared Scientist") unhovered tt.Action("")
frame:
pos(x, y) # this positions the frame at the mouse position - you can adjust by using x + 10 or whatever to fine tune.
xsize 160 # just made the width 50 so you could see how the frame being small makes the text wrap. Add more styles to the frame as necessary
text tt.value # style text as necessary
If I understand this correctly the "button" is the frame-element last in the screen code, that is to be background to the tooltip.
If that is so, you could perhaps fix the problem by having the frame not showing when the tooltip don't have any text.