Hiding all the screens in a script

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
Adrian_DVL
Regular
Posts: 141
Joined: Fri Mar 15, 2019 8:46 am
Completed: Clockwork Poison
Projects: Melodic Dates, Clockwork Poison: Salvation
Contact:

Hiding all the screens in a script

#1 Post by Adrian_DVL »

Hi!

Here's my question. Turns out that I have a function to hide many screens at once, like this:

Code: Select all

def hides():
        renpy.hide_screen("homozoe1")
        renpy.hide_screen("homomay1")
        renpy.hide_screen("homovic1")
        renpy.hide_screen("homolau1")
        renpy.hide_screen("homobil1")
        renpy.hide_screen("homochr1")
But the thing is that I'm always creating more and more screens and it's a pain in the neck to go to this function and update it constantly so, since I have all those screens in one .rpy I'm wondering: is there a way to create a function or something that allows me to hide all the screens contained in a .rpy file? Thanks!

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

Re: Hiding all the screens in a script

#2 Post by Alex »

Adrian_DVL wrote: Sun Sep 05, 2021 1:25 pm ...But the thing is that I'm always creating more and more screens and it's a pain in the neck to go to this function and update it constantly ...
Try to set tags for your screens. That makes only one screen with the same tag to be shown on screen at a time, and also you'll be able to hide screen by tag instead of name.
Then, you could make a list of tags and make your function like

Code: Select all

    def hides():
        for t in screen_tags_list:
            renpy.hide_screen(t)

Post Reply

Who is online

Users browsing this forum: No registered users