[SOLVED] Disabling Animations made with ATL?

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
Johan
Regular
Posts: 76
Joined: Mon Jan 14, 2019 5:58 pm
Organization: DMEOW
itch: dmeow
Location: Perú
Discord: Johan#7444
Contact:

[SOLVED] Disabling Animations made with ATL?

#1 Post by Johan »

This may be a silly question but I honestly don't know how to do it

I just want to have an option so the player can disable animations made with ATL if they are bothered by it.

For example, let's say there's an animation like this:

Code: Select all

transform blink:
    alpha 0.0
    linear 1.0 alpha 1.0
    linear 1.0 alpha 0.0
    repeat
how do i give the player the option to disable this animation?
is it possible?
Last edited by Johan on Sun Nov 03, 2019 1:43 am, edited 1 time in total.
dmeow !
Check my silly blog!

◤ And I saw the stars ★ falling down... ◢
Check the game!! IT'S OUT!!!
.

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Disabling Animations made with ATL?

#2 Post by Remix »

There might well be better ways...

ATL can use python functions which, if they return a numeric value are repeatedly called after that many seconds and if they return None are bypassed, so:

Code: Select all

init python:

    def atl_can_run(*args):
        if persistent.atl_allowed: # test some persistent value
            return None
        return 1.0

transform blink:
    alpha 0.0
    function atl_can_run # runs the function above
    linear 1.0 alpha 1.0
    linear 1.0 alpha 0.0
    repeat
Frameworks & Scriptlets:

User avatar
Johan
Regular
Posts: 76
Joined: Mon Jan 14, 2019 5:58 pm
Organization: DMEOW
itch: dmeow
Location: Perú
Discord: Johan#7444
Contact:

Re: Disabling Animations made with ATL?

#3 Post by Johan »

So this means i can apply persistent value to functions? that's good to know! i'm gonna play around with this code if I can manage to do it.
I think it CAN be done using this but I haven't managed to do it yet
thanks anyways!
dmeow !
Check my silly blog!

◤ And I saw the stars ★ falling down... ◢
Check the game!! IT'S OUT!!!
.

User avatar
Johan
Regular
Posts: 76
Joined: Mon Jan 14, 2019 5:58 pm
Organization: DMEOW
itch: dmeow
Location: Perú
Discord: Johan#7444
Contact:

[SOLVED] Disabling Animations made with ATL?

#4 Post by Johan »

So I've finally made it work! Thanks so much to @LimitElta on twitter for helping me figuring this out! And to Remix for showing me the first steps to figuring this out! :D I'm posting the solution in case someone wants help on this too!!

You have this animation made with ATL:

Code: Select all

transform blink:
    alpha 0.0
    linear 1.0 alpha 1.0
    linear 1.0 alpha 0.0
    repeat
So you want the player be able to disable it because the animation can probably make someone's head a bit dizzy (like flashy lights or things that appears and dissapear too fast). You simply need to put this code:

Code: Select all

init python:

    def atl_can_run(*args):
        if persistent.atl_allowed:
            return 1.0 ##you need to put here 1.0 and not None.
        return None
        
transform blink:
    function atl_can_run ##it needs to be put here first before alpha 0.0 bc otherwise, the persistent won't work
    alpha 0.0
    linear 1.0 alpha 1.0
    linear 1.0 alpha 0.0
    repeat
Then, on the screen of Options/Configuration, you put this:

Code: Select all

textbutton "No Anim" action ToggleField(persistent, "atl_allowed", true_value=True, false_value=False)
And if you want the animation to play by default and to give the option to the player to disable it manually just put, outside of any label or screen statement, the following:

Code: Select all

default persistent.atl_allowed = False
With this, by default, the animation will play. But if you go to the Options/Configuration Screen and disable it, only the images you've put will appear but not the blinking animation.

BUT if you want to use an alternative image when disabling it, in your script, put:

Code: Select all

if persistent.atl_allowed:
        scene bg background_image #or
        show whatever_image_u_like
else:
	show image at blink 
[edited] It works fine like this now! ^^

Thanks to everyone who helped me out here! <3
dmeow !
Check my silly blog!

◤ And I saw the stars ★ falling down... ◢
Check the game!! IT'S OUT!!!
.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]