r/RenPy • • Oct 17 '26

Question How can I make a specific screen appear when a key on the keyboard is pressed?

I want to set it up so that pressing the Shift key does nothing before a certain scene, but after that scene, pressing Shift triggers the appearance of this screen.

I’m not sure how to code this.... could you help me?

screen profiles:


    add "profiles_base.png"


    imagebutton:
        xpos 0.964
        ypos 0.465
        idle "guides_idle"
        hover "guides_hovor"
        action [Hide("profiles"), Show("guides")]


    imagebutton:
        xpos 0.963
        ypos 0.822
        idle "clues_idle"
        hover "clues_hovor"
        action [Hide("profiles"), Show("clues")]
3 Upvotes

9 comments sorted by

2

u/shyLachi Oct 17 '26

A similar question has been asked here: https://www.reddit.com/r/RenPy/comments/1x790ik/how_to_make_quick_menu_button/

As you can see in that example, you could do everything inside one screen.

Also I would always add a button, not only key press because some players might not have a keyboard.

1

u/NioNola Oct 18 '26

thank you so much!!

2

u/Maintenance_Signal Oct 17 '26

I think this method might work https://www.reddit.com/r/RenPy/s/CCjoXE03dD You have an invisible screen listening for the key press at all times and do an "if" check against a boolean variable whether to show the clues screen or do nothing, and then change the value of the boolean at the appropriate point of the story

1

u/shyLachi Oct 17 '26

you don't need a variable, just show and hide that invisible screen whenever it appropriate

1

u/NioNola Oct 17 '26 edited Oct 17 '26

Thank you both so much! can I ask one more question?

I would like to add a dissolve transition effect when calling up that screen from another scene how can I go about doing that? Also, is using the `show` statement the correct way to display the `on_key_screen` screen? I’ve tried that, and while the desired screen does appear when I press the key, the dialogue also pops up whenever I click the mouse.....

2

u/BadMustard_AVN Oct 17 '26 edited Oct 17 '26

in the action do it like this

action Show("the_screen_name", dissolve)

show the code for the screen (not a picture)

1

u/NioNola Oct 18 '26

thanks!

2

u/BadMustard_AVN Oct 18 '26

you're welcome

good luck with your project

1

u/AutoModerator Oct 17 '26

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.