I have been trying to insert a clock that displays the player's game play time, like in Katawa Shoujo, but I haven't had much luck. I've currently been trying this at the very start of the game:
$ seconds = 0
$ minutes = 0
$ hours = 0
$ ui.timer(1.0, seconds + 1, repeat=True)
and this in my game menu:
if minutes >= 60:
$ hours += 1
$ minutes -= 60
text "[hours]:[seconds]:[seconds]" xalign 0.5 yalign 0.95 style "metext"
My problem is that the clock never adds 1 to the seconds variable. If someone notices a flaw in my programming or knows of an alternative way to create the clock, I would appreciate a response. I've tried looking at some of the other threads here, but they've had the same problem: the second variable remains stuck at 0.
Fixing or replacing a clock that displays in-game play time.
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.
- TheChris
- Regular
- Posts: 47
- Joined: Sat Oct 11, 2014 9:26 pm
- Projects: Stickshooter
- Deviantart: innocencecanceller
- Location: United States
- Contact:
Re: Fixing or replacing a clock that displays in-game play t
Thank you, Alex. I had tried to use renpy.get_game_runtime and renpy.clear_game_runtime before, but it didn't work. Thanks to your links, I think I got it working now. Here's what I'm doing:Alex wrote:This might be useful for you:
http://www.renpy.org/doc/html/other.htm ... me_runtime
http://lemmasoft.renai.us/forums/viewto ... f=8&t=7734
#screen pause is what I have set as the game menu
screen pause_menu:
tag pause
$ gameseconds = int(renpy.get_game_runtime())
$ seconds = gameseconds % 60
$ gameminutes = int(gameseconds/60)
$ minutes = gameminutes % 60
$ hours = int(minutes/60)
text "Gameplay: [hours]hours, [minutes] minutes, and [seconds] seconds" xalign 0.5 yalign 0.95 style "metext"
label start:
$ seconds = 0
$ minutes = 0
$ hours = 0
$ renpy.clear_game_runtime
Who is online
Users browsing this forum: No registered users