Spaces in dynamic characters?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Dizzydude
Regular
Posts: 58
Joined: Mon May 26, 2014 8:40 pm
Projects: 「To Be Announced」
Location: U.S.A
Contact:

Spaces in dynamic characters?

#1 Post by Dizzydude »

If I wanted to have a dynamic character name with two words in it, how would it work?
I'm getting an error as I try what is basically this:

Code: Select all

define t = DynamicCharacter('Ms. Teacher', color="#4DB8DB")

label start:
$ Ms. Teacher = "???"

It seems like ren'py is registering it as "Ms" and only "Ms"?

mjshi
Regular
Posts: 179
Joined: Wed Mar 13, 2013 9:55 pm
Completed: MazeSite01, Ponderings of Time
Contact:

Re: Spaces in dynamic characters?

#2 Post by mjshi »

A general rule of thumb, variables can't have spaces/periods (unless you're doing a parent/child variable) or they'll throw up an error.

Try:

Code: Select all

define t = DynamicCharacter("msteacher", color="#4DB8DB")

init:
    $ msteacher = "Ms. Teacher"

label start:
    $ msteacher = "???"
Also, if you're referencing a variable, it should be in double quotes "", not single ''.

Hope this helped ^_^

philat
Eileen-Class Veteran
Posts: 1926
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Spaces in dynamic characters?

#3 Post by philat »

You don't really need to use Dynamic Character anymore, as far as I know. The following will work perfectly fine.

Code: Select all

define t = Character("[tname]", color="#4DB8DB")

init:
    $ tname = "???"

label start:
    t "This will show the name as ???"
    $ tname = "Ms. Teacher"
    t "This will show the name as Ms. Teacher."
It does the same thing as DynamicCharacter, but is easier to read (imo) and more consistent with other characters, so I prefer doing it this way.

ETA: There is no difference between double and single quotes in python, except that it may be easier to use one or the other to avoid escaping characters.

User avatar
Dizzydude
Regular
Posts: 58
Joined: Mon May 26, 2014 8:40 pm
Projects: 「To Be Announced」
Location: U.S.A
Contact:

Re: Spaces in dynamic characters?

#4 Post by Dizzydude »

Ah. Thank you both!

Post Reply

Who is online

Users browsing this forum: eleloyce