How to make keymap for Return()

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
yoyuchi
Regular
Posts: 58
Joined: Sat Jul 09, 2022 1:39 pm
Contact:

How to make keymap for Return()

#1 Post by yoyuchi » Mon Aug 08, 2022 2:23 am

Hi everyone, I want to make a keymap that returns to game from preference or backlog.
It is used as "action return()" for button command, but how can it be used in keymap?
It was also not found in the default keymap of Renpy.

Code: Select all

init python:
    config.keymap['hide_windows'].append('mouseup_3')
    config.keymap['Return()'].append('K_ESCAPE')
I tried this way, but there was an error occurred. How do I fix it?
Thank you for any advice.

User avatar
enaielei
Regular
Posts: 114
Joined: Fri Sep 17, 2021 2:09 am
Tumblr: enaielei
Deviantart: enaielei
Github: enaielei
Skype: enaielei
Soundcloud: enaielei
itch: enaielei
Discord: enaielei#7487
Contact:

Re: How to make keymap for Return()

#2 Post by enaielei » Mon Aug 08, 2022 3:02 am

If you're talkng about launching the game menu while in game its already like that by default.
In the docs, this part defines that by default.

Code: Select all

game_menu = [ 'K_ESCAPE', 'K_MENU', 'K_PAUSE', 'mouseup_3']
The best way to customize the screen to launch when escape key is pressed is to use the store variable _game_menu_screen.

Code: Select all

default _game_menu_screen = "screen_name"

yoyuchi
Regular
Posts: 58
Joined: Sat Jul 09, 2022 1:39 pm
Contact:

Re: How to make keymap for Return()

#3 Post by yoyuchi » Mon Aug 08, 2022 3:57 am

enaielei wrote:
Mon Aug 08, 2022 3:02 am
If you're talkng about launching the game menu while in game its already like that by default.
In the docs, this part defines that by default.

Code: Select all

game_menu = [ 'K_ESCAPE', 'K_MENU', 'K_PAUSE', 'mouseup_3']
The best way to customize the screen to launch when escape key is pressed is to use the store variable _game_menu_screen.

Code: Select all

default _game_menu_screen = "screen_name"
Thanks for reply.
As you mentioned, esc had the function of return() by default.
However, when ESC was pressed in the game, there was a problem that it became a save menu screen, so I modified it like "game_menu = ['K_MENU', 'K_PAUSE', 'mouseup_3']".
Is there any way to make esc have only the function of return()?

yoyuchi
Regular
Posts: 58
Joined: Sat Jul 09, 2022 1:39 pm
Contact:

Re: How to make keymap for Return()

#4 Post by yoyuchi » Mon Aug 08, 2022 4:33 am

yoyuchi wrote:
Mon Aug 08, 2022 3:57 am
enaielei wrote:
Mon Aug 08, 2022 3:02 am
If you're talkng about launching the game menu while in game its already like that by default.
In the docs, this part defines that by default.

Code: Select all

game_menu = [ 'K_ESCAPE', 'K_MENU', 'K_PAUSE', 'mouseup_3']
The best way to customize the screen to launch when escape key is pressed is to use the store variable _game_menu_screen.

Code: Select all

default _game_menu_screen = "screen_name"
Thanks for reply.
As you mentioned, esc had the function of return() by default.
However, when ESC was pressed in the game, there was a problem that it became a save menu screen, so I modified it like "game_menu = ['K_MENU', 'K_PAUSE', 'mouseup_3']".
Is there any way to make esc have only the function of return()?
At the end of each menu, key "K_ESCAPE" action Return() was attached and resolved. Thank you.

Post Reply

Who is online

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