Ren'Py How do I properly change a script? If I make literally any change to the file the game won't start.

notthepolice

New Member
Oct 15, 2018
5
0
I want to rewrite some dialogue, and maybe add a few lines. From the limited research I've done it seems like it should be as easy as opening the file in a text editor and making the changes. However, when I try to do this with the 'scripts.rpa' file I get this error:

I'm sorry, but an uncaught exception occurred.

Before loading the script.
error: Error -3 while decompressing data: invalid distance too far back

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

Full traceback:
File "renpy/bootstrap.py", line 331, in bootstrap
renpy.main.main()
File "renpy/main.py", line 427, in main
renpy.loader.index_archives()
File "renpy/loader.py", line 244, in index_archives
index = handler.read_index(f)
File "renpy/loader.py", line 129, in read_index
index = loads(zlib.decompress(infile.read()))
error: Error -3 while decompressing data: invalid distance too far back

It seems any change at all causes it too. For example: if I change a line of dialogue from "Hi" to "Hello" and touch nothing else the game won't start.

Any savvy people know what causes this? My best guess as a total software noob is that the game needs to be recompiled or something.
 

Count Morado

Conversation Conqueror
Respected User
Jan 21, 2022
6,985
13,026
I want to rewrite some dialogue, and maybe add a few lines. From the limited research I've done it seems like it should be as easy as opening the file in a text editor and making the changes. However, when I try to do this with the 'scripts.rpa' file I get this error:

I'm sorry, but an uncaught exception occurred.

Before loading the script.
error: Error -3 while decompressing data: invalid distance too far back

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

Full traceback:
File "renpy/bootstrap.py", line 331, in bootstrap
renpy.main.main()
File "renpy/main.py", line 427, in main
renpy.loader.index_archives()
File "renpy/loader.py", line 244, in index_archives
index = handler.read_index(f)
File "renpy/loader.py", line 129, in read_index
index = loads(zlib.decompress(infile.read()))
error: Error -3 while decompressing data: invalid distance too far back

It seems any change at all causes it too. For example: if I change a line of dialogue from "Hi" to "Hello" and touch nothing else the game won't start.

Any savvy people know what causes this? My best guess as a total software noob is that the game needs to be recompiled or something.
You should learn about the file structure of Ren'Py before messing with anything.
  • An RPA file is a compressed archive file for Ren'Py.
  • An RPYC file is a compiled script file (script as in coding - which includes the dialogue/narration but also how the game is to run)
  • An RPY file is a script file (again, script as in coding), not compiled <-- these include the files which get edited/revised to change dialogue/narration.
However, before you mess with the RPY files, I point to my first sentence.
----------------------------------------------------
Edit - Example of a story within a script file
RPYC --
1676817162233.png
After being decompiled, as an RPY --
1676817148148.png
 
Last edited:
  • Like
Reactions: notthepolice

notthepolice

New Member
Oct 15, 2018
5
0
Turns out that was the issue. I managed to get it working after decompiling everything.

Thanks for the help.