I know clickable actions are easier than the hoverable ones. What I can't figure out is how to make the UI still visible even after I unhover from it.
Basically, this is what I am going for.
1) Show a displayable (top left corner of the screen), indicating the current location I am in. When hovered, it should show other displayables to the side, showing the available exits from that particular location.
2) When I unhover, I need it to keep the other displayables still visible on the screen, so I could choose them. For a certain amount of time, let's say 30s after which it should hide automatically. If I don't, then I won't have any time to click on the other displayables and they simply vanish instantly on unhover.
3) When I hover back on the other displayables, I need the timer to reset (or pause, though reset seems more optimal). If I don't make it so, the displayables simply vanish even when I am hovering over them.
4) When another of the displayable is selected, it needs to update the first displayable, indicating that the room has changed.
This is the idea I am going for. Since I can't get the hovering items to stay on the screen long after I unhover from the displayable, I can't select the other entries at all. This is what I have so far. It's not even doing half the things (or the last thing at the moment currently)
Something of that sort. I know it's all crude atm, I am new to renpy and, haven't coded for a long while as well, much less in python much.
Now someone on discord [Jse] mentioned to use nearrect with Focus screen actions. I am still to read on it, but on first glances the idea of drop down seems very plausible. Which is, kind of or sort of akin to what I am going for only through hovering not clicking, though I guess that's usually the idea with minimaps of this style.
EDIT: My updated code after Feniks/Shawna and hm, HB38, and others I can't recall atm helped me out with it.
Code: Select all
default mm_cli = False # minimap click used
default mm_clia = False # minimap alternate click activated
default mm_sco = False # minimap opened by alternate click
screen MapTest():
text "Just Testing"
hbox xoffset 65 yoffset 65 spacing 20:
if current_location == "StartRoom":
imagebutton:
idle "mapicons/StartRoom_Mini.png"
hovered SetVariable("mm_sco", False), Show("MapTestEx", mm_loc = 1, cli_hov = False)
action SetVariable("mm_cli", True), SetVariable("mm_clia", False), Hide("MapTestEx"), Jump("StartRoom")
if mm_clia:
alternate SetVariable("mm_clia", False), SetVariable("mm_sco", True), Hide("MapTestEx")
else:
alternate SetVariable("mm_clia", True), SetVariable("mm_sco", False)
if mm_cli:
unhovered SetVariable("mm_cli", False)
elif mm_clia:
unhovered Return(None)
elif mm_sco == False:
unhovered Show("MapTestEx", mm_loc = 1, cli_hov = True)
screen MapTestEx(mm_loc = 0 , cli_hov = False):
hbox xoffset 193 yoffset 65:
if mm_loc == 1:
imagebutton:
idle "mapicons/Corridor1_Mini.png"
action SetVariable("current_location", "Corridor1"), Hide("MapTestEx"), Jump("Corridor1")
alternate SetVariable("mm_clia", False), Hide("MapTestEx")
if cli_hov:
timer 3.0 action Hide("MapTestEx")
So it does a couple of things, along with the hovering UI I wanted as well.
In screen MapTest, it shows the current location of the player. Now, hovering on it displays the exits from that room, which is the second screen, MapTestEx.
If I left clicked on MapTest, it says the current location of the player, simultaneously hiding MapTestEx.
If I right clicked on MapTest, it makes MapTestEx visible permanently and doesn't hide it on unhover. Whereas, if I don't do that, it'll hide MapTestEx after 3 seconds. In the prior case, I can hover back again, and right click on it to hide MapTestEx once more.
When it is permanently visible, it can only be hidden back right clicking on either MapTest, or MapTestEx.
If I left clicked on MapTestEx, it'll change the current location while simultaneously hiding MapTestEx. MapTest now shows the new updated location, and MapTestEx will show the exits from that room next.
If I right clicked on MapTestEx, it'll hide MapTestEx.