Close button

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
iDweadith
Regular
Posts: 63
Joined: Sun Mar 01, 2020 4:15 pm
Contact:

Close button

#1 Post by iDweadith » Tue Jun 09, 2020 1:45 pm

Guys I'm sorry my english is not good and that's hard to explain so I try

I'm trying to make a single close button for all screens, I mean I want an only single close button to close more screens once a time.

Something like:

Code: Select all

textbutton "Close Screen" action Hide("[Selected_Screen]")
Can you help me?

User avatar
hell_oh_world
Veteran
Posts: 464
Joined: Fri Jul 12, 2019 5:21 am
Projects: The Button Man
Organization: NILA
Github: hell-oh-world
Location: Philippines
Contact:

Re: Close button

#2 Post by hell_oh_world » Tue Jun 09, 2020 7:04 pm

Scene clears the screen for you. It removes all currently showed images, and i think it includes screens too.

Code: Select all

button action Function(renpy.scene)

User avatar
Per K Grok
Miko-Class Veteran
Posts: 743
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1 & 2
Projects: the Phantom Flier
itch: per-k-grok
Location: Sverige
Contact:

Re: Close button

#3 Post by Per K Grok » Thu Jun 11, 2020 1:11 am

iDweadith wrote:
Tue Jun 09, 2020 1:45 pm
Guys I'm sorry my english is not good and that's hard to explain so I try

I'm trying to make a single close button for all screens, I mean I want an only single close button to close more screens once a time.

Something like:

Code: Select all

textbutton "Close Screen" action Hide("[Selected_Screen]")
Can you help me?
You can have more than one action to a button, so you could do this

Code: Select all

textbutton "Close Screen" action [ Hide("screen1"),  Hide("screen2"), Hide("screen3"), Hide("screen4"), Hide("screen5") ]      

strayerror
Regular
Posts: 125
Joined: Fri Jan 04, 2019 3:44 pm
Contact:

Re: Close button

#4 Post by strayerror » Thu Jun 11, 2020 5:40 am

hell_oh_world wrote:
Tue Jun 09, 2020 7:04 pm
Scene clears the screen for you. It removes all currently showed images, and i think it includes screens too.
I can't check right now but if I recall correctly: By default the scene function will only clear the master layer, however by changing it slightly to be Function(renpy.scene, layer='screens') I believe that would instead hide everything on the screens layer, which in the majority of cases will include all screens. If a more complex layering system is being used this may not have the desired effect, so ymmv.

Post Reply

Who is online

Users browsing this forum: No registered users