[SOLVED] How can I add a transition to a renpy.show_screen statement?

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
Thailandian
Regular
Posts: 30
Joined: Tue Jun 01, 2021 6:24 am
Contact:

[SOLVED] How can I add a transition to a renpy.show_screen statement?

#1 Post by Thailandian »

I have a task-list screen that I want to open, both from a button and from within the script. As well as opening the screen and hiding the button, there will be other house-keeping to do, so I decided it would be better to write a Python function for the routine. Here is the relevant code:

Code: Select all

init python:
	def openToDo():
	        renpy.hide_screen("to_do_list_button")
        	renpy.show_screen("game_ch01_tasks")
	        renpy.restart_interaction()
That works as expected, but I would like to add a transition. According to the documentation, the python equivalent to "with dissolve" is:

Code: Select all

renpy.with_statement(trans=dissolve)
but I can't find any simple examples of how or where to place that code. I tried both before and after the renpy.show_screen statements, but got an error message: Exception: Cannot start an interaction in the middle of an interaction without creating a new context.

I sort of understand that, but then where should the code go?
Last edited by Thailandian on Wed Jun 23, 2021 3:00 pm, edited 1 time in total.

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 can I add a transition to a renpy.show_screen statement?

#2 Post by Remix »

Code: Select all


        	renpy.show_screen("game_ch01_tasks")
        	renpy.transition(dissolve)
	        renpy.restart_interaction()
Frameworks & Scriptlets:

Thailandian
Regular
Posts: 30
Joined: Tue Jun 01, 2021 6:24 am
Contact:

Re: How can I add a transition to a renpy.show_screen statement?

#3 Post by Thailandian »

Thanks Remix - that did it!

But now I'm curious - the official renpy documentation on both of these functions is pretty scant, but I still can't quite understand why it's not possible to use renpy.with_statement() in this context. It seemed at least one logical choice, if not the logical choice.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Semrush [Bot]