How can I make the quick-menu remain visible while hovered?
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.
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.
How can I make the quick-menu remain visible while hovered?
Hi everyone.
I have a quick menu which appears when the mouse hovers over the bottom section of the screen and disappears when the mouse exits this area. The code is as follows:
mousearea:
area (0,450, 640, 30)
hovered Show("quick_menu")
unhovered Hide("quick_menu")
This works great, however, when any of the QMenu buttons are clicked, the menu instantly hides itself again. This gets annoying when I want to press 'back' multiple times.
How can I have the menu disappear only when the mouse leaves the area, and not when a button is clicked?
Any suggestion will be greatly appreciated.
I have a quick menu which appears when the mouse hovers over the bottom section of the screen and disappears when the mouse exits this area. The code is as follows:
mousearea:
area (0,450, 640, 30)
hovered Show("quick_menu")
unhovered Hide("quick_menu")
This works great, however, when any of the QMenu buttons are clicked, the menu instantly hides itself again. This gets annoying when I want to press 'back' multiple times.
How can I have the menu disappear only when the mouse leaves the area, and not when a button is clicked?
Any suggestion will be greatly appreciated.
- Amethysts
- Regular
- Posts: 41
- Joined: Thu Aug 23, 2018 1:17 pm
- Projects: Coalescence
- Skype: amethysts-studio
- itch: amethysts
- Contact:
Re: How can I make the quick-menu remain visible while hovered?
In your menu screen write this:
The number will decide on which height will be your screen ! Do it everytime you have several screens displayed Games are often like an onion, with a lot of layers, so you have to do it quite often
Code: Select all
screen your_menu:
zorder 120
Re: How can I make the quick-menu remain visible while hovered?
This is a really nice addition, though it doesn't stop the quick menu from hiding when 'back' is clicked.
- hell_oh_world
- Miko-Class Veteran
- Posts: 777
- Joined: Fri Jul 12, 2019 5:21 am
- Contact:
Re: How can I make the quick-menu remain visible while hovered?
The "back" you are referring to is a button right?
Maybe I have a better workaround. You'll gonna do all of this inside the quick_menu screen in screens.rpy.
Create a local variable first inside the quick_menu screen
Code: Select all
screen quick_menu:
default quick_menu_is_visible = False
Code: Select all
mousearea:
anchor (0.5, 1.0)
pos (0.5, 1.0) # Aligns the mousearea right to the bottom where the default quick menu is positioned
xfill True # Makes the mousearea's width the width of the entire screen
ysize 100 # Height of the mousearea
hovered SetScreenVariable("quick_menu_is_visible", True)
unhovered SetScreenVariable("quick_menu_is_visible", False)
Code: Select all
showif quick_menu_is_visible:
hbox:
// The quick menu buttons go here
- namastaii
- Eileen-Class Veteran
- Posts: 1350
- Joined: Mon Feb 02, 2015 8:35 pm
- Projects: Template Maker for Ren'Py, What Life
- Github: lunalucid
- Skype: Discord: lunalucid#1991
- Soundcloud: LunaLucidMusic
- itch: lunalucid
- Location: USA
- Contact:
Re: How can I make the quick-menu remain visible while hovered?
You should probably have it set up like this (obviously put whatever area numbers you need, this was just for my testing purposes)
and change this variable (found in screens):
Code: Select all
screen quick_menu():
## Ensure this appears on top of other screens.
zorder 100
mousearea:
area (0,1000, 1000, 100)
hovered SetVariable("quick_menu", True)
unhovered SetVariable("quick_menu", False)
if quick_menu:
hbox:
style_prefix "quick"
xalign 0.5
yalign 1.0
textbutton _("Back") action Rollback()
textbutton _("History") action ShowMenu('history')
textbutton _("Skip") action Skip() alternate Skip(fast=True, confirm=True)
textbutton _("Auto") action Preference("auto-forward", "toggle")
textbutton _("Save") action ShowMenu('save')
textbutton _("Q.Save") action QuickSave()
textbutton _("Q.Load") action QuickLoad()
textbutton _("Prefs") action ShowMenu('preferences')
Code: Select all
default quick_menu = False
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- Joined: Fri May 18, 2018 1:02 am
- Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: How can I make the quick-menu remain visible while hovered?
Chococo wrote: ↑Sun Aug 18, 2019 6:24 am
-----
This works great, however, when any of the QMenu buttons are clicked, the menu instantly hides itself again. This gets annoying when I want to press 'back' multiple times.
How can I have the menu disappear only when the mouse leaves the area, and not when a button is clicked?
Any suggestion will be greatly appreciated.
You will probably have to go a different way to solve this problem. Instead of a a mousearea, let's keep checking for the mouse pointers y position and use that to determine if the menu is shown. More of a brute force solution than a mousearea, but that might be what it takes to solve this problem. Mousarea only checks when you are entering or exiting the area, which usually is enough, but probably not for the particular problem you have here.
So in the screen quick_menu(), add this after the zorder line and replacing the 'if quick_menu:'-line
Code: Select all
timer 0.1 action SetVariable("QM", renpy.get_mouse_pos()[1]) repeat True # sets QM to the mouse y-pos every 0.1 second
if QM>450:
You also will need a default QM-line
Code: Select all
default QM = 0
Re: How can I make the quick-menu remain visible while hovered?
I changed the mousearea statement from
to
Which fixed the problem. However, this removes the dissolve transition.
Is there any way to trigger a transition for the hbox inside screen quick_menu(): ?
I tried defining the hbox as another screen, then calling it inside a 'Show' inside the [if quick_menu:], though that wouldn't work.
Code: Select all
mousearea:
area (0,450, 640, 30)
hovered Show("quick_menu", transition=dissolve)
unhovered Hide("quick_menu", transition=dissolve)
Code: Select all
mousearea:
area (0,1000, 1000, 100)
hovered SetVariable("quick_menu", True)
unhovered SetVariable("quick_menu", False)
Is there any way to trigger a transition for the hbox inside screen quick_menu(): ?
I tried defining the hbox as another screen, then calling it inside a 'Show' inside the [if quick_menu:], though that wouldn't work.
- namastaii
- Eileen-Class Veteran
- Posts: 1350
- Joined: Mon Feb 02, 2015 8:35 pm
- Projects: Template Maker for Ren'Py, What Life
- Github: lunalucid
- Skype: Discord: lunalucid#1991
- Soundcloud: LunaLucidMusic
- itch: lunalucid
- Location: USA
- Contact:
Re: How can I make the quick-menu remain visible while hovered?
I asked someone on Discord and they showed me how they have theirs set up. They created a transform (which you could change the events inside to dissolve instead of this)
and then in the quick_menu screen
the things changed were
showif quick_menu:
hbox at quick_menu_appear:
Code: Select all
transform quick_menu_appear:
on show:
alpha 0.0 yalign 1.1
easein 1.0 alpha 1.0 yalign 1.0
on hide:
alpha 1.0 yalign 1.0
easein 1.0 alpha 0.0 yalign 1.1
Code: Select all
screen quick_menu():
mousearea:
area (blah blah blah)
hovered SetVariable("quick_menu", True)
unhovered SetVariable("quick_menu", False)
## Ensure this appears on top of other screens.
zorder 100
showif quick_menu:
hbox at quick_menu_appear:
style_prefix "quick"
xalign 0.5
yalign 1.0
textbutton _("Back") action Rollback()
textbutton _("History") action ShowMenu('history')
textbutton _("Skip") action Skip() alternate Skip(fast=True, confirm=True)
textbutton _("Auto") action Preference("auto-forward", "toggle")
textbutton _("Save") action ShowMenu('save')
textbutton _("Q.Save") action QuickSave()
textbutton _("Q.Load") action QuickLoad()
textbutton _("Prefs") action ShowMenu('preferences')
showif quick_menu:
hbox at quick_menu_appear:
- hell_oh_world
- Miko-Class Veteran
- Posts: 777
- Joined: Fri Jul 12, 2019 5:21 am
- Contact:
Re: How can I make the quick-menu remain visible while hovered?
You should add another action for the transition...Chococo wrote: ↑Mon Aug 26, 2019 1:36 pm I changed the mousearea statement from
toCode: Select all
mousearea: area (0,450, 640, 30) hovered Show("quick_menu", transition=dissolve) unhovered Hide("quick_menu", transition=dissolve)
Which fixed the problem. However, this removes the dissolve transition.Code: Select all
mousearea: area (0,1000, 1000, 100) hovered SetVariable("quick_menu", True) unhovered SetVariable("quick_menu", False)
Is there any way to trigger a transition for the hbox inside screen quick_menu(): ?
I tried defining the hbox as another screen, then calling it inside a 'Show' inside the [if quick_menu:], though that wouldn't work.
Code: Select all
mousearea:
area (0,1000, 1000, 100)
hovered [SetVariable("quick_menu", True), With(dissolve)]
unhovered [SetVariable("quick_menu", False), With(dissolve)]
Who is online
Users browsing this forum: Ocelot