[Ren'Py] Modding question: Screen overriding?

Viressa

Well-Known Member
May 24, 2018
472
807
So, in my modding, I've been overriding labels using config.label_overrides, so I can have all of my modded labels in a separate RPY file without having to replace the game's existing files. Much cleaner to work this way.

I've been looking for a similar functionality for replacing screens with my own modded versions and have yet to find anything in the documentation. Does it exist?

(Apologies if this is the wrong subforum)
 

anne O'nymous

Well-Known Member
Modder
Respected User
Jun 10, 2017
2,020
2,202
I've been looking for a similar functionality for replacing screens with my own modded versions and have yet to find anything in the documentation. Does it exist?
The answer to your effective question is : No, there's no function to do this.


Now, the answer to the implied question is different. Yes, there's a way to override a screen, but it's a hack, so there's no guaranty that it can works on all futures versions of Ren'py and you need to use it with caution to not break the game.

The screens are stored into the renpy.display.screen.screens dictionary, with keys being a tuple formed with the name of the screen and the expected screen variant ; in 99% of the time, you'll just have to use the default screen variant, so None.

By example, the object representing the screen used for the console is stored here :
Code:
renpy.display.screen.screens[( "_console", None)]
So, to replace it with your "moddedConsole" screen, you need to do :
Code:
renpy.display.screen.screens[( "_console", None)]= renpy.display.screen.screens[( "moddedConsole", None)]
But as I said, it's to use with caution since there isn't watchdogs to prevent you messing with the game. It's you who need to create these watchdogs and ensure that you do things right.
Also note that this manipulation is context related. So, if you do it in the console as test, it shouldn't works since you aren't in the game context. The change should be reverted once you quit the console, and so fallback to the game context. But, obviously, the change is propagated from the current context to any derivative one.
 
  • Like
Reactions: Viressa