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: 753
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 »

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
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Hide a screen on mousebutton pressed?

#2 Post by gas »

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

Edit. No you want something different. Sorry.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Hide a screen on mousebutton pressed?

#3 Post by Remix »

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.
Frameworks & Scriptlets:

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
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 »

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: Ahrefs [Bot]