Ren'Py Issues after a Ren'Py update

JohnDupont

Active Member
Modder
May 26, 2017
807
2,712
Hi,

One of the games I'm modding switched from version 7.1.3 of Ren'Py to version 7.3.0 . It resulted in two issues but I can't find the reason in the changelogs:

I'm getting a Line is indented, but the preceding tag statement does not expect a block. Please check this line's indentation. error because of screens using a tag like screen main_menu() tag menu:.
I managed to solve the issue by rewriting it:
Code:
screen main_menu():
    tag menu
Note that these errors don't occur when using the main game. I find this extremely weird.
You don't have permission to view the spoiler content. Log in or register now.

The second problem is with a timer not counting down anymore:
Code:
timer 1 repeat True action If(JDMOD_time > 0, true=SetVariable("JDMOD_time", JDMOD_time - 1), false=SetVariable("JDMOD_time", 0))
The last documented change to the timers I could find was in 6.1.3...
 
  • Like
Reactions: -Loli-Ghost-

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,171
I managed to solve the issue by rewriting it:
Code:
screen main_menu():
    tag menu
Note that these errors don't occur when using the main game. I find this extremely weird.
What do you mean by "don't occur when using the main game" ? Is it that the game works while the code of the screens looks like this, or is it that there's rpy scripts containing this kind of lines that "compile" ?
Because the rpyc files are regenerated only if the code in the rpy file have changed. So, if it's the first case, the files can simply come from the previous version of the game, and so have been generated before Ren'py now find this syntax invalid.


The second problem is with a timer not counting down anymore:
Code:
timer 1 repeat True action If(JDMOD_time > 0, true=SetVariable("JDMOD_time", JDMOD_time - 1), false=SetVariable("JDMOD_time", 0))
The last documented change to the timers I could find was in 6.1.3...
Is it working with this syntax timer 1 repeat True action If(JDMOD_time > 0, SetVariable("JDMOD_time", JDMOD_time - 1), SetVariable("JDMOD_time", 0)) ?
 
  • Like
Reactions: JohnDupont

JohnDupont

Active Member
Modder
May 26, 2017
807
2,712
What do you mean by "don't occur when using the main game" ? Is it that the game works while the code of the screens looks like this, or is it that there's rpy scripts containing this kind of lines that "compile" ?
Because the rpyc files are regenerated only if the code in the rpy file have changed. So, if it's the first case, the files can simply come from the previous version of the game, and so have been generated before Ren'py now find this syntax invalid.
I'll try to clarify the sentence "Note that these errors don't occur when using the main game":

The game use the syntax screen main_menu() tag menu: which doesn't cause any error at launch.
By the way, the .rpy file containing this line was modified in the last version, therefore I don't think "the files can simply come from the previous version of the game, and so have been generated before Ren'py now find this syntax invalid" can apply.

The mod is non-intrusive and doesn't modify the game files. It uses the same syntax as the game in the line screen gallery() tag menu: but, this time, it causes not only the following error:
Code:
File "game/JDMOD/scripts/gallery/GalleryMenu.rpy", line 122: Line is indented, but the preceding tag statement does not expect a block. Please check this line's indentation.
    key "game_menu" action NullAction()
But also all the error listed in the OP:
Code:
File "game/screens.rpy", line 353: Line is indented, but the preceding tag statement does not expect a block. Please check this line's indentation.
    style_prefix "main_menu"
    ^

File "game/screens.rpy", line 547: Line is indented, but the preceding tag statement does not expect a block. Please check this line's indentation.
    use game_menu(_("About"), scroll="viewport"):
    ^

File "game/screens.rpy", line 594: Line is indented, but the preceding tag statement does not expect a block. Please check this line's indentation.
    use file_slots(_("Save"))
    ^

File "game/screens.rpy", line 601: Line is indented, but the preceding tag statement does not expect a block. Please check this line's indentation.
    use file_slots(_("Load"))
    ^

File "game/screens.rpy", line 771: Line is indented, but the preceding tag statement does not expect a block. Please check this line's indentation.
    if renpy.mobile:
    ^

File "game/screens.rpy", line 944: Line is indented, but the preceding tag statement does not expect a block. Please check this line's indentation.
    predict False
    ^

File "game/screens.rpy", line 1025: Line is indented, but the preceding tag statement does not expect a block. Please check this line's indentation.
    default device = "keyboard"
As stated in the OP, the only way to fix this problem was to modify not only the line in game/JDMOD/scripts/gallery/GalleryMenu.rpy but also all the lines in game/screens.rpy (Fixing only the line in game/JDMOD/scripts/gallery/GalleryMenu.rpy didn't solve the issue).
What I don't understand is how adding this line in game/JDMOD/scripts/gallery/GalleryMenu.rpy can cause issues with lines in game/screens.rpy.


Is it working with this syntax timer 1 repeat True action If(JDMOD_time > 0, SetVariable("JDMOD_time", JDMOD_time - 1), SetVariable("JDMOD_time", 0)) ?
This solution didn't work. But don't worry about it, I can live without the timer.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,171
The mod is non-intrusive and doesn't modify the game files.
[...]
But also all the error listed in the OP:
Code:
File "game/screens.rpy", line 353: Line is indented, but the preceding tag statement [...]
File "game/screens.rpy", line 547: Line is indented, but the preceding tag statement [...]
File "game/screens.rpy", line 594: Line is indented, but the preceding tag statement [...]
File "game/screens.rpy", line 601: Line is indented, but the preceding tag statement [...]
File "game/screens.rpy", line 771: Line is indented, but the preceding tag statement [...]
File "game/screens.rpy", line 944: Line is indented, but the preceding tag statement [...]
File "game/screens.rpy", line 1025: Line is indented, but the preceding tag statement [...]
Alright, this, I was able to reproduce it. The version 7.3.0 (and only this one) effectively have a problem if the tag property is part of the screen declaration line. And, I stand on what I said regarding the games screens. The fact that at least one of them have been modified since the last update doesn't mean that the file haven't been "compiled" with a version prior to the 7.3.0.
There's enough times between two releases, to firstly modify the screens, then later think that an update of Ren'py can also be a good idea.


This solution didn't work. But don't worry about it, I can live without the timer.
But this isn't something that should happen. The code I gave works without problem on Ren'py 7.3.0, I tested it. Therefore, the issue you have with the timer don't come from the timer itself.
This said, according to the changelog, one of the fixes in the version 7.3.1 regard update of the screens :
This release fixes a fairly major issue that could cause screens that interpolate text to not update, or update improperly.
So, it's possible that the timer works fine, and that it's in fact JDMOD_time that isn't displayed correctly.
 
  • Like
Reactions: JohnDupont

JohnDupont

Active Member
Modder
May 26, 2017
807
2,712
Alright, this, I was able to reproduce it. The version 7.3.0 (and only this one) effectively have a problem if the tag property is part of the screen declaration line. And, I stand on what I said regarding the games screens. The fact that at least one of them have been modified since the last update doesn't mean that the file haven't been "compiled" with a version prior to the 7.3.0.
There's enough times between two releases, to firstly modify the screens, then later think that an update of Ren'py can also be a good idea.
Good to know.

I just found out something even weirder:
I install the fixed version (the one with tag menu in a separate line) of game/JDMOD/scripts/gallery/GalleryMenu.rpyc and game/screens.rpyc. I made sure to delete all the rpy and rpyc files beforehand.
I then launched the game: no error as expected.
I exited the game and tried launching it again: the errors were back. I notice un.rpyc was in the folder.

I tried both steps again without un.rpyc and I didn't get the error.
I also tried deleting the rpy files and I didn't get the error either.

What happens is:
  1. The first time, un.rpyc decompiles the rpyc files into rpy files. But the game launches from the rpyc. Therefore I'm not getting an error because the game uses the fixed version.
  2. The second time, the game uses the newly created rpy files.
I'm certain that Ren'Py compiles the files incorrectly or that un.rpyc decompiles the files incorrectly.
I included 3 files if you want to check them out:
  1. The fixed version screens.rpy
  2. The compiled fixed version screens.rpyc
  3. The decompiled fixed version screens (after compilingdecompiling).rpy

But this isn't something that should happen. The code I gave works without problem on Ren'py 7.3.0, I tested it. Therefore, the issue you have with the timer don't come from the timer itself.
This said, according to the changelog, one of the fixes in the version 7.3.1 regard update of the screens :

So, it's possible that the timer works fine, and that it's in fact JDMOD_time that isn't displayed correctly.
Thanks. You're certainly right, the screen doesn't update which means I can't solve this issue as long as the game is using 7.3.0.
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,171
I'm certain that Ren'Py compiles the files incorrectly
Totally impossible. Technically Ren'py compile nothing. In short, what it do is to save a copy of the code as stored in the memory. So, if it "compiled" incorrectly, then the game simply wouldn't works.


or that un.rpyc decompiles the files incorrectly.
It's what happen here. For some reason, unrpyc assume that the tag property must be on the declaration line.
 
  • Like
Reactions: JohnDupont

the66

beware, the germans are cumming
Modder
Donor
Respected User
Jan 27, 2017
7,655
23,746
Python:
screen timertest():

    default timerVar = 10.

    text "[timerVar:.2f]" align (.5, .5) #just some output and as proof to not use the timer statement as accurate time measurement
    
    timer .01 repeat True action [SetScreenVariable("timerVar", timerVar - .01), If(timerVar <= 0, Hide("timertest"))]
is working absolutely as intended in Ren'Py 7.3.2