[Solved] Having trouble hiding screens and images automatically during choice 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
Hiddenwall
Regular
Posts: 32
Joined: Sun May 14, 2017 6:57 pm
Contact:

[Solved] Having trouble hiding screens and images automatically during choice menu

#1 Post by Hiddenwall »

I have a screen and some images that I want to hide temporarily whenever I show the options for the choice menu and then reappear once you have selected a choice. Is there anyway to do this? I've tried looking into tags and it causes one screen to vanish but then I have to show back all the screens manually. My images are also layered images and for some reason I can't get the tag to work on there either.

Code: Select all

init:
    screen hud_bottom:
        tag switch
        imagemap:
            idle "gui/hud_bottom.png"
            hotspot (1013, 513, 148, 49) action ShowMenu("history") activate_sound "sfx/click.ogg"
            hotspot (1184, 512, 49, 50) action HideInterface()
The choice screen is all unchanged other than adding in the tag switch to it.
Last edited by Hiddenwall on Sat Feb 29, 2020 4:12 am, edited 1 time in total.


User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Having trouble hiding screens and images automatically during choice menu

#3 Post by gas »

Code: Select all

screen choice(items):
    style_prefix "choice"
    on "show" action Hide("hud_bottom")
    on "hide" action Show("hud_bottom")
    vbox:
        for i in items:
            textbutton i.caption action i.action
...and thanks for all the fish.
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

Hiddenwall
Regular
Posts: 32
Joined: Sun May 14, 2017 6:57 pm
Contact:

Re: Having trouble hiding screens and images automatically during choice menu

#4 Post by Hiddenwall »

Thank you for responding!

So far this doesn't seem to be doing anything. The hud_bottom screen still stays up when the choice menu appears and after I have selected a choice, the choice screen remains up. If I move forward to another choice it does the same thing, only the choices change but still stay up on the screen as well allowing me to click on them indefinitely. I have tried messing around with it to the best of my own ability with the tags removed and still nothing.

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Having trouble hiding screens and images automatically during choice menu

#5 Post by Alex »

What's the actual code you are using (the part that shows hud_bottom screen and choices menu and some lines around this part of code)?

Hiddenwall
Regular
Posts: 32
Joined: Sun May 14, 2017 6:57 pm
Contact:

Re: Having trouble hiding screens and images automatically during choice menu

#6 Post by Hiddenwall »

Code: Select all

screen choice(items):
    style_prefix "choice"
    on "show" action Hide("hud_bottom", dissolve)
    on "hide" action Show("hud_bottom", dissolve)
    vbox:
        for i in items:
            textbutton i.caption action i.action
    add "choice_screen.png"
This is the code that I now have for the choice screen with the added actions for hide and show.

Code: Select all

init:
    screen hud_bottom:
        imagemap:
            idle "gui/hud_bottom.png"
            hotspot (1013, 513, 148, 49) action ShowMenu("history") activate_sound "sfx/click.ogg"
            hotspot (1184, 512, 49, 50) action HideInterface()
And the actual code for the screen itself.

philat
Eileen-Class Veteran
Posts: 1912
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Having trouble hiding screens and images automatically during choice menu

#7 Post by philat »

I probably wouldn't bother with show/hide and use a variable to toggle the transform alpha between 1 and 0 instead.

Hiddenwall
Regular
Posts: 32
Joined: Sun May 14, 2017 6:57 pm
Contact:

Re: Having trouble hiding screens and images automatically during choice menu

#8 Post by Hiddenwall »

philat wrote: Sat Feb 29, 2020 1:03 am I probably wouldn't bother with show/hide and use a variable to toggle the transform alpha between 1 and 0 instead.
Like have it trigger a flag on menu show that causes the screen to change alpha depending if the flag is true or not?
Like this?

Code: Select all

init:
    screen hud_bottom:
        if hud_bottom_alpha:
            imagemap:
                idle "gui/hud_bottom.png"
                hotspot (1013, 513, 148, 49) action ShowMenu("history") activate_sound "sfx/click.ogg"
                hotspot (1184, 512, 49, 50) action HideInterface()
        else:
            null
It seems to work when I manually switch the variable but I'm not certain how to get it to be automated when the choice screen is active. I thought this might be it but it's not.

Code: Select all

init:
    $ hud_bottom_alpha = True

screen choice(items):
    style_prefix "choice"
    on "show" action SetVariable("hud_bottom_alpha", False)
    on "hide" action SetVariable("hud_bottom_alpha", True)
    $ hud_bottom_alpha = False
    vbox:
        for i in items:
            textbutton i.caption action i.action
    add "choice_screen.png"

philat
Eileen-Class Veteran
Posts: 1912
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Having trouble hiding screens and images automatically during choice menu

#9 Post by philat »

It should work. Maybe try adding replace, replaced (same as on show and hide).

Hiddenwall
Regular
Posts: 32
Joined: Sun May 14, 2017 6:57 pm
Contact:

Re: Having trouble hiding screens and images automatically during choice menu

#10 Post by Hiddenwall »

philat wrote: Sat Feb 29, 2020 3:24 am It should work. Maybe try adding replace, replaced (same as on show and hide).
Oh! That did it! Not certain which one is working but having all four of them in there did it! Thank you so much! :D
Now if I can get this to also work on images and sprites I will be good to go, but seeing how this part is finally done I think I might be able to figure that out.

Post Reply

Who is online

Users browsing this forum: Google [Bot]