|
71.
|
|
|
Menus, Labels, and Jumps
|
|
|
|
Menus, Labels, and Jumps
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/quickstart.rst:452
|
|
72.
|
|
|
The menu statement lets you present a choice to the user::
|
|
|
|
The menu statement lets you present a choice to the user::
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/quickstart.rst:454
|
|
73.
|
|
|
This example shows how menus are used with Ren'Py. The menu statement introduces an in-game-menu. The menu statement takes a block of lines, each consisting of a string followed by a colon. These are the menu choices which are presented to the user. Each menu choice should be followed by a block of one or more Ren'Py statements. When a choice is chosen, the statements following it are run.
|
|
|
|
This example shows how menus are used with Ren'Py. The menu statement introduces an in-game-menu. The menu statement takes a block of lines, each consisting of a string followed by a colon. These are the menu choices which are presented to the user. Each menu choice should be followed by a block of one or more Ren'Py statements. When a choice is chosen, the statements following it are run.
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/quickstart.rst:480
|
|
74.
|
|
|
In our example, each menu choice runs a jump statement. The jump statement transfers control to a label defined using the label statement. The code following that label is run.
|
|
|
|
In our example, each menu choice runs a jump statement. The jump statement transfers control to a label defined using the label statement. The code following that label is run.
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/quickstart.rst:487
|
|
75.
|
|
|
In our example above, after Sylvie asks her question, the user is presented with a menu containing two choices. If the user picks "It's a story with pictures.", the first jump statement is run, and control is transferred to the ``vn`` label. This will cause the pov character to say "It's a story with pictures and music.", after which control is transferred to the ``marry`` label.
|
|
|
|
In our example above, after Sylvie asks her question, the user is presented with a menu containing two choices. If the user picks "It's a story with pictures.", the first jump statement is run, and control is transferred to the ``vn`` label. This will cause the pov character to say "It's a story with pictures and music.", after which control is transferred to the ``marry`` label.
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/quickstart.rst:491
|
|
76.
|
|
|
Labels may be defined in any file that is in the game directory, and ends with .rpy. The filename doesn't matter to Ren'Py, only the labels contained within it. A label may only appear in a single file.
|
|
|
|
Labels may be defined in any file that is in the game directory, and ends with .rpy. The filename doesn't matter to Ren'Py, only the labels contained within it. A label may only appear in a single file.
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/quickstart.rst:498
|
|
77.
|
|
|
Python and If Statements
|
|
|
|
Python and If Statements
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/quickstart.rst:503
|
|
78.
|
|
|
While simple (and even fairly complex) games can be made using only using menus and jump statements, after a point it becomes necessary to store the user's choices in variables, and access them again later. This is what Ren'Py's python support is for.
|
|
|
|
While simple (and even fairly complex) games can be made using only using menus and jump statements, after a point it becomes necessary to store the user's choices in variables, and access them again later. This is what Ren'Py's python support is for.
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/quickstart.rst:505
|
|
79.
|
|
|
Python support can be accessed in two ways. A line beginning with a dollar-sign is a single-line python statement, while the keyword "python:" is used to introduce a block of python statements.
|
|
|
|
Python support can be accessed in two ways. A line beginning with a dollar-sign is a single-line python statement, while the keyword "python:" is used to introduce a block of python statements.
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/quickstart.rst:510
|
|
80.
|
|
|
Python makes it easy to store flags in response to user input. Just initialize the flag at the start of the game::
|
|
|
|
Python makes it easy to store flags in response to user input. Just initialise the flag at the start of the game::
|
|
Translated and reviewed by
Stephan Woidowski
|
|
|
|
Located in
../../source/quickstart.rst:514
|