|
22.
|
|
|
The first line is a label statement. The label statement is used to give a name to a place in the program. In this case, we create a label named ``start``. The start label is special, as it's where Ren'Py scripts begin running when the user clicks "Start Game" on the main menu.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/quickstart.rst:103
|
|
23.
|
|
|
The other lines are say statements. There are two forms of the say statement. The first is a string (beginning with a double-quote, containing characters, and ending with a double-quote) on a line by itself, which is used for narration, and the thoughts of the main character. The second form consists of two strings. It's used for dialogue, with the first string being a character name and the second being what that character is saying.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/quickstart.rst:109
|
|
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
|