Anonymous animated transform in an included screen doesn't play if its transcluded displayble takes a variable?

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
User avatar
IcyValet
Newbie
Posts: 11
Joined: Fri Feb 08, 2019 11:13 pm
itch: icyvalet
Contact:

Anonymous animated transform in an included screen doesn't play if its transcluded displayble takes a variable?

#1 Post by IcyValet » Fri Feb 08, 2019 11:37 pm

Strange bug, am I'm doing something wrong?

Replace main menu of a blank project with this. Case 1, 2, and 3 play the animation properly, but for some reason case 4 doesn't animate.

Code: Select all

transform named_transform():
    alpha 0
    linear 0.5 alpha 1
    repeat

screen screen_with_named_transform():
    hbox:
        transclude
        text "this should be animated" at named_transform

screen screen_with_anonymous_transform():
    hbox:
        transclude
        text "this should be animated":
            at transform:
                alpha 0
                linear 0.5 alpha 1
                repeat

screen main_menu():

    $ var = NullAction()

    vbox:
        use screen_with_named_transform():
            textbutton "case 1: included screen has a named transform, transcluded displayable takes a function → " action NullAction()
        use screen_with_named_transform():
            textbutton "case 2: included screen has a named transform, transcluded displayable takes a variable → " action var
        use screen_with_anonymous_transform():
            textbutton "case 3: included screen has an anonymous transform, transcluded displayable takes a function → " action NullAction()
        use screen_with_anonymous_transform():
            textbutton "case 4: included screen has an anonymous transform, transcluded displayable takes a variable → " action var

strayerror
Regular
Posts: 154
Joined: Fri Jan 04, 2019 3:44 pm
Contact:

Re: Anonymous animated transform in an included screen doesn't play if its transcluded displayble takes a variable?

#2 Post by strayerror » Sat Feb 09, 2019 4:43 am

Had a play around with this, definitely weird behaviour, unfortunately I didn't find anything useful, however I did find more weirdness.

Code: Select all

-screen main_menu():
+screen main_menu:
Removing the parentheses on main_menu results in case 3 failing the same way. I haven't a clue as to why, or if it's related though. :/

User avatar
IcyValet
Newbie
Posts: 11
Joined: Fri Feb 08, 2019 11:13 pm
itch: icyvalet
Contact:

Re: Anonymous animated transform in an included screen doesn't play if its transcluded displayble takes a variable?

#3 Post by IcyValet » Mon Feb 25, 2019 12:59 am

Thanks for the input. Busy with other stuff so I haven't investigated this at all since I posted 😅.

Based on what you found maybe it has something to do with Ren'Py's screen language optimization 🤔 (https://www.renpy.org/doc/html/screen_o ... ter%20list)

For now I'll just use named transforms (so cases 1 and 2) where applicable for my NaNoRenO project and come back to this later.

User avatar
IcyValet
Newbie
Posts: 11
Joined: Fri Feb 08, 2019 11:13 pm
itch: icyvalet
Contact:

Re: Anonymous animated transform in an included screen doesn't play if its transcluded displayble takes a variable?

#4 Post by IcyValet » Wed Mar 06, 2019 5:31 pm

Alright, so I figured out the solution for my use case. Put the displayable with the anonymous transform in its own screen and "use" it in the screen with the transclude. So:

Code: Select all

screen_1:
	use screen_2:
		stuff
		
screen_2:
	transclude
	use screen_3

screen_3:
	anonymous_transformed_stuff
If screen_3 has a transclude, the anonymous transform will fail, so don't put a transclude in it! This is on the latest Ren'Py version, 7.2.0.424. Too busy to cook up real code for this example (NaNoRenO 😝) but this works for me. You might be thinking, why not just use named transforms if you're going to create a whole new screen? Well, for me, screen_3 is used in a few different places, so I was going to reuse it anyway, and not using named transform makes my code more tidy.

But even though I solved this for my use case the underlying mechanism is still a mystery 🤔 so I'm not going to mark this as [solved] yet.

Post Reply

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot]