Countdown timer with milliseconds

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
abysswatcher
Regular
Posts: 42
Joined: Sun Apr 12, 2020 11:50 pm
Projects: Wind and Spirit
Organization: Monoway Studios
Contact:

Countdown timer with milliseconds

#1 Post by abysswatcher »

I was wondering how to go about making a countdown time with seconds and milliseconds. I just thought it would look better in the game. Is there any way to bring this about in ren'py?
The goal of the revolution is to achieve the people's rights, but during the course of the revolution, we must stress military power - and the two are mutually contradictory.
-Sun Yat-sen
"Become a Visual Novel writer they said, it will be fun" (little did they know they were right)

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: Countdown timer with milliseconds

#2 Post by _ticlock_ »

Hi, abysswatcher,
Screen timer with milliseconds doesn't fit your demands?

Code: Select all

screen countdown(time, timer_jump):
    timer 0.01 repeat True action If(time > 0, true=SetVariable('time', time - 0.01), false=[Hide('countdown'), Jump(timer_jump)])
    text str(time):
        xalign 0.5 
        
label start:
    show screen countdown(20.0, "timeout_label")
    # Your code
      
label timeout_label:
    "Time ended"
Or maybe you prefer using animated bar as in PyTom timed choices

Post Reply

Who is online

Users browsing this forum: No registered users