Trying to pull out text properties from say_dialogue style
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.
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.
Trying to pull out text properties from say_dialogue style
Hello! I want to let players decide which font to use inside the main say box from the predefined number of options. Thanks to Ren'py manual and community I managed to get this done and now it's time to put a finishing touch - a test string to show how the resulting text will look like. Otherwise, players would need to leave preferences menu to see the outcome and go back if they don't like it.
I've created another hbox below the switching option, but I don't know how to pull the text properties from the say_dialogue style. Linking it directly to the hbox causes problems - the test string disappears and the alignment goes awry.
Is there a method to pull current text properties from a specific style but nothing else? Or maybe there is a more convenient way to achieve the result I seek?
Thank you.
I've created another hbox below the switching option, but I don't know how to pull the text properties from the say_dialogue style. Linking it directly to the hbox causes problems - the test string disappears and the alignment goes awry.
Is there a method to pull current text properties from a specific style but nothing else? Or maybe there is a more convenient way to achieve the result I seek?
Thank you.
Re: Trying to pull out text properties from say_dialogue sty
Why would you need to pull it from the say_dialogue style? Presumably you are using a button to set the style in the first place in the same preference menu.
Re: Trying to pull out text properties from say_dialogue sty
Yes, the button is in the preference menu. Here's the code to clear things up:philat wrote:Why would you need to pull it from the say_dialogue style? Presumably you are using a button to set the style in the first place in the same preference menu.
Code: Select all
vbox:
label _("Choose the narrative font")
hbox:
textbutton "Garamond" action StylePreference ("text", "Garamond")
textbutton "Efron" action StylePreference ("text", "Efron")
textbutton "Sans" action StylePreference ("text", "Sans")
textbutton "Serif" action StylePreference ("text", "Serif")
hbox:
text _("Ingame story text will look like this")
Code: Select all
renpy.register_style_preference("text", "Efron", style.say_dialogue, "font", "Efron.ttf")
renpy.register_style_preference("text", "Efron", style.say_dialogue, "size", 34)
renpy.register_style_preference("text", "Efron", style.say_dialogue, "color", "#000000")
renpy.register_style_preference("text", "Serif", style.say_dialogue, "font", "PTSerif.ttf")
renpy.register_style_preference("text", "Serif", style.say_dialogue, "size", 34)
renpy.register_style_preference("text", "Serif", style.say_dialogue, "color", "#000000")
- Divona
- Miko-Class Veteran
- Posts: 678
- Joined: Sun Jun 05, 2016 8:29 pm
- Completed: The Falconers: Moonlight
- Organization: Bionic Penguin
- itch: bionicpenguin
- Contact:
Re: Trying to pull out text properties from say_dialogue sty
Do this:
Code: Select all
hbox:
text _("Ingame story text will look like this") style style.say_dialogue
Re: Trying to pull out text properties from say_dialogue sty
Thanks, but linking it directly like this forces (or at least I think so?) the text to use all the settings from the say_dialogue style including placement. In the result, I can't even see the string properly - it slides off. That's why I'm trying to pull only the font/text properties from it.Divona wrote:Do this:Code: Select all
hbox: text _("Ingame story text will look like this") style style.say_dialogue
I also tried to do this with style.say_dialogue.text and Ren'py gives me an exception about the missing attribute for the style.
Re: Trying to pull out text properties from say_dialogue sty
After some poking around I ended up with this:
Code: Select all
hbox:
text _("Ingame story text will look like this") font style.say_dialogue.font size style.say_dialogue.size color style.say_dialogue.color
Who is online
Users browsing this forum: Bing [Bot], Google [Bot], span4ev
