Setting formatting for specific characters/narration

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
Destiny-Smasher
Regular
Posts: 40
Joined: Wed Aug 09, 2017 7:10 pm
Projects: DownRight Fierce, Life is Strange: All Wounds
Tumblr: destiny-smasher.tumblr.com
itch: destiny-smasher
Contact:

Setting formatting for specific characters/narration

#1 Post by Destiny-Smasher »

I might just be overlooking something, though I've tried to search for this for a while...

I haven't figured it out yet, but is it possible to set a character's formatting so every time their dialogue shows up, it has special formatting?

Example:
o "{color=#A4A4A4}{i}Are you sure you're ready for that .{w=.2} .{w=.2} .{w=.2} ?{/i}{/color}"

Would it be possible to set it so tyhat every time 'o' speaks, their dialogue is always a specific color, and always italicized? That way, I don't have to add that formatting every time they speak?

Followup question, related:
Basically, I want to be able to assign a 'character' style/code to different types of narration, so I don't have to individually code each line of special narration.

So for example, you can format characters as such:
define m = Character('Max', image="Max", color="#F78181", ctc="ctc_animation", ctc_position="fixed")
define c = Character('Chloe', image="Chloe", color="#81BEF7", ctc="ctc_animation", ctc_position="fixed")

So when you have stuff like this:
m RightFocused1 "Nah.{w=.25} Feeling nauseous."
c Worried1 "That's 'cuz yor damn stomach is {i}empty{/i},{w=.25} hipster."
it'll show the character's name so the reader knows who's talking, right? So it ends up looking approximately like this.

Max
"Nah. Feeling Nauseous."

Chloe
"That's 'cuz yor damn stomach is empty, hipster."


But if I want the narrative, NOT a character's dialogue, to have special formatting, do I have to individually format each line of narration? Or is there a way to set a style up for narration without displaying a character's name? Because if I set it as a character...it would have a name show above the line. Which would muck up the point.

Ex. I have a dream sequence, I want all narration in the dream to use a different font. Do I have to format each line in that sequence, or is there a more efficient way?

Thanks for any help anyone can provide! Sorry if this is a dumb question. I've been self-learning renpy for a while now but I'm getting to a point where I feel like there must be more efficient ways to format things.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Setting formatting for specific characters/narration

#2 Post by trooper6 »

Everything you want is all character definitions. Check out the documentation: https://www.renpy.org/doc/html/dialogue.html#Character
If you want the color of the text for a certain character to be a certain color, use what_color in the character definition, if you want a certain character to always speak in italics, use what_prefix and what_suffix in the character definition.

For a narrator, create a character called say, n, and don't give them a name...then no name will show up.
If you want a second narrator that always speaks in a certain color in italics, create a new character with no name, say, n2, and give it whatever properties you want.

Hope that helps! Recheck the documentation.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
PMscenarios
Regular
Posts: 93
Joined: Sat Jul 01, 2017 11:22 pm
Completed: Whale's Waldo
Projects: In Blood, Xenopathy
Tumblr: pmscenarios
itch: pmscenarios
Contact:

Re: Setting formatting for specific characters/narration

#3 Post by PMscenarios »

As trooper said, almost everything can be defined per character.
For example, here's how I have some of my characters defined in my game:

Code: Select all

# Dreams - NVL-Mode
define dream_sequence = Character(None, kind=nvl, what_ypos=14, what_prefix="{cps=25}", what_suffix="{/cps}", ctc="ctc_anchored", ctc_position="fixed")
    # Stage script characters
define Stg = Character(None, kind=nvl, what_font="lib/DroidSans.ttf", what_prefix="{cps=32}{i}", what_suffix="{/cps}{/i}", what_size=20, what_text_align=0.5, ctc="ctc_anchored", ctc_position="fixed")
define C = Character("CINDY", kind=nvl, what_font="lib/DroidSans.ttf", what_size=20, what_text_align=0.5, what_prefix="{cps=32}", what_suffix="{/cps}", ctc="ctc_anchored", ctc_position="fixed")
define Fa = Character("FAIRY", kind=nvl, what_font="lib/DroidSans.ttf", what_size=20, what_text_align=0.5, what_prefix="{cps=32}", what_suffix="{/cps}", ctc="ctc_anchored", ctc_position="fixed")
define Rex = Character("REX", kind=nvl, what_font="lib/DroidSans.ttf", what_size=20, what_text_align=0.5, what_prefix="{cps=32}", what_suffix="{/cps}", ctc="ctc_anchored", ctc_position="fixed")
    # Before Nirav's named
define eN = Character(None, what_prefix="\"", what_suffix="\"", ctc="ctc_anchored", ctc_pause="ctc_anchored", ctc_timedpause=Null(), ctc_position="fixed")
    # Nirav - Custom name
define N = Character("[pname]", color="#00CCFF", ctc="ctc_anchored", ctc_pause="ctc_anchored", ctc_timedpause=Null(), ctc_position="fixed", show_side_image_right=False)
    # Narrator box
define T = Character(None, what_font="lib/QuattrocentoSans-Italic.ttf", ctc="ctc_anchored", ctc_pause="ctc_anchored", ctc_timedpause=Null(), ctc_position="fixed", show_side_image_right=False)
define Narr = Character(None, ctc="ctc_anchored", ctc_position="fixed", show_side_image_right=False)
    # Nirav's chat - side images - custom font
define Nc = Character("[pname]", color="#00CCFF", image="Nirav", what_font="lib/DroidSans.ttf", ctc="ctc_anchored", ctc_pause="ctc_anchored", ctc_timedpause=Null(), ctc_position="fixed", show_side_image_right=False)
The "T" character is my main character's thoughts, and uses an italic font for its dialogue.
ImageImageImage

User avatar
Destiny-Smasher
Regular
Posts: 40
Joined: Wed Aug 09, 2017 7:10 pm
Projects: DownRight Fierce, Life is Strange: All Wounds
Tumblr: destiny-smasher.tumblr.com
itch: destiny-smasher
Contact:

Re: Setting formatting for specific characters/narration

#4 Post by Destiny-Smasher »

Ah, duh! Don't give the character a name. How did I not think of that? I assumed that it was required for some reason.
I think this answers both of my questions, thanks a lot!

Post Reply

Who is online

Users browsing this forum: No registered users