Formatting Text in Screen Language

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
trekopedia
Regular
Posts: 25
Joined: Thu Sep 14, 2017 11:38 pm
Location: Toronto, Canada
Contact:

Formatting Text in Screen Language

#1 Post by trekopedia »

Hi again everyone.

I'm studying screen language and trying to figure out how to handle formatting of text displayed via screen language.

For example, let's say I want to display a prompt / label ("What next?") above the menu options in the 'choice' screen:

Code: Select all

screen choice(items):
    style_prefix "choice"
    vbox:
        label "What next?" xpos 0.5 xalign 0.5 
        spacing 5
        for i in items:
            textbutton i.caption action i.action
How would I make that label bolded? Or in a different color?

In the documentation (https://renpy.org/doc/html/screens.html) it says that the label statement also takes Position Style Properties, some of which I've already incorporated in the example. However, I can't seem to add any of the Text Style Properties. Assuming I can format this text, could someone please give me an example of the correct syntax.

One other question, how would I go about modifying this screen to accept an additional parameter? Can I just add an additional parameter to this screen's definition (such as "screen choice(items, newParam)? If so, how do I change my script / code to call this screen? Currently, I call menus via "renpy.menu_display()". Do I just add the additional parameter?

As always, thank you in advance!

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Formatting Text in Screen Language

#2 Post by Imperf3kt »

Add a style tag

Code: Select all

style choice_label_text:
    Some properties
style choice_vbox:
    Some properties
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
trekopedia
Regular
Posts: 25
Joined: Thu Sep 14, 2017 11:38 pm
Location: Toronto, Canada
Contact:

Re: Formatting Text in Screen Language

#3 Post by trekopedia »

Ah! Of course -- as is so often the case, it is obvious once you know the answer! :-)

I haven't worked with styles in renpy yet. I guess that is next on the 'to learn' list!

Thanks for your assistance.

Post Reply

Who is online

Users browsing this forum: Semrush [Bot]