[Solved]How to share same custom textbox settings for defined chartacters?

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
Dark79
Regular
Posts: 61
Joined: Sun Apr 18, 2021 2:21 pm
Contact:

[Solved]How to share same custom textbox settings for defined chartacters?

#1 Post by Dark79 »

Hi,

As the title of the subject says, I will have many defined characters, and they will have custom made textboxes, some of them will share settings. I feel like there is something very simple to be done about this but can't quite figure out

Example:

Code: Select all

define char1 = Character(None,
                    window_background ="gui/speechbubble.png",
                    window_xsize = 620,
                    window_ysize = 372,
                    window_xalign = 0.6,
                    window_yalign = 0.3,

                    what_xpos = 70,
                    what_xsize = 500,
                    what_color = "#ffffff",
                    what_size = 26,
                    who_color="#ffffff",
                    )

define char2 = Character(None,
                    window_background ="gui/speechbubble.png",
                    window_xsize = 620,
                    window_ysize = 372,
                    window_xalign = 0.6,
                    window_yalign = 0.3,

                    what_xpos = 70,
                    what_xsize = 500,
                    what_color = "#ffffff",
                    what_size = 26,
                    who_color="#ffffff",
                    )
These two are using same settings for the textbox window. Considering I will have a lot of characters who will use the same settings, this would lead to writing a lot of the same thing. Thus if I need to change/fix something I would need to apply for everyone. So I wonder is there a way to simplify so that they share like a blueprint, where if you change it, it would change for everyone using the blueprint.
Last edited by Dark79 on Tue Apr 02, 2024 9:03 am, edited 2 times in total.

User avatar
Dark79
Regular
Posts: 61
Joined: Sun Apr 18, 2021 2:21 pm
Contact:

Re: How to share same custom textbox settings for defined chartacters?

#2 Post by Dark79 »

Nevermind, I should have read it better in the documentation https://www.renpy.org/doc/html/dialogue.html#Character. :D

Code: Select all

style MyWindowTextbox_style:
    background "gui/speechbubble.png"
    xsize 620
    ysize 372
    xalign 0.6
    yalign 0.3

style MyWhatTextbox_style:
    xpos 70
    ypos 70
    xsize 500
    color "#ffffff"
    size 26

style MyWhoTextbox_Style:
    color"#ffffff"

define char1 = Character(None,
                    window_style= "MyWindowTextbox_style",
                    who_style = "MyWhoTextbox_Style",
                    what_style = "MyWhatTextbox_style"

                    )

define char2 = Character(None,
                    window_style= "MyWindowTextbox_style",
                    who_style = "MyWhoTextbox_Style",
                    what_style = "MyWhatTextbox_style"
                    )


Post Reply

Who is online

Users browsing this forum: voluorem