Snippets

SinnyStar [Ren'Py] Say screen style selection

You are viewing an old version of this snippet. View the current version.
Revised by J. Tran b8ac054
init python:

    # style setting
    persistent.style = "1"

    # style 1: red
    namebox1 = Frame("#f00c",0,0)
    textbox1 = Frame("#ff0c",0,0)

    # style 2: blue
    namebox2 = Frame("#00fc",0,0)
    textbox2 = Frame("#0ffc",0,0)

init:
    # Namebox
    style namebox1_window is say_who_window:
        background namebox1
    style textbox2_window:
        background textbox2

    # Textbox
    style textbox1_window:
        background textbox1
    style namebox2_window is say_who_window:
        background namebox2
        
screen say(who, what, side_image=None, two_window=False):

    # Style changer
    frame:
        has vbox
        textbutton "Style 1: red" action SetField(persistent, "style", "1")
        textbutton "Style 2: blue" action SetField(persistent, "style", "2")

    # The two window variant.
    vbox:
        style "say_two_window_vbox"
        if who:
            window:
                # style "say_who_window"
                if persistent.style == "1":
                    style_group "namebox1"
                else:
                    style_group "namebox2"
                
                text who:
                    id "who"

        window:
            id "window"
            if persistent.style == "1":
                style_group "textbox1"
            else:
                style_group "textbox2"
                    
            vbox:
                style "say_vbox"

                text what id "what"
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.