[Solved] How to change the keymap for save and load screen?

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
User avatar
Lockvia
Regular
Posts: 124
Joined: Wed Mar 26, 2014 8:02 pm
Projects: Prank Masters
Organization: Lockvia Studios
Tumblr: Lockvia
Deviantart: Lockvia
Location: Australia
Contact:

[Solved] How to change the keymap for save and load screen?

#1 Post by Lockvia » Sat Oct 04, 2014 9:13 am

Just wondering but is it possible to have a keymap for the save and load screen? I tried the code below, in options but it didn't work. Is the 'save' and 'load' parts in the code incorrect?

Code: Select all

config.keymap['save'] = ['s']
config.keymap['load'] = ['l']
Last edited by Lockvia on Sun Nov 08, 2015 7:58 pm, edited 2 times in total.
Image

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Keymap for Save and Load

#2 Post by Alex » Sat Oct 04, 2014 10:47 am

If you need to show those screens by pressing keys, you can make a screen and set "ShowMenu" actions for the keys.
http://www.renpy.org/doc/html/screens.html#key

User avatar
Lockvia
Regular
Posts: 124
Joined: Wed Mar 26, 2014 8:02 pm
Projects: Prank Masters
Organization: Lockvia Studios
Tumblr: Lockvia
Deviantart: Lockvia
Location: Australia
Contact:

Re: Keymap for Save and Load

#3 Post by Lockvia » Sat Oct 04, 2014 8:20 pm

This is what I have at the moment. Is there suppose to be some kind of other code I'm suppose to add in order for this code to work? It's not working at the moment.

Code: Select all

screen keymap_screen():
        key "s" action ShowMenu('save')
        key "l" action ShowMenu('load')
Image

User avatar
Lockvia
Regular
Posts: 124
Joined: Wed Mar 26, 2014 8:02 pm
Projects: Prank Masters
Organization: Lockvia Studios
Tumblr: Lockvia
Deviantart: Lockvia
Location: Australia
Contact:

Re: Keymap for Save and Load

#4 Post by Lockvia » Sat Oct 04, 2014 9:33 pm

Okay I finally got it working.

Firstly I indent the first part too much, so it should be something like this:

Code: Select all

screen keymap_screen:
    key "s" action ShowMenu('save')
    key "l" action ShowMenu('load')
And I looked around and I'm suppose to add this code just after start, so it should look like this in the end.

Code: Select all

label start:
    show screen keymap_screen
Image

User avatar
Lockvia
Regular
Posts: 124
Joined: Wed Mar 26, 2014 8:02 pm
Projects: Prank Masters
Organization: Lockvia Studios
Tumblr: Lockvia
Deviantart: Lockvia
Location: Australia
Contact:

Re: Keymap for Save and Load

#5 Post by Lockvia » Sat Oct 04, 2014 10:32 pm

I noticed that when you use this method and press 's' again the screen doesn't go back to the game. Is there a way to make keymap work in a way that when you press it for the second time it would return to the normal game play?
Image

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Keymap for Save and Load

#6 Post by Alex » Sun Oct 05, 2014 6:56 am

You need to set the "Return" actions for that keys and add it to the load and save screens (in screens.rpy), like

Code: Select all

screen save:
    tag menu
    key "s" action Return()
    use navigation
    use file_picker

screen load:
    tag menu
    key "l" action Return()
    use navigation
    use file_picker

User avatar
Lockvia
Regular
Posts: 124
Joined: Wed Mar 26, 2014 8:02 pm
Projects: Prank Masters
Organization: Lockvia Studios
Tumblr: Lockvia
Deviantart: Lockvia
Location: Australia
Contact:

Re: Keymap for Save and Load

#7 Post by Lockvia » Sun Oct 05, 2014 7:41 am

Thank you so much! It worked!
Image

Post Reply

Who is online

Users browsing this forum: Bing [Bot]