One Character with two stylings?

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
recreation
Regular
Posts: 52
Joined: Sun Jul 01, 2018 8:32 am
Contact:

One Character with two stylings?

#1 Post by recreation »

I bet its the most simple thing, but I cant figure it out right now.
I have one character who's text should look different when he's thinking and not talking.
What I tried:

Code: Select all

define pc = Character("[pc]", who_color="#2b68b2")
define pcthink = Character("[pc]", who_italic=True, what_italic=True, what_color="#888", what_prefix="(", what_suffix=")")
This works for pcthink, but the 1st one stays the same color and doesn't do anything no matter what styling attributes I apply.

Code: Select all

define pc = Character("[pc]", who_color="#2b68b2")
define pcthink = Character("[pcthink]", who_italic=True, what_italic=True, what_color="#888", what_prefix="(", what_suffix=")")
...other stuff...
$ pc = renpy.input("Choose your name.")
$ pcthink = pc
Results in no styling applied to both (which actually makes sense if pcthink would inherit the styling from pc?).

I don't get it, what am I doing wrong?

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

Re: One Character with two stylings?

#2 Post by philat »

Don't use the same variable name for your character object and character name. In other words.

Code: Select all

define pc = Character("[pc_name]", who_color="#2b68b2")
define pcthink = Character("[pcthink_name]", who_italic=True, what_italic=True, what_color="#888", what_prefix="(", what_suffix=")")
...other stuff...
$ pc_name = renpy.input("Choose your name.")
$ pcthink_name = pc_name

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: One Character with two stylings?

#3 Post by Remix »

Code: Select all

default pc_name = "???"
define pc = Character("[pc_name]", who_color="#2b68b2")
# char pc uses name pc_name (note that pc and pc_name are not the same)

define pcthink = Character("[pc_name] (thoughts)", who_italic=True, what_italic=True, what_color="#888", what_prefix="(", what_suffix=")")
# char uses same name

...other stuff...
$ pc_name = renpy.input("Choose your name.")

pc "This is me talking"
pc_think "This is me thinking"
Frameworks & Scriptlets:

recreation
Regular
Posts: 52
Joined: Sun Jul 01, 2018 8:32 am
Contact:

Re: One Character with two stylings?

#4 Post by recreation »

Thanks you too. I was getting a headache because of this.

User avatar
mitoky
Veteran
Posts: 316
Joined: Sat Feb 07, 2015 9:12 pm
Projects: The Purring Demon's Love, circus eterie
Contact:

Re: One Character with two stylings?

#5 Post by mitoky »

Dont name your character and variable the same thing "pc". Otherwise it gives problems.
Add the italic stiling into the prefix/suffix (Tested, should work):

Code: Select all

define pc = Character("[pc_name]", who_color="#2b68b2")
define pcthink = Character("[pc_name]", who_color="#888", who_prefix='{i}', who_suffix='{/i}', what_prefix='({i}', what_suffix='{/i})')

Post Reply

Who is online

Users browsing this forum: Google [Bot]