|
16.
|
|
|
Init Python Statement
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/python.rst:83
|
|
17.
|
|
|
The ``init python`` statement runs python code at initialization time, before the game loads. Among other things, this code can be used to define classes and functions, or to initialize styles, config variables, or persistent data. ::
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/python.rst:85
|
|
18.
|
|
|
A priority number can be placed between ``init`` and ``python``. When a priority is not given, 0 is used. Init statements are run in priority order, from lowest to highest. Init statements of the same priority are run in unicode order by filename, and then from top to bottom within a file.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/python.rst:105
|
|
19.
|
|
|
To avoid conflict with Ren'Py, creators should use priorities in the range -999 to 999. Priorities of less than 0 are generally used for libraries and to set up themes. Normal init code should have a priority of 0 or higher.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/python.rst:110
|
|
20.
|
|
|
Init python statements also take the ``hide`` or ``in`` clauses.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/python.rst:115
|
|
21.
|
|
|
Variables that have their value set in an init python block are not saved, loaded, and do not participate in rollback, unless the object the variable refers to is changed.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/python.rst:117
|
|
22.
|
|
|
Define Statement
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/python.rst:125
|
|
23.
|
|
|
The define statement sets a single variable in the default store to a value at init time. For example::
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/python.rst:127
|
|
24.
|
|
|
is equivalent to::
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/python.rst:132
|
|
25.
|
|
|
One advantage of using the define statement is that it records the filename and line number at which the assignment occured, and makes that available to the navigation feature of the launcher.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/python.rst:137
|