Transforming tags

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
strayerror
Regular
Posts: 154
Joined: Fri Jan 04, 2019 3:44 pm
Contact:

Transforming tags

#1 Post by strayerror » Mon Apr 13, 2020 1:24 pm

From time to time it makes sense to use a show expression statement using the as clause to tag it so it's easy to hide later. This functionality works great. I would like to do something similar for applying transforms. As far as I'm aware the only way to achieve this is to repeat the entire show expression and adding an at clause or inline ATL. Does anyone know if there's a nice way to achieve this? Hopefully the example code below clarifies what I'd like to do, but please don't hesitate to ask questions if what I'm describing is unclear. :D

Code: Select all

label start:
    show expression fn(var) as foo at right
    'Hello, I am Foo! I stand on the right.'

    show foo at left with dissolve                        # this is what I'd like to be able to do
    show expression fn(var) as foo at left with dissolve  # this is what I have to do now
    'Unless I stand on the left! :P'
    hide foo with dissolve                                # this works
    return
The benefit of this sort of ability is that what foo is behind the scenes becomes immaterial after the first line. It would make it much more readable and maintainable since it wouldn't be necessary to copy paste the expression each time it is used with a transform or transition in a given scene.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]