How to customize the timer for menu choices.[SOLVED]

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
Kiriyama
Newbie
Posts: 5
Joined: Fri Aug 08, 2014 5:54 pm
Projects: Shining Days, Psycho~Mind
Organization: Code Genesis Group
Skype: colt.sake
Location: Porto-Alegre, Brazil
Contact:

How to customize the timer for menu choices.[SOLVED]

#1 Post by Kiriyama »

Hello, I need help to customize the timer(color, size, maybe my own bar) Any ideas?
I've been using this code:

Code: Select all

transform alpha_dissolve:
    alpha 0.0
    linear 0.5 alpha 1.0
    on hide:
        linear 0.5 alpha 0

screen countdown:
    timer 0.01 repeat True action If(time > 0, true=SetVariable('time', time - 0.01), false=[Hide('countdown'), Jump(timer_jump)])
    bar value time range timer_range xalign 0.5 yalign 0.9 xmaximum 300 at alpha_dissolve # This is the timer bar.
Thank you for your time. :)
Last edited by Kiriyama on Mon Mar 02, 2015 12:49 am, edited 1 time in total.


User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: How to customize the timer for menu choices.

#3 Post by trooper6 »

Have you looked at the Renpy Tutorial?

Under Dynamic Displayables, there is a countdown timer that changes color and size is also specified.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
Kiriyama
Newbie
Posts: 5
Joined: Fri Aug 08, 2014 5:54 pm
Projects: Shining Days, Psycho~Mind
Organization: Code Genesis Group
Skype: colt.sake
Location: Porto-Alegre, Brazil
Contact:

Re: How to customize the timer for menu choices.

#4 Post by Kiriyama »

I tried with this code, but it didn't work. :/
trooper6 wrote:Have you looked at the Renpy Tutorial?

Under Dynamic Displayables, there is a countdown timer that changes color and size is also specified.
Yes, but it's not the same for a bar. The code's completely different. :(

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: How to customize the timer for menu choices.

#5 Post by trooper6 »

That code would help you with the timer part of your question. You wanted to change the color and size of your timer and the timer in that example goes from white to red and also has the declaration of text size.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

CupCakeComedy
Regular
Posts: 26
Joined: Sun Feb 22, 2015 7:46 pm
Contact:

Re: How to customize the timer for menu choices.

#6 Post by CupCakeComedy »

Ow. Maybe you want just to style the bar, to have a different style from the basic theme.
Is that you're asking?

If that, do this:

Code: Select all

screen countdown:
    timer 0.01 repeat True action If(time > 0, true=SetVariable('time', time - 0.01), false=[Hide('countdown'), Jump(timer_jump)]) 
    bar value time range timer_range xalign 0.5 yalign 0.9 xmaximum 300 at alpha_dissolve style "timer_bar"

init -2:
    style timer_bar:
        is default
        left_bar=Image("myleftbar.png") #an example
    #[continue with all the styles you need to change]
I hope I'm correct, it appear you just want to create a different style for that.

User avatar
Kiriyama
Newbie
Posts: 5
Joined: Fri Aug 08, 2014 5:54 pm
Projects: Shining Days, Psycho~Mind
Organization: Code Genesis Group
Skype: colt.sake
Location: Porto-Alegre, Brazil
Contact:

Re: How to customize the timer for menu choices.

#7 Post by Kiriyama »

CupCakeComedy wrote: I hope I'm correct, it appear you just want to create a different style for that.
Now I'm using:

Code: Select all

screen countdown:
    timer 0.01 repeat True action If(time > 0, true=SetVariable('time', time - 0.01), false=[Hide('countdown'), Jump(timer_jump)]) 
    bar value time range timer_range xalign 0.5 yalign 0.9 xmaximum 300 at alpha_dissolve style "timer_bar"

init -2:
    style timer_bar:
        is default
        left_bar=Image("bar.png")
        right_bar=Image("bar2.png")
        thumb=Image("bar3.png")
But...
File "game/script.rpy", line 69: expected 'simple_expression' not found.
left_bar=Image("bar.png")

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: How to customize the timer for menu choices.

#8 Post by PyTom »

The style statement doesn't use =s, and you probably don't need init -2 here.

Code: Select all

style timer_bar:
    is default
    left_bar Image("bar.png")
    right_bar Image("bar2.png")
    thumb Image("bar3.png")
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
Kiriyama
Newbie
Posts: 5
Joined: Fri Aug 08, 2014 5:54 pm
Projects: Shining Days, Psycho~Mind
Organization: Code Genesis Group
Skype: colt.sake
Location: Porto-Alegre, Brazil
Contact:

Re: How to customize the timer for menu choices.

#9 Post by Kiriyama »

PyTom wrote:The style statement doesn't use =s, and you probably don't need init -2 here.

Code: Select all

style timer_bar:
    is default
    left_bar Image("bar.png")
    right_bar Image("bar2.png")
    thumb Image("bar3.png")
Thanks! :D

Post Reply

Who is online

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