Problem with ATL of Main Menu Button

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
mitoky
Veteran
Posts: 316
Joined: Sat Feb 07, 2015 9:12 pm
Projects: The Purring Demon's Love, circus eterie
Contact:

Problem with ATL of Main Menu Button

#1 Post by mitoky » Fri Jun 01, 2018 5:42 am

Hello!

For the main menu i have buttons which dissolve in on idle/hover when switched. The problem is that it too happens when the screen is first shown.
So what i want is that when the screen is shown the buttons are already displayed on alpha 1.0 rather than fading in. I know idle is the problem but dont know how to solve it. Does anyone have a solution for me?

The transform:

Code: Select all

transform main_menu_buttons_dissolve:
    alpha 1.0
    on idle:
        alpha 0.3
        linear 1.0 alpha 1.0
    on hover:
        alpha 0.3
        linear 1.0 alpha 1.0
and a button of the main menu:

Code: Select all

    ## Start Button
    button:
        background "gui/title_page/start_idle.png"
        hover_background "start_star_hover"
        xanchor 0.0
        yanchor 1.0
        xpos 0.0
        ypos 1.0
        xysize (359, 341)
        focus_mask True
        at main_menu_buttons_dissolve
        text _("Start") style "main_menu_pink_text" xanchor 0.5 yanchor 0.5 xpos 0.5 ypos 0.5
        action Start()

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 2919
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Problem with ATL of Main Menu Button

#2 Post by Imperf3kt » Fri Jun 01, 2018 5:56 am

This is only a guess, but what happens if you replace "on idle" with "on replaced"

https://www.renpy.org/doc/html/atl.html ... nal-events

Actually, I think I see the issue.

Code: Select all

transform main_menu_buttons_dissolve:
    alpha 1.0
    on idle:
        alpha 0.3
        linear 1.0 alpha 1.0
    on hover:
        alpha 0.3
        linear 1.0 alpha 1.0
        
So essentially this says:
start at alpha 1.0
when idle, start at alpha 0.3 then take one second to transition to alpha 1.0
when hovered, start on alpha 0.3 then take one second to transition to alpha 1.0

This code, as is, could be simplified:

Code: Select all

transform main_menu_buttons_dissolve:
    alpha 1.0
    on hover, idle:
        alpha 0.3
        linear 1.0 alpha 1.0
        
Last edited by Imperf3kt on Fri Jun 01, 2018 6:06 am, edited 4 times in total.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Free Android GUI - Updated occasionally

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Problem with ATL of Main Menu Button

#3 Post by kivik » Fri Jun 01, 2018 5:58 am

Try using on appear: with alpha 1.0? I could be completely off base though.

The documentation is a bit scattered regarding the on statement, but here you can see the 3 states and what they mean: https://www.renpy.org/doc/html/screens. ... -statement
appear
Is delivered if the condition is true when the screen is first shown, to instantly show the child.
show
Is delivered when the condition changes from false to true.
hide
Is delivered when the condition changes from true to false.

User avatar
mitoky
Veteran
Posts: 316
Joined: Sat Feb 07, 2015 9:12 pm
Projects: The Purring Demon's Love, circus eterie
Contact:

Re: Problem with ATL of Main Menu Button

#4 Post by mitoky » Fri Jun 01, 2018 6:04 am

Imperf3kt wrote:
Fri Jun 01, 2018 5:56 am
This is only a guess, but what happens if you replace "on idle" with "on replaced"

https://www.renpy.org/doc/html/atl.html ... nal-events

Actually, I think I see the issue.

Code: Select all

transform main_menu_buttons_dissolve:
    alpha 1.0
    on idle:
        alpha 0.3
        linear 1.0 alpha 1.0
    on hover:
        alpha 0.3
        linear 1.0 alpha 1.0
        
So essentially this says:
start at alpha 1.0
when idle, start at alpha 0.3 then take one second to transition to alpha 1.0
when hovered, start on alpha 0.3 then take one second to transition to alpha 1.0
kivik wrote:
Fri Jun 01, 2018 5:58 am
Try using on appear: with alpha 1.0? I could be completely off base though.

The documentation is a bit scattered regarding the on statement, but here you can see the 3 states and what they mean: https://www.renpy.org/doc/html/screens. ... -statement
appear
Is delivered if the condition is true when the screen is first shown, to instantly show the child.
show
Is delivered when the condition changes from false to true.
hide
Is delivered when the condition changes from true to false.
Both didnt worked ): But thank you for the help!

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 2919
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Problem with ATL of Main Menu Button

#5 Post by Imperf3kt » Fri Jun 01, 2018 6:07 am

Did you get any error when trying either, or did it simply do the same as it was in the first place?
This is what I was suggesting:

Code: Select all

transform main_menu_buttons_dissolve:
    alpha 1.0
    on hover, replaced:
        alpha 0.3
        linear 1.0 alpha 1.0
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Free Android GUI - Updated occasionally

User avatar
mitoky
Veteran
Posts: 316
Joined: Sat Feb 07, 2015 9:12 pm
Projects: The Purring Demon's Love, circus eterie
Contact:

Re: Problem with ATL of Main Menu Button

#6 Post by mitoky » Fri Jun 01, 2018 6:08 am

Imperf3kt wrote:
Fri Jun 01, 2018 6:07 am
Did you get any error when trying either, or did it simply do the same as it was in the first place?
This is what I was suggesting:

Code: Select all

transform main_menu_buttons_dissolve:
    alpha 1.0
    on hover, replaced:
        alpha 0.3
        linear 1.0 alpha 1.0
It completly ignores on replaced and only dissolves when on hover. I copy pasted what you wrote and tested again in case i did something wrong but same result.

User avatar
Remix
Eileen-Class Veteran
Posts: 1410
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: Problem with ATL of Main Menu Button

#7 Post by Remix » Fri Jun 01, 2018 8:20 am

The list of ATL events are:
https://www.renpy.org/doc/html/atl.html#external-events wrote:
The following events can be triggered automatically:

start
A pseudo-event, triggered on entering an on statement, if no event of higher priority has happened.
show
Triggered when the transform is shown using the show or scene statement, and no image with the given tag exists.
replace
Triggered when transform is shown using the show statement, replacing an image with the given tag.
hide

Triggered when the transform is hidden using the hide statement or its python equivalent.

Note that this isn't triggered when the transform is eliminated via the scene statement or exiting the context it exists in, such as when exiting the game menu.
replaced
Triggered when the transform is replaced by another. The image will not actually hide until the ATL block finishes.
update
Triggered when a screen is updated without being shown or replacing another screen. This happens in rare but possible cases, such as when the game is loaded and when styles or translations change.
hover, idle, selected_hover, selected_idle
Triggered when button containing this transform, or a button contained by this transform, enters the named state.
If idle isn't recognized as higher, a basic:

on start, show:
....alpha 1.0

might do you

User avatar
mitoky
Veteran
Posts: 316
Joined: Sat Feb 07, 2015 9:12 pm
Projects: The Purring Demon's Love, circus eterie
Contact:

Re: Problem with ATL of Main Menu Button

#8 Post by mitoky » Fri Jun 01, 2018 8:38 am

Remix wrote:
Fri Jun 01, 2018 8:20 am
The list of ATL events are:
https://www.renpy.org/doc/html/atl.html#external-events wrote:
The following events can be triggered automatically:

start
A pseudo-event, triggered on entering an on statement, if no event of higher priority has happened.
show
Triggered when the transform is shown using the show or scene statement, and no image with the given tag exists.
replace
Triggered when transform is shown using the show statement, replacing an image with the given tag.
hide

Triggered when the transform is hidden using the hide statement or its python equivalent.

Note that this isn't triggered when the transform is eliminated via the scene statement or exiting the context it exists in, such as when exiting the game menu.
replaced
Triggered when the transform is replaced by another. The image will not actually hide until the ATL block finishes.
update
Triggered when a screen is updated without being shown or replacing another screen. This happens in rare but possible cases, such as when the game is loaded and when styles or translations change.
hover, idle, selected_hover, selected_idle
Triggered when button containing this transform, or a button contained by this transform, enters the named state.
If idle isn't recognized as higher, a basic:

on start, show:
....alpha 1.0

might do you
It doesnt work ):
(unless i understood it wrong, i added:

Code: Select all

on start:
    alpha 1.0

to the transform)

Post Reply

Who is online

Users browsing this forum: Google [Bot], Imperf3kt, rayminator