Page 1 of 1

renpy.save and renpy.load problem : Rollback error

Posted: Fri Apr 10, 2020 6:02 pm
by JeffSevenDee
Hello
I try to control the Save and Reload of the game using renpy.save and renpy.load instead of the QuickSave-Load/FileSave-Load equivalent found in screen

So I created 2 functions to handle these steps:

Code: Select all

init python:
    
  def DataSave():
    renpy.log("About to Save " + MySaveName)
    renpy.save(MySaveName, save_name)
    return True
      
  def DataLoad():
    if renpy.can_load(MySaveName):
       renpy.log("About to load " + MySaveName)
       renpy.load(MySaveName)
       return True
    else:
       renpy.log("could not find " + MySaveName)       
       return False
During game, SaveData is frequently called right form the script itself, without user internvention.

By redefining main_menu, i've managed to bypass the regular navigation screen:

Code: Select all

label main_menu:
    $ renpy.log("About to load a QuickSaveGame")
    if not DataLoad():
      $ renpy.log("failed, jumping to start")  
      call start
    
    $ renpy.log("Dunno what happens now, we've been able to load game")

    return
When save directory is cleared from previous savegames, the program jumps correctly to label start and runs the game.
The problem comes when reloading: the renpy.can_load function detects correctly the presence of the savegame, tries to load it but fails.
Here is the generated traceback content:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 93, in script
    if not DataLoad():
  File "game/script.rpy", line 93, in <module>
    if not DataLoad():
  File "game/screens.rpy", line 103, in DataLoad
    renpy.load(MySaveName)
Exception: Couldn't find a place to stop rolling back. Perhaps the script changed in an incompatible way?

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 93, in script
    if not DataLoad():
  File "C:\Users\Sandrine\Documents\novel\executables\NovelMakers\renpy-7.0.0-sdk\renpy\ast.py", line 1832, in execute
    if renpy.python.py_eval(condition):
  File "C:\Users\Sandrine\Documents\novel\executables\NovelMakers\renpy-7.0.0-sdk\renpy\python.py", line 2059, in py_eval
    return py_eval_bytecode(code, globals, locals)
  File "C:\Users\Sandrine\Documents\novel\executables\NovelMakers\renpy-7.0.0-sdk\renpy\python.py", line 2052, in py_eval_bytecode
    return eval(bytecode, globals, locals)
  File "game/script.rpy", line 93, in <module>
    if not DataLoad():
  File "game/screens.rpy", line 103, in DataLoad
    renpy.load(MySaveName)
  File "C:\Users\Sandrine\Documents\novel\executables\NovelMakers\renpy-7.0.0-sdk\renpy\loadsave.py", line 770, in load
    log.unfreeze(roots, label="_after_load")
  File "C:\Users\Sandrine\Documents\novel\executables\NovelMakers\renpy-7.0.0-sdk\renpy\python.py", line 1983, in unfreeze
    self.rollback(0, force=True, label=label, greedy=greedy, on_load=True)
  File "C:\Users\Sandrine\Documents\novel\executables\NovelMakers\renpy-7.0.0-sdk\renpy\python.py", line 1815, in rollback
    self.load_failed()
  File "C:\Users\Sandrine\Documents\novel\executables\NovelMakers\renpy-7.0.0-sdk\renpy\python.py", line 1733, in load_failed
    raise Exception("Couldn't find a place to stop rolling back. Perhaps the script changed in an incompatible way?")
Exception: Couldn't find a place to stop rolling back. Perhaps the script changed in an incompatible way?

Windows-8-6.2.9200
Ren'Py 7.3.5.606
Test_NoNavig 1.0
Fri Apr 10 16:51:36 2020
To be honest, I have no clue as to why it happens. Given the error message, I tried to fix it by specifying renpy.checkpoint() and even renpy.fix_rollback() before the renpy.save call, without luck.

Some config changes did not help either:

Code: Select all

define config.rollback_enabled = False
define config.hard_rollback_limit = 0
I'm starting to think it may be related to something else, but at this point, I'm a bit clueless.
Anyone can send some hints ?