Could you provide the code you have so far?initialzero wrote: ↑Sat Jul 24, 2021 2:20 pm Unfortunately nothing happens while playing the game.
I put the code before label start.
Is there a better solution to solve it?
Inactivity Timer in a RenPy Game
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.
Re: Inactivity Timer in a RenPy Game
-
- Regular
- Posts: 27
- Joined: Fri Jul 08, 2016 6:53 am
- Contact:
Re: Inactivity Timer in a RenPy Game
Thank you for your solution! It is possible to use the call reset_timer as a global timer for the whole game? It would be crazy to set for each line this call function.PyTom wrote: ↑Sat Jul 24, 2021 3:11 pm Here's my go at it, based on Alex's version.
In this version, calls to reset_timer reset the timer.Code: Select all
screen activity_timer(): default warning = False timer 10.0 action SetScreenVariable("warning", True) timer 15.0 action MainMenu(confirm=False) if warning: text "Timeout in 5 seconds!" label reset_timer: hide screen activity_timer show screen activity_timer return label start: scene bg washington call reset_timer "First choice." call reset_timer "Hard mode - two choices, one timer." "And choice 2." call reset_timer "Part 3." return
Note there's an accessibility issue here. While it might make sense to use this to reset a game in a demo setting, trying to increase game challenge with timers like this hurts people who might not speak the language the game is written in. (As well is people with cognitive disabilities, people with screaming children, etc.)
-
- Regular
- Posts: 27
- Joined: Fri Jul 08, 2016 6:53 am
- Contact:
Re: Inactivity Timer in a RenPy Game
Alex wrote: ↑Sat Jul 24, 2021 3:12 pmCould you provide the code you have so far?initialzero wrote: ↑Sat Jul 24, 2021 2:20 pm Unfortunately nothing happens while playing the game.
I put the code before label start.
Is there a better solution to solve it?
Code: Select all
# The game starts here.
screen main_menu_timer():
timer 5.0 action MainMenu(confirm=False)
key 'dismiss' action [Hide("main_menu_timer"), Show("main_menu_timer")]
label start:
#image animation:
# "animation.jpg"
# 0.5
# "animation2.jpg"
# 0.5
# "animation3.jpg"
# repeat
scene img6
with fade
#show animation
play music "001.ogg" loop
$ renpy.music.set_volume(1.0, 0, channel="music")
# 0001 Welcome to Blabla College!
"With the soft breeze waving through his h"
"Bla blabla can't help but smile to himself."
Re: Inactivity Timer in a RenPy Game
Should beinitialzero wrote: ↑Sat Jul 24, 2021 3:25 pmCode: Select all
key 'dismiss' action [Hide("main_menu_timer"), Show("main_menu_timer")]
Code: Select all
key 'dismiss' action [Hide("main_menu_timer"), Show("main_menu_timer"), Return()]
-
- Regular
- Posts: 27
- Joined: Fri Jul 08, 2016 6:53 am
- Contact:
Re: Inactivity Timer in a RenPy Game
Thank you! Now it is running as it should be. The next bug is that the sound of clicking the start button will repeat after every bla bla lines in the game. I think there is a loop bug after using this code and it cant be solved.Alex wrote: ↑Sat Jul 24, 2021 3:37 pmShould beinitialzero wrote: ↑Sat Jul 24, 2021 3:25 pmCode: Select all
key 'dismiss' action [Hide("main_menu_timer"), Show("main_menu_timer")]
Code: Select all
key 'dismiss' action [Hide("main_menu_timer"), Show("main_menu_timer"), Return()]
Code: Select all
## Buttons #####################################################################
##
## These variables, along with the image files in gui/button, control aspects of
## how buttons are displayed.
define gui.hover_sound = "gui/sfx/hover.ogg"
define gui.activate_sound = "gui/sfx/select.ogg"
1. I could deactivate the sound
or
2. to reset the game and let the scripts start from the beginning like a rollback? Is there something like "action rollback" instead of "action mainmenu"?
https://www.renpy.org/doc/html/save_load_rollback.html
Who is online
Users browsing this forum: Ahrefs [Bot], DewyNebula, Google [Bot]