Changing the keymap in the middle of runtime repeatedly

Forum organization and occasional community-building.
Forum rules
Questions about Ren'Py should go in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
matthew48
Newbie
Posts: 1
Joined: Thu Jun 27, 2019 1:27 am
Contact:

Changing the keymap in the middle of runtime repeatedly

#1 Post by matthew48 » 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:

Code: Select all

$ enter_off()
##################
# Animated Intro #
##################
scene bg_sky_winter_sunny with dissolve300s
$ enter_on()
Defined in another section of the code is:

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():
# 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.
Last edited by matthew48 on Mon Jul 01, 2019 3:30 am, edited 1 time in total.

User avatar
Alex
Lemma-Class Veteran
Posts: 2310
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Changing the keymap in the middle of runtime repeatedly

#2 Post by Alex » Sat Jun 29, 2019 8:37 am

Try to make a screen and reassign 'dismiss' there. So, later you simply could show and hide this screen.

Code: Select all

screen my_scr():
    key 'dismiss' action NullAction()


label start:
    show screen my_scr
    ##################
    # Animated Intro #
    ##################
    scene bg_sky_winter_sunny with dissolve300s
    hide screen my_scr
https://www.renpy.org/doc/html/screens.html#key
https://www.renpy.org/doc/html/screen_a ... NullAction

Post Reply

Who is online

Users browsing this forum: No registered users