Renpy Question - Disable Transforms

Epadder

Programmer
Game Developer
Oct 25, 2016
568
1,064
Is there a way built-in to Ren'py to disable 'at' transforms?
Ex.
Code:
    show izanami d 04 at transform_PulseSlow with dissolve:
        zoom 1.5
Still apply the zoom but ignore the extra transform I added as an effect?

I have an idea in mind to have a persistent variable control their display (Essentially A 'Full', A 'Lite' and A 'None' condition that will determine which image I want to show ala:

Code:
if persistent.gameoption_Effects = "Full":
    show izanami d 04 at transform_Flashy with dissolve:
        zoom 1.5
elif persistent.gameoption_Effects = "Lite":
     show izanami d 04 at transform_Simple with dissolve:
        zoom 1.5
else:
    show izanami d 04 with dissolve:
        zoom 1.5
Before I embark on that path I wanted to make sure there wasn't something undocumented that I missed when looking into this. :biggrin:
 

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,841
Actually didn't try it yet but try to use the if statement inside the transform.

i.e.:
Code:
transform transform_Flashy_Simple:
    if persistent.gameoption_Effects == "Full":
        # Full transform options here #
    elif persistent.gameoption_Effects == "Lite":
        # Lite Transform here #
    else:
        zoom 1.5
Never tried an if statement inside a transform though, so it might not work. But that would be the way I'd go about it, and then just use one transform for all 3 styles instead of 3 different transforms.
This way you could use the same transform on all images but would get different results depending on the setting.

p.s.: You might have to restart the game after the settings have changed (Like I said, never fiddled around with the transforms that much yet :D )
 

Epadder

Programmer
Game Developer
Oct 25, 2016
568
1,064
transform statement won't except an if statement (only wants ATL I guess)
 
  • Like
Reactions: Palanto

Epadder

Programmer
Game Developer
Oct 25, 2016
568
1,064
Alright I figured out a way to do it smoother, the only issue I have with this method right now is it seems to take a reload to make it take effect.

I can use an if statement when defining the transforms, instead of on every image call.
Code:
    if persistent.gameoption_EffectsLevel == "Full":
        transform transform_UpAndDownFast:
            zoom 1.1
            linear 0.25 yalign 0.10
            linear 0.25 yalign 0.25
            repeat
    else:
        transform transform_UpAndDownFast:
            linear 0.4 zoom 1.003
            linear 0.4 zoom 1.0
            repeat
 

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,841
Hmmmm, well you could do a reload when the action takes place...
try adding these two actions to the button that changes the variables...
Code:
    textbutton "Full Effects" action [SetField(persistent, "gameoption_EffectsLevel", "Full"), Function(renpy.full_restart), Function(renpy.reload_script)]
 

Epadder

Programmer
Game Developer
Oct 25, 2016
568
1,064
Thanks for the help, just reloading the script is enough to have the change take effect.
 
  • Like
Reactions: Palanto

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,974
16,229
transform statement won't except an if statement (only wants ATL I guess)
But they , and functions accept conditions. The problem will be that you'll have to code a lot for that ; they aren't really designed for full replacement. Plus, I never had to use it, so I can't help with the code. But.... it's not at all a problem, because the solution is not in the transform itself.

Every transform is directly stored in the main store. This mean that you can dynamically switch them at anytime. In the same time, the at property can works with a function as argument...

Code:
init python:
   def myTransorm():
       if persistent.gameoption_EffectsLevel == "Full":
           return UpAndDownFast
       else:
           return breathing

transform UpAndDownFast:
    zoom 1.1
    linear 0.25 yalign 0.10
    linear 0.25 yalign 0.25
    repeat

transform breathing:
    linear 0.4 zoom 1.003
    linear 0.4 zoom 1.0
    repeat

label something:
    "Example with direct substitution"

    $ actualAtl = UpAndDownFast
    show izanami d 04 at actualAtl

    "next"

    $ actualAtl = breathing
    show izanami d 04 at actualAtl

    "And now for the dynamic substitution"
    $ persistent.gameoption_EffectsLevel = "Full":
    show izanami d 04 at myTransorm()

    "next"

    $ persistent.gameoption_EffectsLevel = None:
    show izanami d 04 at myTransorm()
Site note: The dynamic substitution imply that you can fully randomize the transform without the need to use the heavy ATL statement.
Code:
init python:
   def myTransorm():
       r = renpy.random.randint( 0, 10 )
       if r < 5:
           return UpAndDownFast
       elif r < 8:
           return breathing
       else:
           return yetAnotherTransform
 
  • Like
Reactions: Palanto

Epadder

Programmer
Game Developer
Oct 25, 2016
568
1,064
I certainly have no need to randomly call the transforms for what I'm using them for, but the top bit with dynamic substitution is what I will do. It is a bit of work but well I know more aggressive repeating image movement for effect can bother some... so having it as an option to change is worth it.

Thanks for the help :biggrin: