Is it possible to use the "hide_windows" action in the game menu.

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
Lochana
Newbie
Posts: 21
Joined: Fri Jul 28, 2017 6:26 am
Projects: Touhou - Reimu's day out! (Won't see the light of day probably)
Github: lochana-Dineko
Contact:

Is it possible to use the "hide_windows" action in the game menu.

#1 Post by Lochana » Sat Dec 30, 2017 11:14 pm

I've been working on a project in Ren'py for a some time now, and it's been smooth sailing so far thanks to the documentation, the past questions in this forum and the cookbook. However I ran into a small problem.

I've created a right-click menu in place of the game-menu. It goes on like this.

Code: Select all

        
screen game_menu:
    tag menu
    
    window:
        style "gm_root"  
        
    vbox:
        pos (0.38, 0.2)
       
        textbutton _("Continue") action Return() text_size 50 xalign 0.5
        textbutton _("Save Game") action ShowMenu("save") text_size 50 xalign 0.5
        textbutton _("Load Game") action ShowMenu("load") text_size 50 xalign 0.5
        textbutton _("Hide Window") action hide_windows() text_size 50 xalign 0.5
        textbutton _("Preferences") action ShowMenu("preferences") text_size 50 xalign 0.5
        textbutton _("Main Menu") action MainMenu() text_size 50 xalign 0.5
        textbutton _("Quit") action Quit() text_size 50 xalign 0.5
       
The problem I have comes up when I'm trying to implement a "show cg" function from the right click menu. The "hide_windows()" action doesn't work from the r-click menu. Is there anyway else I could implement a function similar to it.

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Is it possible to use the "hide_windows" action in the game menu.

#2 Post by IrinaLazareva » Sun Dec 31, 2017 5:19 am

What is 'hide_windows' ?
If it is python's function, then try:

Code: Select all

        textbutton _("Hide Window") action Function(hide_windows)
doc: https://renpy.org/doc/html/screen_actions.html#Function

User avatar
Lochana
Newbie
Posts: 21
Joined: Fri Jul 28, 2017 6:26 am
Projects: Touhou - Reimu's day out! (Won't see the light of day probably)
Github: lochana-Dineko
Contact:

Re: Is it possible to use the "hide_windows" action in the game menu.

#3 Post by Lochana » Sun Dec 31, 2017 10:34 am

I tried it, but It doesn't work. As for the hide_windows action, I got it from here "viewtopic.php?p=96213". The action HideInterface() is available but it only seems to work on the quick-menu. I guess I'll change the ui. Thanks for taking your time to help.

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: Is it possible to use the "hide_windows" action in the game menu.

#4 Post by Remix » Sun Dec 31, 2017 10:44 am

How are you currently trying to implement it? (I presume you are emulating the 'h' keypress event)

It seems that hide_windows is not an actual function, just a keymap call that passes the event through to then call a label (generally in a new context or even curried).
For info, the label that does the work is:

Code: Select all

label _hide_windows:

    if renpy.context()._menu:
        return

    if _windows_hidden:
        return

    python:
        _windows_hidden = True
        voice_sustain()
        ui.saybehavior(dismiss=['dismiss', 'hide_windows'])
        ui.interact(suppress_overlay=True, suppress_window=True)
        _windows_hidden = False

    return
You might be able to use it as an action by something like:

Code: Select all

action Function( renpy.curried_call_in_new_context, "_hide_windows" )
Frameworks & Scriptlets:

User avatar
Lochana
Newbie
Posts: 21
Joined: Fri Jul 28, 2017 6:26 am
Projects: Touhou - Reimu's day out! (Won't see the light of day probably)
Github: lochana-Dineko
Contact:

Re: Is it possible to use the "hide_windows" action in the game menu.

#5 Post by Lochana » Mon Jan 01, 2018 3:59 am

Thanks, I'll try it and see if it works.

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot]