How do I make a text style preference?

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
NikMacPattyWak
Newbie
Posts: 10
Joined: Thu Sep 28, 2017 2:21 pm
Projects: Socializing Simulator
Github: nikkimacahon
Contact:

How do I make a text style preference?

#1 Post by NikMacPattyWak » Sat Jan 26, 2019 2:42 pm

I want to use a recurring on screen text (not tied to any characters or dialogue) that with special formatting and I don't want to have to specific that text formatting every time I want to use that text. Is there a way to make a text style preference so that I only need to define that formatting once?
-Nikki
nikkimacahon.com

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: How do I make a text style preference?

#2 Post by Per K Grok » Sun Jan 27, 2019 3:31 pm

NikMacPattyWak wrote:
Sat Jan 26, 2019 2:42 pm
I want to use a recurring on screen text (not tied to any characters or dialogue) that with special formatting and I don't want to have to specific that text formatting every time I want to use that text. Is there a way to make a text style preference so that I only need to define that formatting once?
You could make a screen like this

Code: Select all

screen special():
    frame:
        pos (50, 100)
        padding (5,5,5,5)
        text "qwerty bngt" size 17 color "#F00"

    timer 4.0 action Hide("special")
You can format the text as you want.

You show the text with

show screen special

it will automatically hide after 4 sec. (or what ever time you want to set) as it is set up.

Is this what your looking for?

User avatar
NikMacPattyWak
Newbie
Posts: 10
Joined: Thu Sep 28, 2017 2:21 pm
Projects: Socializing Simulator
Github: nikkimacahon
Contact:

Re: How do I make a text style preference?

#3 Post by NikMacPattyWak » Mon Jan 28, 2019 1:02 pm

Per K Grok wrote:
Sun Jan 27, 2019 3:31 pm
NikMacPattyWak wrote:
Sat Jan 26, 2019 2:42 pm
I want to use a recurring on screen text (not tied to any characters or dialogue) that with special formatting and I don't want to have to specific that text formatting every time I want to use that text. Is there a way to make a text style preference so that I only need to define that formatting once?
You could make a screen like this

Code: Select all

screen special():
    frame:
        pos (50, 100)
        padding (5,5,5,5)
        text "qwerty bngt" size 17 color "#F00"

    timer 4.0 action Hide("special")
You can format the text as you want.

You show the text with

show screen special

it will automatically hide after 4 sec. (or what ever time you want to set) as it is set up.

Is this what your looking for?
Kinda. I want the text to change but the font/size/color/etc. to stay the same. I essentially want it to be an on-screen prompt that changes from encounter to encounter. Like "So-and-So wants to borrow your pencil" or "This person is asking you to prom". Different text, same formatting.
-Nikki
nikkimacahon.com

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: How do I make a text style preference?

#4 Post by Per K Grok » Mon Jan 28, 2019 2:17 pm

NikMacPattyWak wrote:
Mon Jan 28, 2019 1:02 pm
----

Kinda. I want the text to change but the font/size/color/etc. to stay the same. I essentially want it to be an on-screen prompt that changes from encounter to encounter. Like "So-and-So wants to borrow your pencil" or "This person is asking you to prom". Different text, same formatting.

If you change the code as below you can chose whatever message you want each time you show the screen.
If you want you could have an additional argument for the time before the screen hides.

Code: Select all

screen special(message):
    frame:
        pos (50, 100)
        padding (5,5,5,5)
        text message size 17 color "#F00"

    timer 4.0 action Hide("special")

-----


    show screen special("qwerty bngt")


User avatar
NikMacPattyWak
Newbie
Posts: 10
Joined: Thu Sep 28, 2017 2:21 pm
Projects: Socializing Simulator
Github: nikkimacahon
Contact:

Re: How do I make a text style preference?

#5 Post by NikMacPattyWak » Mon Jan 28, 2019 8:36 pm

Per K Grok wrote:
Mon Jan 28, 2019 2:17 pm

If you change the code as below you can chose whatever message you want each time you show the screen.
If you want you could have an additional argument for the time before the screen hides.

Code: Select all

screen special(message):
    frame:
        pos (50, 100)
        padding (5,5,5,5)
        text message size 17 color "#F00"

    timer 4.0 action Hide("special")

-----


    show screen special("qwerty bngt")

Thank you!
-Nikki
nikkimacahon.com

Post Reply

Who is online

Users browsing this forum: Bing [Bot]