|
28.
|
|
|
Interpolating Data
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/text.rst:71
|
|
29.
|
|
|
Ren'Py supports interpolating data into the text string before it is displayed. For example, if the player's name is stored in the ``playername`` variable, one could write a line of dialogue like::
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/text.rst:73
|
|
30.
|
|
|
Ren'Py will interpolate variables found in the global store. When using a text widget in a screen, Ren'Py will also interpolate screen local variables. (This can be overridden by supplying an explicit scope argument to the Text displayable.)
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/text.rst:79
|
|
31.
|
|
|
Ren'Py isn't limited to interpolating simple variables. It can also interpolate fields and components of tuples. So it's possible to have code like::
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/text.rst:84
|
|
32.
|
|
|
It's possible to apply formatting codes when displaying numbers. This code will display a floating point number to two decimal places::
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/text.rst:90
|
|
33.
|
|
|
Ren'Py's string interpolation is taken from the :pep:`3101` string formatting syntax. Ren'Py uses [ to introduce string formatting because { was taken by text tags.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/text.rst:96
|
|
34.
|
|
|
Along with the !s and !r conversion flags supported by Python, Ren'Py supports !q and !t conversion flag. The !q conversion flag ensures that text tags are properly quoted, so that displaying a string will not introduce unwanted formatting constructs. For example::
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/text.rst:100
|
|
35.
|
|
|
The !t flag will translate the interpolated string::
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/text.rst:107
|
|
36.
|
|
|
Styling and Text Tags
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/text.rst:118
|
|
37.
|
|
|
In Ren'Py, text gains style information in two ways. The first is from the style that is applied to the entire block of text. Please see the section about the :ref:`style system <styles>` for more details, especially the section on :ref:`text style properties <text-style-properties>`.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
../../source/text.rst:120
|