Hello.
I would like to ask if there is some examples to make a timer code, it seems that i forgot how to do it or what site that i had visited ast month, and i want a timer in text/number will be displayed at top right.
Thanks.
How to make a timer?
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.
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.
- isobellesophia
- Miko-Class Veteran
- Posts: 979
- Joined: Mon Jan 07, 2019 2:55 am
- Completed: None
- Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
- Organization: Friendly Teachers series
- Deviantart: SophBelle
- itch: Child Creation
- Location: Philippines, Mindanao
- Contact:
-
- Miko-Class Veteran
- Posts: 793
- Joined: Fri Feb 09, 2018 12:05 am
- Location: Canada
- Contact:
Re: How to make a timer?
here are some here for you to look at
viewtopic.php?t=13381
viewtopic.php?f=8&t=42301&p=442246
and there is more here
viewtopic.php?f=51&t=34131
just play around and revers it somehow to change it a timer or do want a countdown timer
viewtopic.php?t=13381
viewtopic.php?f=8&t=42301&p=442246
and there is more here
viewtopic.php?f=51&t=34131
just play around and revers it somehow to change it a timer or do want a countdown timer
-
- Veteran
- Posts: 339
- Joined: Wed Sep 24, 2014 5:03 pm
- Organization: Wild Rose Interactive
- Contact:
Re: How to make a timer?
There is a timer in Screen Language now. The only issue is that it doesn't have any visuals by default. It's not clear what the variables for the timer are, so I went splunking through the code. Unfortunately, even after going through screen_language, ui, game, and behavior, I can't find where the timer decrementing is handled. My guess is that the variable is in TimerState() or Timer(), which I can't locate at the moment.
Either way, the code to put a timer on the screen should be:
I just need to find the name of that variable.
Edit:Solved in another thread. False alarm. That's for a timer where the delay is shown.
Either way, the code to put a timer on the screen should be:
Code: Select all
screen showtimer():
vbox:
spacing 15
timer 3.0 action Jump("too_slow")
text "TIME REMAINING: %d SECONDS" % (whatever_the_variable_is)
Edit:
- hell_oh_world
- Miko-Class Veteran
- Posts: 777
- Joined: Fri Jul 12, 2019 5:21 am
- Contact:
Re: How to make a timer?
Code: Select all
screen my_timer(timeout):
default time = timeout
if time != 0:
timer 1.0 repeat True action SetScreenVariable("time", time - 1)
# else:
# timer 0.01 action Hide("my_timer") # add these two lines of code if you want the timer to disappear automatically.
text str(time) align (0.5, 0.5)
label start:
show screen my_timer(5.0)
"some dialogue"
hide screen my_timer
-
- Veteran
- Posts: 339
- Joined: Wed Sep 24, 2014 5:03 pm
- Organization: Wild Rose Interactive
- Contact:
Re: How to make a timer?
Thank you, hell_oh_world!
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot]