Chaining transitions

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
Cironian
Regular
Posts: 33
Joined: Sun Aug 26, 2007 5:34 pm
Projects: Dragon Story
Contact:

Chaining transitions

#1 Post by Cironian »

Hi everyone!

Is there a simple way to combine multiple transitions into one that I can then call by a single name?

Example: When changing backgrounds, I prefer a fade, followed by a brief pause to give the player time to look at the background before it is covered by text again. (This is in NVL mode)

So currently, I do this:

Code: Select all

    scene bg foo
    with fade
    with Pause(0.3)
What I would like to do is to combine the fade and Pause into a single transition name which allows me to change the details of the transition in some central location, instead of having to search and replace over the whole script. So ideally I would do something like:

Code: Select all

   $ bgtrans = TransitionificationCombininator(fade, Pause(0.3))
Any ideas how something like this can be done?

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Chaining transitions

#2 Post by PyTom »

MultipleTransition lets you do this. IIRC, the syntax would be something like:

Code: Select all

init:
    $ bgtrans = MultipleTransition(False, fade, True, Pause(0.3), True)
Fun fact: Fade is actually two dissolves hooked together in a MultipleTransition like this.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Cironian
Regular
Posts: 33
Joined: Sun Aug 26, 2007 5:34 pm
Projects: Dragon Story
Contact:

Re: Chaining transitions

#3 Post by Cironian »

Thanks, that is exactly what I was looking for!

farvardin
Regular
Posts: 28
Joined: Tue Mar 13, 2007 8:15 am
Contact:

Re: Chaining transitions

#4 Post by farvardin »

in a similar way, is it possible to combine several elements such as the placement and the transition?

I have many pictures to display with always the same construction for ex:

Code: Select all

show mypicture at centertop with dissolve
Would it be possible to label this function "displaypic" and call it only with:

Code: Select all

displaypic mypicture
edit: hmm, I think I'll have to look at this for this purpose : http://www.renpy.org/wiki/renpy/doc/ref ... splayables
Or is there an easier way?

More generally, I'm making a CYOA, and I have much more menu input than in a traditional visual novels. I don't have big background pictures, only small vignettes I wish to display and hide before showing the menu. The scene system wouldn't really work for this kind of game, and I'd like to avoid to repeat the show / hide command for every pictures.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Chaining transitions

#5 Post by PyTom »

Hm... how good are you with programming? This is the perfect use of a user statement. A UDD seems like it would be overkill here.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

farvardin
Regular
Posts: 28
Joined: Tue Mar 13, 2007 8:15 am
Contact:

Re: Chaining transitions

#6 Post by farvardin »

it seems too complicated for me :(

What I was thinking of would be a kind of user defined "macro" like this :

Code: Select all

def showmypic(mypic):
    show mypic at centertop with dissolve

then you can call it by "showmypic(picture1.png)" and it will replace it by:

Code: Select all

show picture1.png at centertop with dissolve

monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

Re: Chaining transitions

#7 Post by monele »

Code: Select all

def showmypic(mypic):
    renpy.show(mypic, [centertop])
    renpy.with_statement(dissolve)
#
called...

Code: Select all

$ showmypic("somepic")
"somepic" being a previously defined image :

Code: Select all

image somepic = "somepicture.png"

farvardin
Regular
Posts: 28
Joined: Tue Mar 13, 2007 8:15 am
Contact:

Re: Chaining transitions

#8 Post by farvardin »

it's working well like that. Thank you very much Monele!

Post Reply

Who is online

Users browsing this forum: No registered users