Changing the keymap in the middle of runtime repeatedly
Posted: Sat Jun 29, 2019 7:00 am
Quick Info: This is for the Renpy Visual Novel Game Engine (Available on Github) which is built on python.
What I want to do is change the ['dismiss'] variable of the keymap to null while a series of transitions play so the reader cant skip the scene. after the scene is over, I want to re-enable the default ['dismiss'] so that the user can continue reading the VN vivavideomaker.
What I have so far in my script is:
Defined in another section of the code is:
python early:
# the rest of the code is long and unnecessary for the question.
Now, the problem I'm getting is when I use the first block of code for the intro, the dismiss variable is set to null as expected, but after the intro ends and the scene changes, enter_on() does not work as expected, and either does not update the engine to include the values in dismiss or does not add the values to dismiss. I've looked basically everywhere I could think, but due to the lack of propper documentation, I cant really figure out how to get this to work.
What I want to do is change the ['dismiss'] variable of the keymap to null while a series of transitions play so the reader cant skip the scene. after the scene is over, I want to re-enable the default ['dismiss'] so that the user can continue reading the VN vivavideomaker.
What I have so far in my script is:
Code: Select all
$ enter_off()
##################
# Animated Intro #
##################
scene bg_sky_winter_sunny with dissolve300s
$ enter_on()python early:
Code: Select all
# turns enter off
# Also tried # config.keymap['dismiss'] = [] # Same result as below.
def enter_off():
config.keymap['dismiss'].remove('mouseup_1')
config.keymap['dismiss'].remove('K_RETURN')
config.keymap['dismiss'].remove('K_SPACE')
config.keymap['dismiss'].remove('K_KP_ENTER')
config.keymap['dismiss'].remove('joy_dismiss')
return
# turns enter on
def enter_on():
config.keymap['dismiss'].append('mouseup_1')
config.keymap['dismiss'].append('K_RETURN')
config.keymap['dismiss'].append('K_SPACE')
config.keymap['dismiss'].append('K_KP_ENTER')
config.keymap['dismiss'].append('joy_dismiss')
return
# copy of the default keymap in renpy-6.16.5-sdk\renpy\common\00keymap.rpy
def full_kb():Now, the problem I'm getting is when I use the first block of code for the intro, the dismiss variable is set to null as expected, but after the intro ends and the scene changes, enter_on() does not work as expected, and either does not update the engine to include the values in dismiss or does not add the values to dismiss. I've looked basically everywhere I could think, but due to the lack of propper documentation, I cant really figure out how to get this to work.