How to open a custom map with keymap?

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
bloodyhair
Regular
Posts: 61
Joined: Tue Aug 11, 2015 7:20 am
Deviantart: Takada-Wang
Contact:

How to open a custom map with keymap?

#1 Post by bloodyhair »

I wonder if there is any way to assign a custom map/page with keymap? For example if I am clicking "x" button then I would go to "Character Profile" page or such.

Thank you very much ><

User avatar
mobychan
Veteran
Posts: 275
Joined: Fri Apr 24, 2015 6:31 am
Projects: The Chosen - Sakura Pink & Gentian Blue
Organization: Foresoft
Location: Germany
Contact:

Re: How to open a custom map with keymap?

#2 Post by mobychan »

Simply define the key to react in a screen:
http://www.renpy.org/doc/html/screens.html#key

User avatar
bloodyhair
Regular
Posts: 61
Joined: Tue Aug 11, 2015 7:20 am
Deviantart: Takada-Wang
Contact:

Re: How to open a custom map with keymap?

#3 Post by bloodyhair »

Hmm I tried it with a code like this:

Code: Select all

init:
    $ show_quick_menu = True
    
    screen keymap_screen():
        key "hidden_quickmenu" action ShowMenu ("hidden_quickmenu")

init python:
    config.keymap['hidden_quickmenu'].append('K_RIGHT')
and in my quick menu script it was shown like this:

Code: Select all

screen hidden_quickmenu():
      
    window:
        style "nvl_window"
                        
    imagebutton auto "images/MAIN MENU SCREEN/mm_back_%s.png" xpos 850 ypos 500 focus_mask True action [Play ("Main_Menu", "sounds/sfx/GUI_Clicked.mp3"), ShowMenu("extra")] hovered [Play ("Main_Menu", "sounds/sfx/GUI_hovered.mp3")]        
however, I still getting a failing message like this:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 39, in <module>
    config.keymap['hidden_quickmenu'].append('K_RIGHT')
KeyError: 'hidden_quickmenu'

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "lib/windows-i686/script.rpyc", line 14, in script
  File "D:\Software\RenPy\renpy-6.99.6-sdk\renpy\ast.py", line 797, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "D:\Software\RenPy\renpy-6.99.6-sdk\renpy\python.py", line 1448, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/script.rpy", line 39, in <module>
    config.keymap['hidden_quickmenu'].append('K_RIGHT')
KeyError: 'hidden_quickmenu'

Windows-7-6.1.7600
Ren'Py 6.99.6.739
The_Eden_of_Mars 0.0
I wonder, where did I do wrong?

Post Reply

Who is online

Users browsing this forum: No registered users