conflicting overrides in narration v. custom styles

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
duanemoody
Regular
Posts: 100
Joined: Fri Oct 02, 2009 2:32 pm
Projects: American Jurassic
Organization: Pier 7 Media
Location: Arizona
Contact:

conflicting overrides in narration v. custom styles

#1 Post by duanemoody »

I have a chunk of prologue narrative being spoken by a different speaker than the protagonist. To help emphasize this the text is styled differently using a separate font:

Code: Select all

style.say_dialogue.line_spacing = 10
style.say_thought.line_spacing = 10
    
style.marcus_narration = Style(style.default)
style.marcus_narration.font = "fonts/GoudyBookletter1911.otf"
style.marcus_narration.line_spacing = 2
In the script, Marcus' narration is managed by enclosing the text inside style tags thusly:

Code: Select all

"{=marcus_narration}Matters couldn’t get worse when folks started spreading stories about monsters roaming the scrubland. 
A mountain lion was found gored with its head crushed flat like an elephant’s foot had done it. 
Nearby trees were knocked over like some kid’s toys. Pastor Emmit said the End Times were here and we 
should settle our affairs.{/}"
The resulting text shows the correct font, but the line spacing reverts to style.say_thought.line_spacing instead of style.marcus_narration.line_spacing. Am I overlooking something obvious here? Also, if there's a better method for managing multiple narrator styles I'd be grateful to know.

luminarious
Veteran
Posts: 353
Joined: Thu May 01, 2008 1:12 pm
Projects: Winter, winter
Location: Estonia
Contact:

Re: conflicting overrides in narration v. custom styles

#2 Post by luminarious »

Wouldn't making a separate character with along with specifying his text styles differently be easier?

duanemoody
Regular
Posts: 100
Joined: Fri Oct 02, 2009 2:32 pm
Projects: American Jurassic
Organization: Pier 7 Media
Location: Arizona
Contact:

Re: conflicting overrides in narration v. custom styles

#3 Post by duanemoody »

But characters have their names at the top and narrators don't. Or am I missing something here.

JQuartz
Eileen-Class Veteran
Posts: 1265
Joined: Fri Aug 31, 2007 7:02 am
Projects: 0 completed game. Still haven't made any meaningfully completed games...
Contact:

Re: conflicting overrides in narration v. custom styles

#4 Post by JQuartz »

duanemoody wrote:But characters have their names at the top and narrators don't.
Use None if you don't want the names like so:

Code: Select all

init:
    $ d =Character(None)
label start:
    d "This one doesn't have a name."
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.

duanemoody
Regular
Posts: 100
Joined: Fri Oct 02, 2009 2:32 pm
Projects: American Jurassic
Organization: Pier 7 Media
Location: Arizona
Contact:

Re: conflicting overrides in narration v. custom styles

#5 Post by duanemoody »

Thanks, but the problem remains that characters based on (None) inherit the narrator line_spacing and while the font can be overridden, the line_spacing cannot.

I'm sort of confused as to why this is.

edit: Characters based on (None) inherit from style.say_dialogue.line_spacing not style.say_thought.line_spacing, but the point remains that I can't override the line spacing.

JQuartz
Eileen-Class Veteran
Posts: 1265
Joined: Fri Aug 31, 2007 7:02 am
Projects: 0 completed game. Still haven't made any meaningfully completed games...
Contact:

Re: conflicting overrides in narration v. custom styles

#6 Post by JQuartz »

duanemoody wrote:Thanks, but the problem remains that characters based on (None) inherit the narrator line_spacing and while the font can be overridden, the line_spacing cannot.
Use what_line_spacing and font in the Character like so:

Code: Select all

init:
    $ j =Character(None, what_line_spacing=2, what_font="fonts/GoudyBookletter1911.otf")
You can read about the properties here:http://www.renpy.org/wiki/renpy/doc/ref ... Characters and here:http://www.renpy.org/wiki/renpy/doc/ref ... Properties
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.

duanemoody
Regular
Posts: 100
Joined: Fri Oct 02, 2009 2:32 pm
Projects: American Jurassic
Organization: Pier 7 Media
Location: Arizona
Contact:

Re: conflicting overrides in narration v. custom styles

#7 Post by duanemoody »

Bam! This was the solution. Thanks a million and I'll read that section more closely. I'm coming from an HTML/CSS/JavaScript background so my understanding of how to override/overload is a little different from how Python/Ren'Py works.

luminarious
Veteran
Posts: 353
Joined: Thu May 01, 2008 1:12 pm
Projects: Winter, winter
Location: Estonia
Contact:

Re: conflicting overrides in narration v. custom styles

#8 Post by luminarious »

You have no idea how many times I've thought to myself: "I wish this was more like CSS.." :P

JinzouTamashii
Eileen-Class Veteran
Posts: 1686
Joined: Mon Sep 21, 2009 8:03 pm
Projects: E-mail me if you wanna rock the planet
Location: USA
Contact:

Re: conflicting overrides in narration v. custom styles

#9 Post by JinzouTamashii »

You can't imagine how many times I've thought to myself:

I wish it was just like singing in English or Japanese or Latin... :/
Don't worry, we can get through it together. I didn't forget about you! I just got overwhelmed.
https://cherylitou.wordpress.com

Post Reply

Who is online

Users browsing this forum: Google [Bot]