[SOLVED] "H" key does not work when moving say screen to a different layer

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
User avatar
Black Cat 2412
Regular
Posts: 74
Joined: Wed Aug 16, 2017 10:10 am
Projects: Rapunzel: A classic retold
Deviantart: BlackCat2412
Location: Vietnam
Contact:

[SOLVED] "H" key does not work when moving say screen to a different layer

#1 Post by Black Cat 2412 »

Good day ladies and gentlemen

For a number of reasons, I need to move my say screen and choice screen to a different layer than the "screen" layer. It looks like this:

Code: Select all

define config.layers = [ 'master', 'transient','dialogue','screens','overlay']
define config.say_layer = "dialogue" 
define config.choice_layer = "dialouge"
All went well and both screens appear exactly on the layer I want them to. However, there is one problem: Now when I press the "H" key in-game to hide the Interface it will only hide the Quick menu while the say + choice screen stay on the monitor and do not disappear at all.

How can I fix this?
Thank a lot in advance.
Last edited by Black Cat 2412 on Fri Sep 22, 2017 1:48 pm, edited 1 time in total.

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: "H" key does not work when moving say screen to a different layer

#2 Post by Divona »

Here is my take on a solution:

Code: Select all

define config.layers = [ 'master', 'transient','dialogue','screens','overlay']
define config.say_layer = "dialogue" 
define config.choice_layer = "dialogue"

init python:

    new_keymap = renpy.Keymap(
        rollback = renpy.rollback,
        screenshot = _screenshot,
        toggle_fullscreen = renpy.toggle_fullscreen,
        toggle_afm = _keymap_toggle_afm,
        toggle_skip = _keymap_toggle_skipping,
        fast_skip = _fast_skip,
        game_menu = _invoke_game_menu,
        hide_windows = renpy.curried_call_in_new_context("hide_interface"),
        launch_editor = _launch_editor,
        reload_game = _reload_game,
        developer = _developer,
        quit = renpy.quit_event,
        iconify = renpy.iconify,
        help = _help,
        choose_renderer = renpy.curried_call_in_new_context("_choose_renderer"),
        console = _console.enter,
        profile_once = _profile_once,
        memory_profile = _memory_profile,
        self_voicing = Preference("self voicing", "toggle"),
        clipboard_voicing = Preference("clipboard voicing", "toggle"),
        debug_voicing = Preference("debug voicing", "toggle"),
        progress_screen = _progress_screen,
        )

    config.underlay = [ new_keymap ]


label hide_interface:

    if renpy.context()._menu:
        return

    if _windows_hidden:
        return

    python:
        _windows_hidden = True
        voice_sustain()
        renpy.hide_screen("say", "dialogue")
        renpy.hide_screen("choice", "dialogue")
        ui.saybehavior(dismiss=['dismiss', 'hide_windows'])
        ui.interact(suppress_overlay=True, suppress_window=True)
        _windows_hidden = False

    return


label start:
    . . .
Completed:
Image

User avatar
Black Cat 2412
Regular
Posts: 74
Joined: Wed Aug 16, 2017 10:10 am
Projects: Rapunzel: A classic retold
Deviantart: BlackCat2412
Location: Vietnam
Contact:

Re: "H" key does not work when moving say screen to a different layer

#3 Post by Black Cat 2412 »

Worked like a charm! Thank you very much, Divona! :3

Post Reply

Who is online

Users browsing this forum: No registered users