|
24.
|
|
|
Note that all the say statements are indented by four spaces. This is because they are a block underneath the label statement. In Ren'Py, blocks must be indented relative to the prior statement, and all of the statements in a block must be indented by the same amount.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/quickstart.rst:117
|
|
25.
|
|
|
When strings contain double-quote characters, those characters need to be preceded by a backslash. This is done in the last line of our example.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/quickstart.rst:122
|
|
26.
|
|
|
While this simple game isn't much to look at, it's an example of how easy it is to get something working in Ren'Py. We'll add the pictures in a little bit, but first, let's see how to declare characters.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/quickstart.rst:126
|
|
27.
|
|
|
Init
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/quickstart.rst:131
|
|
28.
|
|
|
The init statement is used to execute blocks of Ren'Py statements before the script executes. Init blocks are used to define images and characters, to set up unchanging game data structures, and to customize Ren'Py. Code inside init blocks should not interact with the user or change any of the layers, and so should not contain say, menu, scene, show, or hide statements, as well as calls to any function that can do these things.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/quickstart.rst:133
|
|
29.
|
|
|
An init statement is introduced with the keyword init, followed by an optional priority number, and a mandatory colon. If the priority is not given, it defaults to 0. Priority numbers should be in the range -999 to 999. Numbers outside of this range are reserved for Ren'Py code.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/quickstart.rst:140
|
|
30.
|
|
|
The priority number is used to determine when the code inside the init block executes. Init blocks are executed in priority order from low to high. Within a file, init blocks with the same priority are run in order from the top of the file to the bottom. The order of evaluation of priority blocks with the same priority between files is undefined.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/quickstart.rst:145
|
|
31.
|
|
|
The init blocks are all run once, during a special init phase. When control reaches the end of an init block during normal execution, execution of that block ends. If an init statement is encountered during normal execution, the init block is not run. Instead, control passes to the next statement.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/quickstart.rst:151
|
|
32.
|
|
|
Characters
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/quickstart.rst:157
|
|
33.
|
|
|
One problem with the first example is that it requires you to repeatedly type the name of a character each time they speak. In a dialogue-heavy game, this might be a lot of typing. Also, both character names are displayed in the same way, in fairly boring white text. To fix this, Ren'Py lets you define characters in advance. This lets you associate a short name with a character, and to change the color of the character's name.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/quickstart.rst:159
|