Trying to remove config.keymap and getting error

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Trying to remove config.keymap and getting error

#1 Post by Kinmoku »

Hi all,

I've had this issue for a while when I updated to Renpy 7.5. I've just tried again, with Renpy 7.6 preview and unforunately these keymaps still cause an error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/0init.rpy", line 1330, in script
    $ config.keymap['rollback'].remove('K_PAGEUP') ### renpy update didn't like these until below... unmute eventually
  File "game/0init.rpy", line 1330, in <module>
    $ config.keymap['rollback'].remove('K_PAGEUP') ### renpy update didn't like these until below... unmute eventually
  File "renpy/common/00keymap.rpy", line 28, in remove
    _list.remove(self, a)
ValueError: list.remove(x): x not in list

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

Full traceback:
  File "game/0init.rpy", line 1330, in script
    $ config.keymap['rollback'].remove('K_PAGEUP') ### renpy update didn't like these until below... unmute eventually
  File "/Applications/renpy-7.5.3-sdk/renpy/ast.py", line 1138, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "/Applications/renpy-7.5.3-sdk/renpy/python.py", line 1122, in py_exec_bytecode
    exec(bytecode, globals, locals)
  File "game/0init.rpy", line 1330, in <module>
    $ config.keymap['rollback'].remove('K_PAGEUP') ### renpy update didn't like these until below... unmute eventually
  File "renpy/common/00keymap.rpy", line 28, in remove
    _list.remove(self, a)
ValueError: list.remove(x): x not in list

Darwin-20.6.0-x86_64-i386-64bit x86_64
Ren'Py 7.6.0.23042213
These are what I'm trying to remove (currently muted so I can load the game):

Code: Select all

    #$ config.keymap['rollback'].remove('K_PAGEUP')
    #$ config.keymap['rollback'].remove('repeat_K_PAGEUP')
    #$ config.keymap['rollforward'].remove('K_PAGEDOWN')
    #$ config.keymap['rollforward'].remove('repeat_K_PAGEDOWN')
    #$ config.keymap['hide_windows'].remove('h')
Maybe I am using old code, as it worked before I updated to 7.5, but these removals below work no problem with any Renpy version:

Code: Select all

init:
    $ config.keymap['toggle_skip'].remove('K_TAB')
    $ config.keymap['skip'].remove('K_LCTRL')
    $ config.keymap['skip'].remove('K_RCTRL')
    $ config.keymap['hide_windows'].remove('mouseup_2')
    $ config.keymap['hide_windows'].remove('noshift_K_h')
I hope this is the right place to post this! Thanks for your time.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
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: Trying to remove config.keymap and getting error

#2 Post by PyTom »

The keymap has changed, so you need to check that a value is in it before you remove that value.
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

User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: Trying to remove config.keymap and getting error

#3 Post by Kinmoku »

PyTom wrote: Sat May 06, 2023 7:50 pm The keymap has changed, so you need to check that a value is in it before you remove that value.
When I check the documentation, it says these are still here as of version 8.0.2: https://www.renpy.org/doc/html/keymap.html

Unless this is different for Ren'Py 7.5/7.6, I think it's out of date when I compare it to renpy/common/00keymap.rpy.

Anyway, thanks for pointing me in the right direction. I have it working now.

Post Reply

Who is online

Users browsing this forum: No registered users