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.
-
Dizzydude
- Regular
- Posts: 58
- Joined: Mon May 26, 2014 8:40 pm
- Projects: 「To Be Announced」
- Location: U.S.A
-
Contact:
#1
Post
by Dizzydude » Wed Jan 07, 2015 10:13 pm
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:
#2
Post
by mjshi » Wed Jan 07, 2015 10:40 pm
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: 1853
- Joined: Wed Dec 04, 2013 12:33 pm
-
Contact:
#3
Post
by philat » Wed Jan 07, 2015 11:51 pm
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.
-
Dizzydude
- Regular
- Posts: 58
- Joined: Mon May 26, 2014 8:40 pm
- Projects: 「To Be Announced」
- Location: U.S.A
-
Contact:
#4
Post
by Dizzydude » Thu Jan 08, 2015 8:14 am
Ah. Thank you both!
Users browsing this forum: No registered users