1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
Developer Tools
===============
Ren'Py includes a number of features to make a developer's life easier. Many of
them need the variable :var:`config.developer` to be set to True to operate.
.. _lint:
Lint
----
The Lint tool (available from the launcher) checks the game for potential errors
or misoptimizations, and advises the developing team about how to best improve it.
Since some of these errors will only affect users on other platforms, it’s
recommended to understand and fix all errors, even if the problem can't be
triggered locally.
Lint also includes useful infos and stats about the game.
Note that using Lint is not a substitute for thorough testing.
Shift+O Console
---------------
The debug console makes it possible to interactively run Ren'Py script and
Python statements, and immediately see the results. The console is available in
developer mode or when :var:`config.console` is True, and can be accessed by
pressing Shift+O.
The console can be used to:
* Jump to a label.
* Interactively try out Ren'Py script statements.
* Evaluate a Python expression or statement to see the result.
* Trace Python expressions as the game progresses.
.. include:: inc/console_commands
Shift+E Editor Support
----------------------
The :var:`config.editor` variable allows a developer to specify an editor
command that is run when the launch_editor keypress (by default, Shift+E)
occurs.
Please see :doc:`Text Editor Integration <editor>`.
Shift+D Developer Menu
----------------------
When :var:`config.developer` is true, hitting Shift+D will display a developer
menu that provides easy access to some of the features given below.
Shift+R Reloading
-----------------
When :var:`config.developer` is True, hitting Shift+R will save the current
game, reload the game script, and reload the game. This will often place you at
the last unchanged statement encountered before Shift+R was pressed.
This allows the developer to make script changes with an external editor, and
not have to exit and restart Ren'Py to see the effect of the changes.
Note that game state, which includes variable values and scene lists, is
preserved across the reload. This means that if one of those statements is
changed, it is necessary to rollback and re-execute the statement to see its
new effect.
Shift+I Style Inspecting
------------------------
When :var:`config.developer` is true, pressing Shift+I will cause style
inspection to occur. This will display a list of displayables underneath the
mouse. For each displayable, it will display the type, the style used, and the
size it is being rendered at.
Clicking on the style name will display where the style properties used by the
displayable are taken from.
> Fast Skipping
---------------
When :var:`config.developer` or :var:`config.fast_skipping` is True, pressing
the `fast_skip` key (by default, ">") causes the the game to immediately skip to
the next important interaction. For this purpose, an important interaction is
one that is not caused by a say statement, transition, or pause command.
Usually, this means skipping to the next menu, but it will also stop when
user-defined forms of interaction occur.
.. _warping_to_a_line:
Warping to a Line
------------------
Ren'Py supports warping to a line in the script, without the developer to play
through the entire game to get there. While this warping technique has a number
of warnings associated with it, it still may be useful in providing a live
preview.
To invoke warping, run Ren'Py with the ``--warp`` command-line argument followed
by a filename:line combination, to specify where you would like to warp to. For
example::
renpy.exe my_project --warp script.rpy:458
(Where `my_project` is the full path to the base directory of your project.)
When warping is invoked, Ren'Py does a number of things. It first finds all of
the scene statements in the program. It then tries to find a path from the
scene statements to every reachable statement in the game. It then picks the
reachable statement closest to, but before or at, the given line. It works
backwards from that statement to a scene statement, recording the path it took.
Ren'Py then executes the scene statement and any show or hide statements found
along that path. Finally, it transfers control to the found statement.
There are a number of fairly major caveats to the warp feature. The first is
that it only examines a single path, which means that while the path may be
representative of some route of execution, it's possible that there may be a
bug along some other route. In general, the path doesn't consider game logic,
so it's also possible to have a path that isn't actually reachable. (This is
only really a problem on control-heavy games, especially those that use a lot of
Python.
The biggest problem, though, is that Python is not executed before the
statement that is warped to. This means that all variables will be
uninitialized, which can lead to crashes when they are used. To overcome this,
one can define a label ``after_warp``, which is called after a warp but before
the warped-to statement executes. This label can set up variables in the
program, and then return to the preview.
The warp feature requires :var:`config.developer` to be True to operate.
Debug Functions
---------------
.. include:: inc/debug
|