- Sep 7, 2022
- 6,729
- 10,073
I'm trying to find a way to access an existing screen's variables without modifying that screen; this is for purposes of a mod where I want everything to be contained in an add-on rpy file without having to overwrite the original game.
From what I read in the renpy documentation, the "use" command allows one screen to include another - but is there a way to read/write its variables without having them originally set as local variables in the original screen's parameter list?
For example, if the existing game has:
I then want my external screen contained in my mod file to be able to access "turnedOn", in a manner like:
As it's written now, the original screen's variables arent defined in the scope of mod screen, and using SetLocalVariable also doesn't seem to work, so is there another way to access those vars without modifying the script file containing "baseGameScreen"?
From what I read in the renpy documentation, the "use" command allows one screen to include another - but is there a way to read/write its variables without having them originally set as local variables in the original screen's parameter list?
For example, if the existing game has:
Python:
screen baseGameScreen:
default turnedOn = False
if turnedOn == False:
#doTheseThings
else:
#doThatThing
#other
#stuff
I then want my external screen contained in my mod file to be able to access "turnedOn", in a manner like:
Python:
int 200 python:
config.overlay_screens.append("myModScreen")
screen myModScreen:
use baseGameScreen
if turnedOn == False
key "g" action SetScreenVariable(turnedOn, True)
elif turnedOn == True
key "g" action SetScreenVariable(turnedOn, False)
As it's written now, the original screen's variables arent defined in the scope of mod screen, and using SetLocalVariable also doesn't seem to work, so is there another way to access those vars without modifying the script file containing "baseGameScreen"?