Alternating Show/Hide button for screen[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
User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Alternating Show/Hide button for screen[SOLVED]

#1 Post by TellerFarsight »

How do I make a button that when clicked either shows or hides a screen, depending upon whether it's already on screen or not.
This is my code for just the Show part.

Code: Select all

hotspot (380, 4, 52, 36) action Show('example_screen',fade)
Last edited by TellerFarsight on Mon Jun 26, 2017 12:58 pm, edited 1 time in total.
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

User avatar
DannyGMaster
Regular
Posts: 113
Joined: Fri Sep 02, 2016 11:07 am
Contact:

Re: Alternating Show/Hide button for screen

#2 Post by DannyGMaster »

Try renpy.get_screen()

Code: Select all

hotspot (380, 4, 52, 36):
    if renpy.get_screen('example_screen'):
        action Hide('example_screen', fade)
    else:
        action Show('example_screen', dissolve)
The silent voice within one's heart whispers the most profound wisdom.

User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Re: Alternating Show/Hide button for screen

#3 Post by TellerFarsight »

Thanks!
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot]