Combine renpy.show with 'on show'

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
Rainz
Newbie
Posts: 3
Joined: Sat Dec 02, 2017 9:13 am
Contact:

Combine renpy.show with 'on show'

#1 Post by Rainz »

See code below. This works great. Shows the background image, with the 'on show' zoom effect. All good! :)

Code: Select all

image bg someplace_empty_day = 'someplace_empty_day.jpg'
scene bg someplace_empty_day
    on show:
        zoom 1.0
        ease 10 zoom 1.05
        zoom 1.05
        ease 10 zoom 1.0
        repeat
However... i'm calling certain backgrounds with variables within a python block using renpy.show - like this:

Code: Select all

python:
    renpy.scene()  
    renpy.show('bg ' + player.location + '_empty_' + timeState)
This works perfect. Just it's without the on show effect.

So my question is, how can i add an 'on show' effect within the python block code? Is this possible?

Tried creating a custom transform like:

Code: Select all

transform show_bg:
    on show:
        zoom 1.0
        ease 10 zoom 1.05
        zoom 1.05
        ease 10 zoom 1.0
        repeat
Then calling either

Code: Select all

renpy.transition(show_bg)
Or
renpy.with_statement(show_bg)


but neither seem to work. :? Any help appreciated!

User avatar
Vladimir_P
Newbie
Posts: 11
Joined: Wed Jun 28, 2017 7:48 am
Contact:

Re: Combine renpy.show with 'on show'

#2 Post by Vladimir_P »

Code: Select all

init:
    transform show_bg:
        on show:
            zoom 1.0
            ease 10 zoom 1.05
            zoom 1.05
            ease 10 zoom 1.0
            repeat
...
label x:
...
    $ renpy.scene()
    $ renpy.show('bg someplace_empty_day',at_list=[show_bg]) #show_bg WITHOUT "-symbol, because he must return an ATLTransform object.

Rainz
Newbie
Posts: 3
Joined: Sat Dec 02, 2017 9:13 am
Contact:

Re: Combine renpy.show with 'on show'

#3 Post by Rainz »

Thanks, Vladimir_P! Works prefect. :)

User avatar
Vladimir_P
Newbie
Posts: 11
Joined: Wed Jun 28, 2017 7:48 am
Contact:

Re: Combine renpy.show with 'on show'

#4 Post by Vladimir_P »

It's my pleasure. :)

Post Reply

Who is online

Users browsing this forum: Google [Bot]