Page 1 of 1

[Solved]Need help changing the default keymap

Posted: Tue Jul 03, 2018 10:37 am
by DannX
So as title says I need to change some keys in the default keymap, more specifically the mousewheel functions, by default it is used for rollback but I'd like to make it so it shows a screen when rolled up, as most visual novels normally do, showing dialogue history screen. I know rollback is an excellent feature unique to Ren'Py, but there is a reason we don't want to use it for the game we're currently developing.

I've read through the documentation at https://www.renpy.org/doc/html/keymap.html but I'm not sure how to add a new function, it seems like they have to be setup somewhere, the keymap dict seems to be made of lists of keybidings already defined, but I see no way to add your own.

For now the only way I've been able to come up with is using a screen like this:

Code: Select all

define config.rollback_enabled = False

screen mousewheel_rebind():

    key 'mousedown_4' action ShowMenu("history")

label start:

	show screen mousewheel_rebind #and never be hidden, hopefully
	
	"The game start here!"
But I'm not sure this screen will be up all the time unless I manually add it to every other screen and every label in the game, wich seems like too much tedious and repetitive work.

Any suggestions?

Re: Need help changing the default keymap

Posted: Tue Jul 03, 2018 6:49 pm
by kivik
Create a new layer using the config variable. Show this screen at the start label, on that specific layer. Then so long as you don't hide this screen, it'll always been there, invisibly, waiting to accept the key input.

Re: Need help changing the default keymap

Posted: Tue Jul 03, 2018 7:17 pm
by Remix
config.overlay_screens.append( "mousewheel_rebind" )
in an init python block

Re: Need help changing the default keymap

Posted: Thu Jul 05, 2018 7:16 pm
by DannX
Thank you both, I'll try it out as soon as I can but either approach seems to be very likely to work.

Thanks again!