How to check if a screen is currently shown? [Solved]

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
texi
Newbie
Posts: 14
Joined: Tue May 30, 2017 3:40 pm
Contact:

How to check if a screen is currently shown? [Solved]

#1 Post by texi »

Is there a function to get all the screens currently showing or something?
Last edited by texi on Wed Aug 30, 2017 5:55 pm, edited 1 time in total.

User avatar
Qwxlea
Newbie
Posts: 18
Joined: Sat Jun 10, 2017 3:58 am
IRC Nick: qwxlea
Github: Qwxlea
Contact:

Re: How to check if a screen is currently shown?

#2 Post by Qwxlea »

For the current screen you could use renpy.get_screen, which returns the current screen:

Code: Select all

if renpy.get_screen("say"):
    text "The say screen is showing."
else:
    text "The say screen is hidden."

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: How to check if a screen is currently shown?

#3 Post by Remix »

Not an inbuilt function as far as I know, though you should be able to run one up by looking at the various functions in

renpy-{version}-source/renpy/display/screen.rpy

I'd suggest looking at the definitions around line 732 and maybe the sorting function
# Line 737 ish
def sort_screens():
with
# Line 912 ish
def get_screen(name, layer=None):
# Line 954 ish
def has_screen(name):

get_screen is even documented
Frameworks & Scriptlets:

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]