Hide a screen on mousebutton pressed?

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
Milkymalk
Miko-Class Veteran
Posts: 657
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Hide a screen on mousebutton pressed?

#1 Post by Milkymalk » Thu May 24, 2018 7:29 pm

Is it possible to have a screen hide itself when the player clicks anywhere? Or even on ANY key or mousebutton, essentially waiting for any input except simple mouse movement?

I could make the screen a giant button with action Hide("screenname"), but preferably the player should be able to click where he wants.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
gas
Veteran
Posts: 439
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Hide a screen on mousebutton pressed?

#2 Post by gas » Fri May 25, 2018 2:22 am

Maybe.
viewtopic.php?t=34291
And a magical function that hide show the screen.

Edit. No you want something different. Sorry.
10 ? "RENPY"
20 GOTO 10

RUN

User avatar
Remix
Miko-Class Veteran
Posts: 927
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I cannot draw very well)
Projects: An un-named 3d anime based trainer game
Contact:

Re: Hide a screen on mousebutton pressed?

#3 Post by Remix » Fri May 25, 2018 4:59 am

Code: Select all

screen hide_me():
    text "I am here"

init python:

    config.underlay.append(renpy.Keymap(mousedown_1=lambda: renpy.hide_screen('hide_me')))


label start:

    show screen hide_me
    "..."
Not entirely sure if keymap is saved/loaded so might need to resolve the lambda to a function. Also maybe better to go the invisible button route anyway.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 657
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Hide a screen on mousebutton pressed?

#4 Post by Milkymalk » Fri May 25, 2018 7:18 am

Underlay? Lambda? So much I don't know or understand yet. I will do the invisible button thing, but thanks, these are topics I will read more about. Now that I think about it, re-routing every possible input to closing the screen is probably overkill.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

Post Reply

Who is online

Users browsing this forum: IaMe