Use a transition with python equivalent of call screen

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
Misamor98
Regular
Posts: 45
Joined: Wed Jul 14, 2021 4:43 pm
Contact:

Use a transition with python equivalent of call screen

#1 Post by Misamor98 »

Hi,

My issue is simple,
When I want to call a screen with a Dissolve transition I simply input "Call screen ScreenName with Dissolve(1.0), but at some point in my code I'm calling a screen using the python equivalent of call screen like so:

Code: Select all

$ renpy.call_screen("Overlay", _layer="screens")
What do I type next to the line to call that screen with a Dissolve transition?

User avatar
Alex
Lemma-Class Veteran
Posts: 3098
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Use a transition with python equivalent of call screen

#2 Post by Alex »

Misamor98 wrote: Wed Aug 02, 2023 1:54 pm ...
Try it like

Code: Select all

    $ With(Dissolve(2.0))() # a pair of extra brackets at the end
    $ renpy.call_screen("Overlay", _layer="screens")
https://www.renpy.org/doc/html/screen_actions.html#With

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: Use a transition with python equivalent of call screen

#3 Post by _ticlock_ »

Misamor98 wrote: Wed Aug 02, 2023 1:54 pm
Also:

If you want the transition when showing the screen:

Code: Select all

python:
    renpy.transition(dissolve)
    renpy.call_screen("Overlay")
If you want the transition when hiding the screen:

Code: Select all

$ renpy.call_screen("Overlay", _with_none = False)
with dissolve

Misamor98
Regular
Posts: 45
Joined: Wed Jul 14, 2021 4:43 pm
Contact:

Re: Use a transition with python equivalent of call screen

#4 Post by Misamor98 »

Alex wrote: Wed Aug 02, 2023 3:12 pm
Misamor98 wrote: Wed Aug 02, 2023 1:54 pm ...
Try it like

Code: Select all

    $ With(Dissolve(2.0))() # a pair of extra brackets at the end
    $ renpy.call_screen("Overlay", _layer="screens")
https://www.renpy.org/doc/html/screen_actions.html#With
Sorry for the late anwser, and thank you! This works. I don't understand why the pair of extra brackets at the end though.

User avatar
Alex
Lemma-Class Veteran
Posts: 3098
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Use a transition with python equivalent of call screen

#5 Post by Alex »

Misamor98 wrote: Thu Aug 10, 2023 8:36 am I don't understand why the pair of extra brackets at the end though.
'With' is a screen action, but it can be used outside screen, 'cause it's a function. The difference from the ordinary function is that you need to put screen action's parameters inside brackets and add another pair of empty brackets to tell Ren'Py that it's a function.
https://www.renpy.org/doc/html/screen_actions.html

harlies
Newbie
Posts: 1
Joined: Wed Dec 13, 2023 6:06 pm

Re: Use a transition with python equivalent of call screen

#6 Post by harlies »

In Ren'Py, when using the renpy.call_screen function to call a screen with a specific transition, you can pass additional arguments, including the trans argument for the transition. In your case, to call the "Overlay" screen with a Dissolve transition, you can modify the code as follows:

$ renpy.call_screen("Overlay", _layer="screens", trans="dissolve 1.0")

This assumes that "dissolve 1.0" is the Dissolve transition you want, and you can adjust the duration (1.0 in this case) according to your preference.

Post Reply

Who is online

Users browsing this forum: Semrush [Bot]