[Solved] Timer for an imagebutton.

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
K-PSZH
Regular
Posts: 37
Joined: Sun May 15, 2022 10:34 am
Soundcloud: K-PSZH
Location: Russia
Contact:

[Solved] Timer for an imagebutton.

#1 Post by K-PSZH »

How do I make my button unhoverable for a certain time after the screen appears?
When the screen appears, I have some animations on it and I don't want the button become hovered until the screen animations are over,
Last edited by K-PSZH on Tue May 24, 2022 10:13 am, edited 1 time in total.
Missing/forgetting a lot of simplest things and ask about them here.


User avatar
K-PSZH
Regular
Posts: 37
Joined: Sun May 15, 2022 10:34 am
Soundcloud: K-PSZH
Location: Russia
Contact:

Re: Timer for an imagebutton.

#3 Post by K-PSZH »

Andredron wrote: Tue May 24, 2022 9:18 amCode?

Code: Select all

screen screenn:
    add "gui/screenn/bg1.png" at screenn_bg_1
    add "gui/screenn/bg2.png" at screenn_bg_2
    imagebutton auto "gui/screenn/button_%s.png":
        action Jump("labell")
        xpos 0.625
        ypos 0.61
BG transforms are lasting for 1.5 secs. I want the player not be able to hover the button during these 1.5 seconds. I don't think my code will help better than my first question.
Missing/forgetting a lot of simplest things and ask about them here.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Timer for an imagebutton.

#4 Post by Ocelot »

You can add timer which will enable buttons after some time has passed:

Code: Select all

screen screenn:
    default animation_end = False
    add "gui/screenn/bg1.png" at screenn_bg_1
    add "gui/screenn/bg2.png" at screenn_bg_2
    imagebutton auto "gui/screenn/button_%s.png":
        sensitive animation_end
        action Jump("labell")
        xpos 0.625
        ypos 0.61
    timer 1.5 action SetScreenVariable("animation_end", True)
< < insert Rick Cook quote here > >

User avatar
Andredron
Miko-Class Veteran
Posts: 700
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: Timer for an imagebutton.

#5 Post by Andredron »

Ocelot wrote: Tue May 24, 2022 9:48 am You can add timer which will enable buttons after some time has passed:

Code: Select all

screen screenn:
    default animation_end = False
    add "gui/screenn/bg1.png" at screenn_bg_1
    add "gui/screenn/bg2.png" at screenn_bg_2
    imagebutton auto "gui/screenn/button_%s.png":
        sensitive animation_end
        action Jump("labell")
        xpos 0.625
        ypos 0.61
    timer 1.5 action SetScreenVariable("animation_end", True)
For the first time I hear about the operator, sensitive

User avatar
K-PSZH
Regular
Posts: 37
Joined: Sun May 15, 2022 10:34 am
Soundcloud: K-PSZH
Location: Russia
Contact:

Re: Timer for an imagebutton.

#6 Post by K-PSZH »

Ocelot wrote: Tue May 24, 2022 9:48 am You can add timer which will enable buttons after some time has passed:

Code: Select all

screen screenn:
    default animation_end = False
    add "gui/screenn/bg1.png" at screenn_bg_1
    add "gui/screenn/bg2.png" at screenn_bg_2
    imagebutton auto "gui/screenn/button_%s.png":
        sensitive animation_end
        action Jump("labell")
        xpos 0.625
        ypos 0.61
    timer 1.5 action SetScreenVariable("animation_end", True)
Amazing. Thanks!
Missing/forgetting a lot of simplest things and ask about them here.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Kocker, Starberries