[SOLVED] Handling an error

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Post Reply
Message
Author
Galo223344
Newbie
Posts: 4
Joined: Tue Sep 26, 2023 1:53 pm
Contact:

[SOLVED] Handling an error

#1 Post by Galo223344 »

My script changed, so now sometimes players will get the exception: "Couldn't find a place to stop rolling back. Perhaps the script changed in an incompatible way?" when loading a save file, I would like to handle this error by telling them that their save fils is incompatible and sending them to the main menu instead of showing an error screen and then hard-crashing. Is there any way for me to do this? I tried using after_load but the exception occurs before after_load takes place oddly enough.

Any help is appreciated! :D
Last edited by Galo223344 on Tue Dec 19, 2023 4:41 pm, edited 1 time in total.

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Handling an error

#2 Post by Donmai »

Click the "force recompile" button on the RenPy Launcher screen, and see if it helps.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

Galo223344
Newbie
Posts: 4
Joined: Tue Sep 26, 2023 1:53 pm
Contact:

Re: Handling an error

#3 Post by Galo223344 »

Oh, I don't want to fix the "Couldn't find a place to stop rolling back" (Unless it's posible) since the script did in fact change between versions. I just want to tell something else to the player besides a big exception screen.

enaielei
Veteran
Posts: 293
Joined: Fri Sep 17, 2021 2:09 am
Organization: enaielei
Tumblr: enaielei
Deviantart: enaielei
Github: enaielei
Skype: enaielei
Soundcloud: enaielei
itch: enaielei
Discord: enaielei#7487
Contact:

Re: Handling an error

#4 Post by enaielei »

https://www.renpy.org/doc/html/config.html#var-config.exception_handler
Also, you can compare your saves' version to the current config.version or list of incompatible versions and identify yourself whether that save is compatible or not.

Code: Select all

define config.version = "2.0"
define incompatible_versions = ["1.0"]

screen file_slot(...):
    ...
    if FileJson(slot)["_version"] in incompatible_versions:
        text "Incompatible"

Galo223344
Newbie
Posts: 4
Joined: Tue Sep 26, 2023 1:53 pm
Contact:

Re: Handling an error

#5 Post by Galo223344 »

enaielei wrote: Mon Dec 18, 2023 10:34 pm https://www.renpy.org/doc/html/config.html#var-config.exception_handler
Also, you can compare your saves' version to the current config.version or list of incompatible versions and identify yourself whether that save is compatible or not.

Code: Select all

define config.version = "2.0"
define incompatible_versions = ["1.0"]

screen file_slot(...):
    ...
    if FileJson(slot)["_version"] in incompatible_versions:
        text "Incompatible"
That's exactly what I was looking for, thank you very much! :D

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]