Tool Ren'Py UnRen.bat v1.0.11d - RPA Extractor, RPYC Decompiler, Console/Developer Menu Enabler

5.00 star(s) 9 Votes

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,371
I think you probably misunderstand me:
I provided already the code I'm using to print a list of variables of the scope via the console into a file. It could be improved by looping through the array and retrieve also the values, but that's a detail issue.
Python:
file = open("variables.txt","w")
long
file.write(', '.join(dir()))
file.close()
My question is: is it possible to create an injection rpy file via unren (like unren-dev.rpy), which uses something like my provided code and links this to a hotkey? I think I saw something like this, which could be probably used:
Python:
screen keys():
  key "p" ...
When I have some time I'll look into it myself and perhaps I can build a sample file. And yes, I'm a developer but I don't know python or renpy (yet).
Well, I tried. Only here, among the recorded, I did not find a single variable of the game. I didn't really understand what kind of data it wrote down. But if you need them, then I can add functionality.
 
  • Like
Reactions: Tremeres

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,371
I think you probably misunderstand me:
I provided already the code I'm using to print a list of variables of the scope via the console into a file. It could be improved by looping through the array and retrieve also the values, but that's a detail issue.
Python:
file = open("variables.txt","w")
long
file.write(', '.join(dir()))
file.close()
My question is: is it possible to create an injection rpy file via unren (like unren-dev.rpy), which uses something like my provided code and links this to a hotkey? I think I saw something like this, which could be probably used:
Python:
screen keys():
  key "p" ...
When I have some time I'll look into it myself and perhaps I can build a sample file. And yes, I'm a developer but I don't know python or renpy (yet).
But it didn't work out to tie the code to the key. If wrap the code with a function, then it generally only writes one word 'file'.
 

Tremeres

Newbie
May 28, 2017
25
10
But it didn't work out to tie the code to the key. If wrap the code with a function, then it generally only writes one word 'file'.
Thank you for trying. Did you use the code block on the console and while playing a game?
At least for me, I got some useful variable names e.g. out of the "School game" and some other.
As soon as I have time, I will look into and try to provide a sample rpy file. Maybe this is a scope thing...

Here are some infos about dir()/dir(variable)/locals()/globals(), if you are interested.
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,371
Did you use the code block on the console and while playing a game?
I did not understand what kind of code block? I just wrote your code into a code file, started the game and saw what would be written to the text file.
Here are some infos about dir()/dir(variable)/locals()/globals(), if you are interested.
I've tried all the options. Not a single known variable was recorded in the file. At least the Renpy code variables. Only python ones, as I understood. Perhaps in those games where you managed to pick something out, the variables were written in a block of code where python is used, and not the built-in RenPy language.
 

Tremeres

Newbie
May 28, 2017
25
10
I did not understand what kind of code block? I just wrote your code into a code file, started the game and saw what would be written to the text file.
Python:
file = open("variables.txt","w")
long
file.write(', '.join(dir()))
file.close()
If you post this in the console, after starting/loading a savegame, line by line, then it should print out a long list of variable names declared at the current moment of the game. This includes system variables, but also the variables used by Renpy developers.
It's not perfect, but you can find a lot of variables without looking into the decompiled source code.
I guess it has to be modified, that it will work outside the console. I'm working on it.

I've tried all the options. Not a single known variable was recorded in the file. At least the Renpy code variables. Only python ones, as I understood. Perhaps in those games where you managed to pick something out, the variables were written in a block of code where python is used, and not the built-in RenPy language.
I'm not very familiar with Renpy, but as far as I see it, every variable declared in that very moment of the game should be visible as python variable?

I will try to build a prototype. Then we can test it with your game and see, if there is something different.
 

Tremeres

Newbie
May 28, 2017
25
10
I've tried all the options. Not a single known variable was recorded in the file. At least the Renpy code variables. Only python ones, as I understood. Perhaps in those games where you managed to pick something out, the variables were written in a block of code where python is used, and not the built-in RenPy language.
Alright, I played around a little, but I didn't have time to look into the scope issue. So I used globals() and the output is pretty messy. There is still some work to do, but you would see at least some Renpy values.

Just put the attached file in the game folder and start a game. Important: don't press 'p' on the main screen, this will trigger an error. But you can press 'p' anytime in a loaded game.
 

Meushi

Well-Known Member
Aug 4, 2017
1,146
12,727
Features for dumping variables to file seems well outside the scope of UnRen, why is this being discussed here?
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,371
Alright, I played around a little, but I didn't have time to look into the scope issue. So I used globals() and the output is pretty messy. There is still some work to do, but you would see at least some Renpy values.

Just put the attached file in the game folder and start a game. Important: don't press 'p' on the main screen, this will trigger an error. But you can press 'p' anytime in a loaded game.
Well, it works, you can even find game variables. Using items() was a good idea. Although strange, this function, as I read, just formats the view. But without it, the data is immediately written to the file, without waiting for the key to be pressed, and the necessary variables are not recorded. :unsure: I can add this function to the tool, although I don't see a reason why, given that the file still needs to try to figure out which variables will be needed. Wouldn't it be easier to just get into the code and view it?
 

Meushi

Well-Known Member
Aug 4, 2017
1,146
12,727
He wants to add this functionality to the tool.
I know what he wants, it's got nothing to do with UnRen, which is for extracting/de-compiling RenPy objects.

If you want to expand your UnRen fork to do unrelated things like analyzing variables that's fine of course, but that discussion should be happening in your thread not here? Seems like random project creep to me though.
 
  • Angry
Reactions: Kellerkind207

Tremeres

Newbie
May 28, 2017
25
10
I know what he wants, it's got nothing to do with UnRen, which is for extracting/de-compiling RenPy objects.

If you want to expand your UnRen fork to do unrelated things like analyzing variables that's fine of course, but that discussion should be happening in your thread not here? Seems like random project creep to me though.
At the beginning I was asking if something like the prototype file above can be included in unren (if maybe somebody had build it already). Then this hack would be provide a variable dump with values in the Renpy scope on button pressed. Could be nice to analyze game states in addition to see the source code.
But yes, I was carried away a litte and build it myself. I stop posting here now. :)

He wants to add this functionality to the tool.
Well it's not ready yet, it was just a proof of concept. The scope still needs to be improved: like the dir() in the console and a sorting should be done.

Well, it works, you can even find game variables. Using items() was a good idea. Although strange, this function, as I read, just formats the view. But without it, the data is immediately written to the file, without waiting for the key to be pressed, and the necessary variables are not recorded. :unsure: I can add this function to the tool, although I don't see a reason why, given that the file still needs to try to figure out which variables will be needed. Wouldn't it be easier to just get into the code and view it?
Just to find variables maybe yes. But when the scope is improved, you see less and more relevant (like in SHIFT+D), also you have the values printed out. In some cases, this could be nice to analyze the state of the game and in other cases you can quickly search for a specific value.

So then, I will take my leave here. ;) I can just use my file without unren anyway.
 
Last edited:
  • Like
Reactions: Meushi

moskyx

Forum Fanatic
Jun 17, 2019
4,005
12,961
Isn't it what developer menu is for? I mean, you can press Shift+D in any moment and get the list of game's variables and their current state through the variable viewer, and then you can even modify them. And UnRen already has an option to enable this developer menu. Considering people use UnRen just to extract scripts and pics, so they usually do that before even launching the game and never while playing, I don't think this feature would be any relevant. I mean, why would you run UnRen again while playing the game to 'analyze the state of the game' when you can just press shift+D to do it
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,371
I know what he wants, it's got nothing to do with UnRen, which is for extracting/de-compiling RenPy objects.

If you want to expand your UnRen fork to do unrelated things like analyzing variables that's fine of course, but that discussion should be happening in your thread not here? Seems like random project creep to me though.
Firstly, there are already 4 commands in UnRen that have nothing to do with unpacking or decompiling. Added by the original author. Secondly, if you are not aware, then the tool has not been updated in this topic for a long time. even version 0.91 is an assembly of one moderator who included part of my old code and his own developments, after which there were no changes. I would be glad that everyone would switch to my own topic, where I try to keep the tool up to date, but as you can see, everyone writes here and no one reads the comments to find out that it makes sense to switch to another topic.
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,371
Isn't it what developer menu is for? I mean, you can press Shift+D in any moment and get the list of game's variables and their current state through the variable viewer, and then you can even modify them. And UnRen already has an option to enable this developer menu. Considering people use UnRen just to extract scripts and pics, so they usually do that before even launching the game and never while playing, I don't think this feature would be any relevant. I mean, why would you run UnRen again while playing the game to 'analyze the state of the game' when you can just press shift+D to do it
THIS is really useful information. Although I have never used the developer menu myself, but now I probably will. :unsure: :giggle:
 

Tremeres

Newbie
May 28, 2017
25
10
Isn't it what developer menu is for? I mean, you can press Shift+D in any moment and get the list of game's variables and their current state through the variable viewer, and then you can even modify them. And UnRen already has an option to enable this developer menu. Considering people use UnRen just to extract scripts and pics, so they usually do that before even launching the game and never while playing, I don't think this feature would be any relevant. I mean, why would you run UnRen again while playing the game to 'analyze the state of the game' when you can just press shift+D to do it
THIS is really useful information. Although I have never used the developer menu myself, but now I probably will. :unsure: :giggle:
Ok, quick last comment about that. Yes, SHIFT+D (Variable Viewer) is my original inspiration.

But if they remove the developer menu (like in "School Game" and in several other games) you can't open them anymore. Only the console can be reactivated via unren so far.

But more importantly I can search in files via text editors (especially in games with many variables a big plus) and I can put the file next to the console while setting values. Also, the variable viewer doesn't print object values in full.

That's what I like. If you don't need this, it's fine too. Everyone has their own methods. :)
 
  • Like
Reactions: moskyx

Tremeres

Newbie
May 28, 2017
25
10
Firstly, there are already 4 commands in UnRen that have nothing to do with unpacking or decompiling. Added by the original author. Secondly, if you are not aware, then the tool has not been updated in this topic for a long time. even version 0.91 is an assembly of one moderator who included part of my old code and his own developments, after which there were no changes. I would be glad that everyone would switch to my own topic, where I try to keep the tool up to date, but as you can see, everyone writes here and no one reads the comments to find out that it makes sense to switch to another topic.
What is your topic? Sorry, this was the sticky topic and I can't read through 119 pages to see, if there is an newer topic about it. :)
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,371
Ok, quick last comment about that. Yes, SHIFT+D (Variable Viewer) is my original inspiration.

But if they remove the developer menu (like in "School Game" and in several other games) you can't open them anymore. Only the console can be reactivated via unren so far.

But more importantly I can search in files via text editors (especially in games with many variables a big plus) and I can put the file next to the console while setting values. Also, the variable viewer doesn't print object values in full.

That's what I like. If you don't need this, it's fine too. Everyone has their own methods. :)
So in UnRen there is just a command to enable the developer menu.
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,371
Yes, but sometimes the developers are mean and rewrite the developer menu with an empty page. And then you can't access this variable viewer. :LOL:
Oh, it's so bad... I've never heard of such a thing.
 
5.00 star(s) 9 Votes