Ren'Py List Contents of an Object In RenPy Dev Console

Apr 21, 2018
474
530
Objects are great, they hold variables so when one needs to get a value, it need only to find who or what that value belongs to.

But since sometimes, the dev console does not show the attributes of an object (it only lists objects inside an array, as far as I can tell). So say if an object used to have {hp, money} as attributes, and the dev decided to change them to {health, funds} in the new update, it can be a while before one can find the right names for them.

How does one go about finding out how an object is structured in RenPy games? Can the dev console be used for that? And since I have UnRen and unpacked the script files, where can I find the python scripts that actually defines gameplay related objects?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,957
16,188
How does one go about finding out how an object is structured in RenPy games?
Personally, by using thirty years of experience in reverse engineering, my knowledge of Python and Ren'py, home made tools (not all possibly releasable), the console and the source code. But, well, don't let this make you think it's hard. I need all of this (especially the tools) because I'm lazy as fuck :D The only thing you really need is some knowledge of Python.


Can the dev console be used for that?
Yes :
Code:
objectName.__dict__
sorted( objectName.__dict__.keys() )
objectName.__slot__
sorted( objectName.__slot__.keys() )
dir( objectName )
Warning, sometime the result can be really big.


And since I have UnRen and unpacked the script files, where can I find the python scripts that actually defines gameplay related objects?
Anywhere and everywhere in the source code. There's no defined place where to do this.
 
Apr 21, 2018
474
530
Personally, by using thirty years of experience in reverse engineering, my knowledge of Python and Ren'py, home made tools (not all possibly releasable), the console and the source code. But, well, don't let this make you think it's hard. I need all of this (especially the tools) because I'm lazy as fuck :D The only thing you really need is some knowledge of Python.




Yes :
Code:
objectName.__dict__
sorted( objectName.__dict__.keys() )
objectName.__slot__
sorted( objectName.__slot__.keys() )
dir( objectName )
Warning, sometime the result can be really big.




Anywhere and everywhere in the source code. There's no defined place where to do this.
Thanks! I didn't know there are commands to list object attributes in the console. The last game I had trouble with, I had to use UnRen and go through the codes to figure things out. This would be much easier, even if the object can contain too many attributes.