Page 1 of 1

Trying to remove config.keymap and getting error

Posted: Thu May 04, 2023 10:37 am
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.

Re: Trying to remove config.keymap and getting error

Posted: Sat May 06, 2023 7:50 pm
by PyTom
The keymap has changed, so you need to check that a value is in it before you remove that value.

Re: Trying to remove config.keymap and getting error

Posted: Mon May 08, 2023 4:18 am
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.