The custom sl element is a button. The button works fine most of the time, but sometime this exception would occur: AttributeError: 'NoneType' object has no attribute 'copy_on_change' when the button is pressed. The trigger seems to be when the custom sl element is hidden.
Interestingly, adding blank lines/comments to the file with the screen where the bug occurs "temporarily" fixes the bug, so it might have something to do with the cache.
To reproduce the bug, try this project file:
https://drive.google.com/file/d/1lJjBkD ... sp=sharing
1. At the main menu, press "Battle Test", and click 4 times to reach the battle menu. ATTACK, and RUN trigger the exception, but ANALYZE doesn't.
2. Now close the game and modify game/battle.rpy (by adding blank lines or comments), save the file, then reload the game.
3. ATTACK and RUN should now work properly.
4. Now close the game, and reload the game.
5. ATTACK and RUN should cause the exception again. Very bizzare!
This reproduction is consistent on my end, hopefully it is for you too.
The custom button screen is "btn" in templates.rpy
The renpy.register_sl_statement is in 000.rpy
Here's the full traceback:
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/battle.rpy", line 53, in script call
call battle()
File "game/battle.rpy", line 108, in script call
call battle_loop
File "game/battle.rpy", line 121, in script
call screen battle_action
File "renpy/common/000statements.rpy", line 570, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
File "game/battle.rpy", line 176, in copy_on_change
screen battle_action():
File "game/battle.rpy", line 178, in copy_on_change
frame:
File "game/battle.rpy", line 185, in copy_on_change
fixed:
File "game/battle.rpy", line 187, in copy_on_change
frame:
File "game/battle.rpy", line 190, in copy_on_change
hbox:
AttributeError: 'NoneType' object has no attribute 'copy_on_change'
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/battle.rpy", line 53, in script call
call battle()
File "game/battle.rpy", line 108, in script call
call battle_loop
File "game/battle.rpy", line 121, in script
call screen battle_action
File "renpy/ast.py", line 1969, in execute
self.call("execute")
File "renpy/ast.py", line 1957, in call
return renpy.statements.call(method, parsed, *args, **kwargs)
File "renpy/statements.py", line 278, in call
return method(parsed, *args, **kwargs)
File "renpy/common/000statements.rpy", line 570, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
File "renpy/exports.py", line 2983, in call_screen
rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward)
File "renpy/ui.py", line 298, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "renpy/display/core.py", line 3113, in interact
scene_lists.replace_transient()
File "renpy/display/core.py", line 914, in replace_transient
self.remove(layer, tag, prefix=prefix)
File "renpy/display/core.py", line 1223, in remove
self.hide_or_replace(layer, remove_index, prefix)
File "renpy/display/core.py", line 1139, in hide_or_replace
d = oldsle.displayable._hide(now - st, now - at, prefix)
File "renpy/display/screen.py", line 505, in _hide
self.screen.ast.copy_on_change(self.cache.get(0, {}))
File "game/battle.rpy", line 176, in copy_on_change
screen battle_action():
File "game/battle.rpy", line 178, in copy_on_change
frame:
File "game/battle.rpy", line 185, in copy_on_change
fixed:
File "game/battle.rpy", line 187, in copy_on_change
frame:
File "game/battle.rpy", line 190, in copy_on_change
hbox:
File "renpy/sl2/slast.py", line 2176, in copy_on_change
self.ast.copy_on_change(c)
AttributeError: 'NoneType' object has no attribute 'copy_on_change'
Windows-10-10.0.19041
Ren'Py 7.4.4.1439
BUGTEST 1
Mon May 17 14:34:49 2021