Code: Select all
default playtime = 0
init python:
def save_playtime(d):
renpy.store.playtime += renpy.get_game_runtime()
renpy.clear_game_runtime()
d["playtime"] = renpy.store.playtime
config.save_json_callbacks = [save_playtime]
screen file_slots(title):
imagebutton:
idle "gui/backgrounds/return_bg.png"
hover "gui/backgrounds/return_bg.png"
action Hide("save")
add "gui/backgrounds/notesbg.png" at app_open xalign 0.5
default page_name_value = FilePageNameInputValue(pattern=_("Page {}"), auto=_("Automatic saves"), quick=_("Quick saves"))
frame at app_open:
background None
viewport:
xpos 0
ypos 50
xfill False
yfill False
ymaximum 550
mousewheel True
grid gui.file_slot_cols gui.file_slot_rows at app_open:
style_prefix "slot"
xalign 0.5
yalign 0.5
spacing gui.slot_spacing
for i in range(gui.file_slot_cols * gui.file_slot_rows):
$ slot = i + 1
button:
action [SetVariable("save_name", "%s"%calendar.string3()), FileAction(slot)]
has vbox
text FileSaveName(slot):
font "gui/fonts/Lato-Bold.ttf"
color "#9D755A"
$ playtime = FileJson(slot, "playtime", empty=0, missing=0) ## deleting this line got rid of the ValueError if that helps at all
$ minutes, seconds = divmod(int(playtime), 60)
$ hours, minutes = divmod(minutes, 60)
text "[hours]:[minutes]"
key "save_delete" action FileDelete(slot)Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 560, in script call
call roomload
File "game/technical.rpy", line 220, in script
$ renpy.call_screen(place + "_" + current_room + "int")
File "game/technical.rpy", line 220, in <module>
$ renpy.call_screen(place + "_" + current_room + "int")
File "game/screens.rpy", line 615, in execute
screen save():
File "game/screens.rpy", line 615, in execute
screen save():
File "game/screens.rpy", line 619, in execute
use file_slots(_("Save"))
File "game/screens.rpy", line 629, in execute
screen file_slots(title):
File "game/screens.rpy", line 629, in execute
screen file_slots(title):
File "game/screens.rpy", line 637, in execute
frame at app_open:
File "game/screens.rpy", line 639, in execute
viewport:
File "game/screens.rpy", line 647, in execute
grid gui.file_slot_cols gui.file_slot_rows at app_open:
File "game/screens.rpy", line 655, in execute
for i in range(gui.file_slot_cols * gui.file_slot_rows):
File "game/screens.rpy", line 659, in execute
button:
File "game/screens.rpy", line 662, in execute
has vbox
File "game/screens.rpy", line 668, in execute
$ minutes, seconds = divmod(int(playtime), 60)
File "game/screens.rpy", line 668, in <module>
$ minutes, seconds = divmod(int(playtime), 60)
ValueError: invalid literal for int() with base 10: '[hours_display] : [minutes_display]'
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script.rpy", line 560, in script call
call roomload
File "game/technical.rpy", line 220, in script
$ renpy.call_screen(place + "_" + current_room + "int")
File "C:\Users\thepr\Downloads\renpy-7.4.11-sdk\renpy\ast.py", line 1131, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "C:\Users\thepr\Downloads\renpy-7.4.11-sdk\renpy\python.py", line 1049, in py_exec_bytecode
exec(bytecode, globals, locals)
File "game/technical.rpy", line 220, in <module>
$ renpy.call_screen(place + "_" + current_room + "int")
File "C:\Users\thepr\Downloads\renpy-7.4.11-sdk\renpy\exports.py", line 3161, in call_screen
rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward)
File "C:\Users\thepr\Downloads\renpy-7.4.11-sdk\renpy\ui.py", line 299, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "C:\Users\thepr\Downloads\renpy-7.4.11-sdk\renpy\display\core.py", line 3377, in interact
repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, **kwargs) # type: ignore
File "C:\Users\thepr\Downloads\renpy-7.4.11-sdk\renpy\display\core.py", line 3804, in interact_core
root_widget.visit_all(lambda i : i.per_interact())
File "C:\Users\thepr\Downloads\renpy-7.4.11-sdk\renpy\display\core.py", line 582, in visit_all
d.visit_all(callback, seen)
File "C:\Users\thepr\Downloads\renpy-7.4.11-sdk\renpy\display\core.py", line 582, in visit_all
d.visit_all(callback, seen)
File "C:\Users\thepr\Downloads\renpy-7.4.11-sdk\renpy\display\core.py", line 582, in visit_all
d.visit_all(callback, seen)
File "C:\Users\thepr\Downloads\renpy-7.4.11-sdk\renpy\display\screen.py", line 451, in visit_all
callback(self)
File "C:\Users\thepr\Downloads\renpy-7.4.11-sdk\renpy\display\core.py", line 3804, in <lambda>
root_widget.visit_all(lambda i : i.per_interact())
File "C:\Users\thepr\Downloads\renpy-7.4.11-sdk\renpy\display\screen.py", line 462, in per_interact
self.update()
File "C:\Users\thepr\Downloads\renpy-7.4.11-sdk\renpy\display\screen.py", line 653, in update
self.screen.function(**self.scope)
File "game/screens.rpy", line 615, in execute
screen save():
File "game/screens.rpy", line 615, in execute
screen save():
File "game/screens.rpy", line 619, in execute
use file_slots(_("Save"))
File "game/screens.rpy", line 629, in execute
screen file_slots(title):
File "game/screens.rpy", line 629, in execute
screen file_slots(title):
File "game/screens.rpy", line 637, in execute
frame at app_open:
File "game/screens.rpy", line 639, in execute
viewport:
File "game/screens.rpy", line 647, in execute
grid gui.file_slot_cols gui.file_slot_rows at app_open:
File "game/screens.rpy", line 655, in execute
for i in range(gui.file_slot_cols * gui.file_slot_rows):
File "game/screens.rpy", line 659, in execute
button:
File "game/screens.rpy", line 662, in execute
has vbox
File "game/screens.rpy", line 668, in execute
$ minutes, seconds = divmod(int(playtime), 60)
File "game/screens.rpy", line 668, in <module>
$ minutes, seconds = divmod(int(playtime), 60)
ValueError: invalid literal for int() with base 10: '[hours_display] : [minutes_display]'
Windows-10-10.0.22000 AMD64
Ren'Py 8.0.1.22070801
Sweet Release 1.0
Sat Jul 30 15:21:55 2022