Tutorial Ren'Py Enabling Developer & Command Consoles In Ren'py

scrumbles

Engaged Member
Jan 12, 2019
2,218
2,259
In Linux the usual commands work natively. I can past a string into the game console with CTRL-V, while with CTRL-C I can copy the whole input line I am typing.

To copy the output of a command instead, I launch the game through the terminal:
Code:
> cd /path/to/game/
> ./GAME_NAME.sh
then I open the game console. To redirect the output of the Ren'py console to the pc terminal, I just use "print()" in the former. For instance, to display the variables list:
Code:
print(dir())

Alternatively, it is possible to create a text file and use it to read/write data. I guess this solution works on Windows/Mac too.
For instance, if I want to save the variables list:
Code:
fp = open('dummy.txt', 'w')
fp.write(str(dir()))
fp.close()
(being the output of "dir()" an object, I convert it into a string).

To input a string instead:
1) first, I write the string in my dummy file (for instance "dir()" without quotation marks)
Code:
dir()
and I name the file "dummy.txt"
2) then I type in the game console:
Code:
fp = open('dummy.txt', 'r')
eval(fp.readline())
fp.close()
If I replace "eval" with "exec", the output is redirected to the pc terminal.

In both cases the game looks for the dummy file in the directory with the .exe.
 
Last edited:

TaskSpacebar

Newbie
Mar 17, 2018
57
42
Not sure who would be able to help with this but here goes:

EpicLust has currently released 0.2 of Apocalypse and the console disabled in order to trigger a new 'addition' to the current version. He says we can re-enable it via the options.rpy file and to type in this:

" and type the following at the top before saving it: init -1: python hide: config.developer = True '

Where do I put this in exactly? I have opened the .rpy file in question with Wordpad unless Notepad is better suited.

I wanted to ask here first before I PM the dev and not have him be distracted with a minor inconvience.
 

scrumbles

Engaged Member
Jan 12, 2019
2,218
2,259
I don't know what your OS is, but previous versions of Wordpad had issues with the character encoding (could not save in UTF-8), while Notepad could not properly display the end-of-lines.
I would choose another text editor, like Notepad++ (or Atom, Brackets, Sublime Text, MS Visual Studio Code...).
I haven't tested the code, but I think you should type:
Code:
init -1 python:
    config.developer = True
NB: the second line must start with four spaces.
 
Last edited:

TaskSpacebar

Newbie
Mar 17, 2018
57
42
I don't know what your OS is, but previous versions of Wordpad had issues with the character encoding (could not save in UTF-8), while Notepad could not properly display the end-of-lines.
I would choose another text editor, like Notepad++ (or Atom, Brackets, Sublime Text, MS Visual Studio Code...).
I haven't tested the code, but I think you should type:
Code:
init -1 python:
    config.console = True
NB: the second line must start with four spaces.
Oh okay. As to what OS I use, its Win10 64 bit. I'll try that and thank you.
 

TaskSpacebar

Newbie
Mar 17, 2018
57
42
Sorry, I copy and pasted an old post of mine. Of course it's "config.developer", not "config.console".
No no that's fine. I was able to enable it kind of. I'm not sure if I'm looking in the right .rpy file to enable config.developer. Currently, I have options.rpy and 00console.rpy open. Not sure if either of those is correct.
 

scrumbles

Engaged Member
Jan 12, 2019
2,218
2,259
The first one should be OK (it is in the "game" folder, isn't it?).
But I think it shouldn't really matter, you could even put those lines in a separate file, as long as its extension is .rpy (and it is encoded in the UTF-8 format).
 

firefly66

Newbie
Jan 26, 2019
79
59
Can anyone explain how to look inside a store? I've tried "dir(store_name)", but it only gives a partial list, like ['a','b','c','d','e'...]
 

firefly66

Newbie
Jan 26, 2019
79
59
In case anyone hasn't noticed this, you can use the up arrow key to scroll back up through previous entries. So if you typed:
gold=100
lust=999


you can hit up arrow twice to get back to:
gold=100

you can then edit the line:
gold=999

This is especially useful for avoiding mistakes with variable names. If you just type:
gold

and the console returns
gold=4

you know you got the name correct hit the up arrow to get gold again, then tack on '=999' and you know you've edited a valid variable. If the variable name was incorrect, you'd instead get a warning that the name is not found.
 
  • Like
Reactions: Zwart

scrumbles

Engaged Member
Jan 12, 2019
2,218
2,259
I don't use UnRen, I guess there is a way to do what you want with it. Here's two solutions that don't need additional tools.

Solution 1

Open renpy\common\00console.rpy, find the line:
Code:
default persistent._console_short = True
and change True to False, then reload the game.
Alternatively, open the console and set:
Code:
persistent._console_short = False
Solution 2
You don't have permission to view the spoiler content. Log in or register now.

Solution 3
You don't have permission to view the spoiler content. Log in or register now.
 
Last edited:

HootieMcBoob

Member
Nov 19, 2018
109
37
I can't get the console to work. I followed the instructions (making the file options.rpy and entering the correct commands) and setting the config.console to true.
Still can't open it. The game is Summertimesaga.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
9,949
14,551
Can anyone explain how to look inside a store? I've tried "dir(store_name)", but it only gives a partial list, like ['a','b','c','d','e'...]
The answer is on the last comment of the previous page... Just type long in the console.


Open renpy\common\00console.rpy, find the line:
Code:
default persistent._console_short = True
There's a console command made especially to change this behavior. No need to edit anything.
And even if you prefer to not use the said command, you don't need to edit anything. Just put the following code in a file named whatever_you_want.rpy, and put it in the "game" directory :
Code:
init 1000 python:
    persistent._console_short = True

This said, looking directly at the store far to be a good option. Before the game start, it already carry around 600 attributes that have absolutely no meaning for the game, many of them being classes and functions, and the number will increase once the game is started.
What should be used is the list of the attributes to save, since they are the only ones that effectively matter. This being done by looking at the renpy.python.StoreDict[STORE_NAME].ever_been_changed set.
But using the variable viewer (shift + d) is an even better way to know which variables are used by the game ; but it need to enable the developer mode.


Still can't open it. The game is Summertimesaga.
They disable the console in the game code. But I don't remember if they do it before or after the game start.
Try to enable it by putting this in a "rpy" file, and adding it in the "game" directory :
Code:
init 1500 python:
    config.console = True
 

Pigfarmer

Member
May 25, 2019
274
608
Is it possible to perform function calls from the console? I tried inputting Start() and Replay("SceneName") but instead of starting the game it would only print - what I would assume is - a function pointer variable. I'm trying to see if it's possible to replay scenes without a gallery menu.