[Solved]Need help changing the default 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
DannX
Regular
Posts: 99
Joined: Mon Mar 12, 2018 11:15 am
Contact:

[Solved]Need help changing the default keymap

#1 Post 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?
Last edited by DannX on Thu Jul 05, 2018 7:17 pm, edited 1 time in total.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Need help changing the default keymap

#2 Post 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.

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Need help changing the default keymap

#3 Post by Remix »

config.overlay_screens.append( "mousewheel_rebind" )
in an init python block
Frameworks & Scriptlets:

DannX
Regular
Posts: 99
Joined: Mon Mar 12, 2018 11:15 am
Contact:

Re: Need help changing the default keymap

#4 Post 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!

Post Reply

Who is online

Users browsing this forum: Imperf3kt