How do I disable key focusing on quick menu?

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.
Post Reply
Message
Author
HyDrone
Newbie
Posts: 12
Joined: Tue Apr 10, 2018 12:38 am
Contact:

How do I disable key focusing on quick menu?

#1 Post by HyDrone »

I'm using left and right on the keyboard to move back and forward in my project. For this build, I would like to disable access to the quick menu via arrow keys, primarily so that the quick menu won't be focused by accident, which would make the user have to click more than once in order to advance. How should I do that? I've been browsing the scripts, and all of relevance I've found so far are key bindings and the text that controls which functions appear in the quick menu.

* (A better system that allows the user to switch between forward/back mode and quick menu mode is planned for later, but I'm making a demo, and there would be no need to have quick access for configurations/saves anyway, so for now I'd just prefer to limit the access for simplicity.)

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: How do I disable key focusing on quick menu?

#2 Post by kivik »

Check out this page: https://www.renpy.org/doc/html/keymap.html

There's an example of how to add and remove keys to an event, but let us know if you get stuck :)

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: How do I disable key focusing on quick menu?

#3 Post by Remix »

Find the screen in screens.rpy and amend the buttons to include the attribute:

keyboard_focus - False

Code: Select all

    textbutton _("Q.Save") action QuickSave() keyboard_focus False
It also might be possible (and easier) to add it to the quick_button style
Frameworks & Scriptlets:

HyDrone
Newbie
Posts: 12
Joined: Tue Apr 10, 2018 12:38 am
Contact:

Re: How do I disable key focusing on quick menu?

#4 Post by HyDrone »

Thank you both!

kivk: I went with

Code: Select all

    $config.keymap['focus_up'].remove('K_UP')
    $config.keymap['focus_up'].remove('repeat_K_UP')
for all directions, and that seems to work well, though it would be even better if I could still allow the movement in the main menu.

Remix: I tried that method. It works almost, but not quite. It looks like it prevents individual buttons from being selectable among one another, but it doesn't prevent the quick menu itself from being selected, so the leftmost button could still be focused (at least that's how it seems when I tried with different numbers of buttons and the style method).

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: How do I disable key focusing on quick menu?

#5 Post by PyTom »

For the record; don't do this. The keyboard is necessary for accessibility for players that can't reliably use a mouse.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot]