How does ShowTransient work exactly?

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
cheonbyeol
Regular
Posts: 37
Joined: Thu Feb 04, 2021 9:04 am
Contact:

How does ShowTransient work exactly?

#1 Post by cheonbyeol » Thu Feb 04, 2021 9:47 am

Hi!

Relative newbie here, I tried poking around in the Documentation, but I got stuck. Or rather, found a workaround, but for future reference, want to understand why my original idea didn't work.

I was trying to make a popup (sub)menu that appears on top of the main menu screen, and then hides itself once one of its buttons is clicked which calls another game menu. I thought it would be as simple as calling the popup screen with ShowTransient, because the documentation says:
ShowTransient(screen, transition=None, *args, **kwargs)
Shows a transient screen. A transient screen will be hidden when the current interaction completes. (...)
But the popup screen sticks around on top of the newly loaded menu. (I figured I can hide it manually, so that's fine.)
But now I wonder, why doesn't ShowTransient hide it? I suspect the interaction is not over with clicking a button. But then what is an interaction in Ren'Py exactly?

Just in case, here's a snippet of my code:

Code: Select all

screen navigation():
	#blah blah usual stuff
	textbutton "Extra" action ShowTransient("extra") 

screen extra():
	#Didn't use tag menu, I do want it to show on top of the main menu screen!
	frame:
		textbutton "Endings" action ShowMenu("endings") 
		# textbutton "Endings" action [Hide("Extra"), ShowMenu("endings")] # manually hiding the popup
		textbutton "Gallery" action ShowMenu("gallery")
		
screen endings():
	tag menu #replacing the main menu screen
	use game_menu("Endings"):
		text "Endings list."
		#contents

goldo
Regular
Posts: 63
Joined: Mon Jan 23, 2017 8:23 am
Contact:

Re: How does ShowTransient work exactly?

#2 Post by goldo » Fri Feb 05, 2021 9:02 am

I think that for the interaction to complete, your screen needs to return something. Try this (can't test it unfortunately):

Code: Select all

screen extra():
	#Didn't use tag menu, I do want it to show on top of the main menu screen!
	frame:
		textbutton "Endings" action (ShowMenu("endings"), Return())
		# textbutton "Endings" action [Hide("Extra"), ShowMenu("endings")] # manually hiding the popup
		textbutton "Gallery" action (ShowMenu("gallery"), Return())

cheonbyeol
Regular
Posts: 37
Joined: Thu Feb 04, 2021 9:04 am
Contact:

Re: How does ShowTransient work exactly?

#3 Post by cheonbyeol » Fri Feb 05, 2021 9:30 am

goldo wrote:
Fri Feb 05, 2021 9:02 am
I think that for the interaction to complete, your screen needs to return something. Try this (can't test it unfortunately):

Code: Select all

screen extra():
	#Didn't use tag menu, I do want it to show on top of the main menu screen!
	frame:
		textbutton "Endings" action (ShowMenu("endings"), Return())
		# textbutton "Endings" action [Hide("Extra"), ShowMenu("endings")] # manually hiding the popup
		textbutton "Gallery" action (ShowMenu("gallery"), Return())
Thanks for the tip! Sadly, it doesn't work.

Post Reply

Who is online

Users browsing this forum: Google [Bot]