CREATE YOUR AI CUM SLUT ON CANDY.AI TRY FOR FREE
x

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

Paz

Active Member
Aug 9, 2016
930
1,538
HI, may i ask you if is possible to see the variable in alfabetical order? When we have many is a pain find the one you need. Tks
There are two ways of getting a sorted variable list.

1. Use dir() in console. This will output a list with all variable names, including a bit of junk, in alphabetical order.

2. Patch the Variable Viewer in order to sort variables (because by default they're unsorted).
In \renpy\common\_developer\developer.rpym change line #140 from
Python:
        renpy.call_screen("_variable_viewer", entries=entries)
to
Python:
        renpy.call_screen("_variable_viewer", entries=sorted(entries))
Now, when you hit Shift+D and go to Variable Viewer, all variables will be listed alphabetically.
 

mirenzo

Well-Known Member
Game Developer
Jun 7, 2017
1,612
801
@Paz Thank you so much. Your second option it's exacly what i'm looking for.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
11,006
16,292
I have seen games like "Corrupting The Intern" where variables are show in alfabetical order, what's that new version of Renpy?
The game use a version 6.99.10, released in March 2016, while the actual 6.99.12 was first released in February 2017. But you're right, at this time the variables were sorted by the variable viewer.


1. Use dir() in console. This will output a list with all variable names, including a bit of junk, in alphabetical order.
Not possible with versions previous than 6.99.11 (or .12, don't remember exactly). The console is not scrollable in these versions, and dir() return way too much information. For the game used in example by @mirenzo, only half of the result will be hidden because of this. So you've two solutions, none are simple.

1) Clean the result of dir :
Code:
[e for e in dir() if not callable( getattr( store, e ) )]
You'll still have a lot of crap, but divide their number by 4.

2) Search directly where you're sure to have only variables :
Code:
sorted( renpy.python.store_dicts["store"].ever_been_changed )
Like it's the list of all the variables (in fact it's all the store's attributes, but it's exceptional to found someone who also alter Ren'py's functions) that have had their value changed at least once since the start of the game, you'll have to wait that a value change (like for the variable viewer). But in counter part, you'll be sure to have only the variables. So, for an average game, something like 25% of what a cleaned dir will give you, or 5% for a full dir.

Note that both methods, including your "dir only", give a limited view of the games variables since they all ignore any store other than the default one. They aren't this many, but there's games which use their own store, and here the variable viewer will give you what you search, but not these console tricks.
 

mirenzo

Well-Known Member
Game Developer
Jun 7, 2017
1,612
801
@anne O'nymous Tankyou for your kind and exaustive answer,
I solved my problem using the @Paz solution easy and fast.
I'm playing a game with hundred of variables so every time i have to check if the variable i looking for is changed was a pain. Think how much i'm stupid, I don't need this to play the game, i need this to write the Walkthrough and be sure to give people the right informations.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
11,006
16,292
Think how much i'm stupid, I don't need this to play the game, i need this to write the Walkthrough and be sure to give people the right informations
You aren't stupid at all, especially if it's for this reason.
 

Paz

Active Member
Aug 9, 2016
930
1,538
@anne O'nymous Thanks for the added insight, but I've opted not to provide a more elaborate solution (like searching namespaces) because,
a) It would be hardly usable for the average user, and typing it on console is a pain,
b) Exposing such mechanisms to the UI would require further fiddling with code for said user (unless you replace the Variable Viewer function e.g.), and
c) Frankly, 99.99% of the Ren'Py games out there are the most straightforward you can find, with each variable being it's own "entity" per say. I don't think I've come across any game here that uses custom objects and whatnot for state tracking (except maybe 1 or 2 cases?) :)
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
11,006
16,292
c) Frankly, 99.99% of the Ren'Py games out there are the most straightforward you can find, with each variable being it's own "entity" per say. I don't think I've come across any game here that uses custom objects and whatnot for state tracking (except maybe 1 or 2 cases?) :)
Er, games that use custom objects aren't this exceptional. Super powered, Teacher's pets, Lab rats, After invasion, Bondage island, and there's plenty others. But in fact I don't understand why you talk about this while the subject is the custom stores.
Stores are namespace-like used by ren'py to both store the variables and handle the rollback feature (and so the save/load feature). They have nothing to do with custom objects. Take your "dir()" trick by example. It never gave you the content of the global namespace, because ren'py work on top of it. What look like the global namespace is the default store, a sub class of dict. By default ren'py have ten (or eleven, don't remember exactly) stores, and any coder can add their own stores ; no title cross my mind, but there's at least two, perhaps three that can be found here. So, when you type "dir()" in the console, in fact what you get is "dir( store )".

As much as I understand that it's way easier to remember than the "variable viewer" like approach, and way more than the cleared dir, the problem I have with this trick is that you get really too many values in return, and most of them are useless.
Take as example. The game itself use 33 variables. "dir()" will return an array of 547 entries. A cleaned dir will return only 137, and the "variable viewer" like will return 52 entries.

Still, I agree, the way to have a correct result is too difficult to remember. So here come an easy way:
1) Download the attached file ;
2) Put it in the '[game's name]/game/' folder ;
3) Open the console (enabled by the mod) ;
4) Type "vv", like in "Variables Viewer" (at anytime you can type "help" as reminder) ;
5) Enjoy the list of all the variables that have been changed since the start of the game, in alphabetical order.

It will not replace the "variable viewer", since you'll not have the values, but it will efficiently replace the "dir" trick. With this, you'll know where to search and/or what variable you'll need to watch.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
11,006
16,292
Can be helpful since I don't know when the author of ren'py will add the correction so...

There's a bug in the 6.99.13 version of ren'py which mess with AZERTY keyboard.
If a cheat need you to type "[", "]", "{", "}" or "#" in the console and your AZERTY keyboard need you to use the ALT-GR key to type them, it will not works with the version 6.99.13.2919

To make it works, you'll need to :
go to [game's main folder]/renpy/display
open the file name "behavior.py"
comment the lines 1224 and 1225:
Code:
        if pygame.key.get_mods() & pygame.KMOD_ALT:
            return None
Become this :
Code:
#        if pygame.key.get_mods() & pygame.KMOD_ALT:
#           return None
It will change absolutely nothing to ren'py, except that you'll be able to use the ALT-GR key again in the console.

Actually there's only one game here which use the version 6.99.13, but like I said, I don't know when the correction will come. So, before I forget about it, I share it, just in case.
 

MailMeister

Member
May 1, 2017
133
264
I just encountered a very interesting issue, where enabling the dev mode straight up crashes the game. I tried various things mentioned in this thread already but all of them crashed the game (Lust and power 0.7b)


Here it is:
Code:
I'm sorry, but an uncaught exception occurred.

After initialization, but before game start.
  File "renpy/common/00voice.rpy", line 360, in voice_interact
    if _menu:
NameError: global name '_menu' is not defined

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "E:\games\Lust_and_Power-0.7.b-pc\renpy\bootstrap.py", line 295, in bootstrap
    renpy.main.main()
  File "E:\games\Lust_and_Power-0.7.b-pc\renpy\main.py", line 430, in main
    renpy.game.script.report_duplicate_labels()
  File "E:\games\Lust_and_Power-0.7.b-pc\renpy\script.py", line 890, in report_duplicate_labels
    if renpy.parser.report_parse_errors():
  File "E:\games\Lust_and_Power-0.7.b-pc\renpy\parser.py", line 2543, in report_parse_errors
    renpy.display.error.report_parse_errors(full_text, error_fn)
  File "E:\games\Lust_and_Power-0.7.b-pc\renpy\display\error.py", line 179, in report_parse_errors
    error_fn=error_fn,
  File "E:\games\Lust_and_Power-0.7.b-pc\renpy\game.py", line 280, in invoke_in_new_context
    return callable(*args, **kwargs)
  File "E:\games\Lust_and_Power-0.7.b-pc\renpy\display\error.py", line 43, in call_exception_screen
    return renpy.ui.interact(mouse="screen", type="screen", suppress_overlay=True, suppress_underlay=True)
  File "E:\games\Lust_and_Power-0.7.b-pc\renpy\ui.py", line 285, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "E:\games\Lust_and_Power-0.7.b-pc\renpy\display\core.py", line 2519, in interact
    i()
  File "renpy/common/00voice.rpy", line 360, in voice_interact
    if _menu:
NameError: global name '_menu' is not defined

Windows-8-6.2.9200
Ren'Py 6.99.12.4.2187
Lust and Power 0.7.b
This was using the options.rpy from the OP which worked with every renpy game i played up to this point


I also tried using this:
Code:
init 5 python:
    config.developer = True
putting that in a .rpy file and just putting it into the /game folder (worked for every renpy game except lust and power 0.7b)
 

muttdoggy

Dogerator
Staff member
Moderator
Aug 6, 2016
7,793
44,833
I just encountered a very interesting issue, where enabling the dev mode straight up crashes the game. I tried various things mentioned in this thread already but all of them crashed the game (Lust and power 0.7b)


Here it is:
Code:
I'm sorry, but an uncaught exception occurred.

After initialization, but before game start.
  File "renpy/common/00voice.rpy", line 360, in voice_interact
    if _menu:
NameError: global name '_menu' is not defined

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "E:\games\Lust_and_Power-0.7.b-pc\renpy\bootstrap.py", line 295, in bootstrap
    renpy.main.main()
  File "E:\games\Lust_and_Power-0.7.b-pc\renpy\main.py", line 430, in main
    renpy.game.script.report_duplicate_labels()
  File "E:\games\Lust_and_Power-0.7.b-pc\renpy\script.py", line 890, in report_duplicate_labels
    if renpy.parser.report_parse_errors():
  File "E:\games\Lust_and_Power-0.7.b-pc\renpy\parser.py", line 2543, in report_parse_errors
    renpy.display.error.report_parse_errors(full_text, error_fn)
  File "E:\games\Lust_and_Power-0.7.b-pc\renpy\display\error.py", line 179, in report_parse_errors
    error_fn=error_fn,
  File "E:\games\Lust_and_Power-0.7.b-pc\renpy\game.py", line 280, in invoke_in_new_context
    return callable(*args, **kwargs)
  File "E:\games\Lust_and_Power-0.7.b-pc\renpy\display\error.py", line 43, in call_exception_screen
    return renpy.ui.interact(mouse="screen", type="screen", suppress_overlay=True, suppress_underlay=True)
  File "E:\games\Lust_and_Power-0.7.b-pc\renpy\ui.py", line 285, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "E:\games\Lust_and_Power-0.7.b-pc\renpy\display\core.py", line 2519, in interact
    i()
  File "renpy/common/00voice.rpy", line 360, in voice_interact
    if _menu:
NameError: global name '_menu' is not defined

Windows-8-6.2.9200
Ren'Py 6.99.12.4.2187
Lust and Power 0.7.b
This was using the options.rpy from the OP which worked with every renpy game i played up to this point


I also tried using this:
Code:
init 5 python:
    config.developer = True
putting that in a .rpy file and just putting it into the /game folder (worked for every renpy game except lust and power 0.7b)
Daaangg..
1- Did the 00Library fix.. NOPE!
2- Put the devconsole.rpy in there... NOPE!
3- Used the UnRen.. ERROR!

o_O
 

muttdoggy

Dogerator
Staff member
Moderator
Aug 6, 2016
7,793
44,833
Ok ok.. Doggo Persistance pays off. :FuckYea:
Lets see if I don't get any errors.. need to test more!

Changes done
Used Sam's UnRen.. Extracted archive.rpa and ran UNrpyc then deleted the un.rpyc file in the game folder.

I did these "fixes"

00voice.rpy
Line 360
"if _menu" changed to "if menu"

34.rpy
Line 21
define config.developer = True :tf:

48.rpy
Line 25
call v_dtm_ch from _call_v_dtm_ch_88 :WutFace: <--- this is the tricky shit that's tripping me up for MINUTES! This is what I hope is working. It's doing this "Defined Twice" crap so I finally did the pieces of 8 and killed the bitch but hopefully not the scene. o_O
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
11,006
16,292
File "renpy/common/00voice.rpy", line 360, in voice_interact
if _menu:
NameError: global name '_menu' is not defined
This is a common occurrence with Ren'py. When you encounter this error, it mean that the code of the game is bugged, but the error isn't handled by the engine. And 90% of the time it's because of a label defined twice.
The error isn't visible when the developer mode is disabled, because Ren'py is polite enough to let you play even when the author wrote crappy code. And the game crash when developer mode is enabled, because it's an error and the author must fix it.

That's why, when you just want to use the console, you must stick to "config.console = True".
 

MailMeister

Member
May 1, 2017
133
264
Good to know that it's crappy code haha.

It's just that i would like to use the variable viewer, is there a way to open it with the console? (i know about the dir() command and the custom ones some guys made in this thread, but i personally would prefer the "normal" vv)
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
11,006
16,292
It's just that i would like to use the variable viewer, is there a way to open it with the console?
Why not just use something that's better and don't need to enable the developer mode ?
 
  • Like
Reactions: MailMeister

RustyV

Conversation Conqueror
Game Developer
Dec 30, 2017
6,957
33,565
hey is there a way to reinstall the quick save option bar a the bottom of screen for renpy if the dev took it out?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
11,006
16,292
hey is there a way to reinstall the quick save option bar a the bottom of screen for renpy if the dev took it out?
Yes.
Just unzip the attached file and put "dirtySaveLoad.rpy" in the [base game folder]/game directory. It will add a "save" and "load" button on the bottom left corner of the screen.
But WARNING it just add the buttons. If for some weird reason the game author have decided to remove the save or load screen, it will not works.