I'll add a couple of entirely personal ones that hardly anyone ever does...
When using a character's name within your dialogue, use their
Character()
object id rather than typing out the full name. I freely admit, it'll be a pain to get into the habit and it will result in extra typos.... where you accidently use "
[s]
" (Sharon) instead of "
a
" (Alice).
For example, if you had the following code:
Python:
define e = Character("Eileen")
label start:
scene black with fade
e "Hello, my name is Eileen.
"*** THE END ***"
return
Consider coding it like this instead...
Python:
define e = Character("Eileen")
label start:
scene black with fade
e "Hello, my name is [e].
"*** THE END ***"
return
There's a couple of things going on here which if you are new to RenPy will not be obvious.
Firstly, using square brackets within dialogue
[
and
]
allow you to put the values of variables into the whatever your characters are saying.
Secondly, there's a bit python/RenPy voodoo going on here - where even though
e
is a complex
Character()
object with lots of options and values... if you use
[e]
within a string (text), it'll always display as the character's name.
(For the more technically minded amongst anyone reading this, Character()
has an internal __str__
function that returns self.name
when automatically invoked by a string object).
My basic thinking is that it makes it much easier to consider renaming characters later... or more specifically, giving players the option to rename characters. It also avoids the occasional rare typos of longer or unfamilar names... Like occasionally typing "Geneveive" instead of "Genevieve" or even "Bth" instead of "Beth".
My second personal suggestion is equally useful, but difficult to quantify if it's worth the effort...
If your game has a MC (main character) that
thinks to themselves... create a second
Character()
definition for the "thinking". Use that alternative character object to style the text to appear differently.
I'm going to throw in a couple of other personal preferences here and explain them, but the main point is the
mc_t
definition.
I'm thinking something like this:
Python:
define narrator = Character(None, what_color="#FFFF99")
define mc = Character("[mc_name]", what_prefix="\"", what_suffix="\"")
define mc_t = Character("[mc_name]", what_prefix="{i}(", what_suffix="){/i}", what_color="#AAAAAA")
define e = Character("Eileen", color="#FF66CC", what_prefix="\"", what_suffix="\"")
default mc_name = "Unknown"
label start:
scene black with fade
$ mc_name = renpy.input("What is your name? {i}(Press ENTER for 'Simon'){/i}", exclude="[]{}")
$ mc_name = mc_name.strip() or "Simon"
"Welcome [mc]."
mc "Thanks. It's nice to be here."
mc_t "This is going to be fun."
"*** THE END ***"
return
Okay... so the
mc_t
(Main Character thinking) is the primary reason for this explanation. Because both the names used by
[mc]
and
mc_t
are both
"[mc_name]"
, both will appear as whatever name the player picks.
The
You must be registered to see the links
is a parameter that basically says "whatever the character says... stick
{i}(
in front of it". In this case, it will use the
open italics text tag (
You must be registered to see the links
) and also put an open bracket at the beginning. There is also a
what_suffix="){/i}"
to do the opposite at the end of the text.
The end result is that rather than seeing:
Simon: This is going to be fun.
-you instead see-
Simon: (This is going to be fun.)
It's a reasonably subtle difference that makes a clear distinction between when the character is speaking to someone else (or muttering out loud) and having some internal monologue with themselves.
It is common in games to use either italics or brackets to denote "thought text".
I prefer to use both. Hence the
{i}(
and
){/i}
.
I also tend to use
what_color=
to show the text in light gray rather pure white to further differentiate things subtlety.
There's nothing stopping you having similar extra character definitions for other characters thinking to themselves. Or some other variation on this same theme when a character is whispering (
mc_w
perhaps?). (small text, slight color difference, perhaps " ** " as prefix and suffix?).
The other use of this style of multiple
Character()
definitions for the same characters is when you first meet a new character and you don't know their name yet. Especially if you use custom colors for each character's name and/or character side images. (So
e
might be "Eileen", but
e_unk
might be "Unknown" or "???"). Though honestly, for the 2 or 3 lines of spoken dialogue before you find out their name... it can be considered overkill.
Now a couple of those extra personal preferences I've thrown in there, purely because I can and to demonstrate the flexibility of what can be done.
define narrator = Character(None, what_color="#FFFF99")
is a "special" character that is normally automatically created by RenPy (Unless you define one of your own). Any text not spoken a "normal" character (for example "*** THE END ***" is spoken by the
narrator
character. In this case, I'm using it to change the color of any spoken narrator text from white to very pale yellow (#FFFF99). It's a tiny thing and only one line of code... but (imo) creates a bit of extra polish.
Next, there is the
what_prefix="\""
and
what_suffix="\""
. Because double quote (
"
) is used to denote strings in code... languages can get confused by
" " "
. Within python (and RenPy), you can use single quotes too... so
' " '
is perfectly fine. But I chose to do it the other way, using "
You must be registered to see the links
". Basically all this is, is to put a backslash
\
before any problematic character.
The end result is that spoken text is shown on screen with double quotes at either end, just like they would be in a book. Again, not really needed, but (imo) an improvement.
Finally, there's the
You must be registered to see the links
stuff. Without going into too much technical detail, this just asks the player for a name (that it stores in the
mc_name
variable), strips off any leading or trailing spaces a player might have inadvertently typed (No names like
"Simon "
) and sets the name of "Simon" if the player didn't type anything (or only spaces).
The dollar sign at the beginning
$
is RenPy for "do python command".
I will say that whilst it's a lot of extra options when creating each new character, it's something that adds a bit of time to something that you'll only ever have to do once - and (again imo) the improvements are worth that bit of extra effort right at the beginning of your project.