Code: Select all
$style.window.background = Frame("Textbox1.png", 12, 12)
Code: Select all
$style.window.background = Frame("Textbox1.png", 12, 12)
Code: Select all
style.window.background = Frame("Textbox1.png", 12, 12)
## Margin is space surrounding the window, where the background
## is not drawn.
style.window.left_margin = 385
style.window.right_margin = 385
style.window.top_margin = 0
style.window.bottom_margin = 15
## Padding is space inside the window, where the background is
## drawn.
style.window.left_padding = 20
style.window.right_padding = 20
style.window.top_padding = 15
style.window.bottom_padding = 14
## This is the minimum height of the window, including the margins
## and padding.
style.window.yminimum = 132Code: Select all
# indented and aligned with the rest
style.window.background = Frame("Textbox1.png", 12, 12)
## Margin is space surrounding the window, where the background
## is not drawn.
style.window.left_margin = 385
# rest of code
# ...
Oh sorry, it is indented, I just copied it from the beginning of the word! It's strange, the properties set in options apply when I comment out the new code, so for some reason the new code is bypassing them my end...SinnyROM wrote:Sorry, I completely forgot about those in options.rpy! I don't use them so my mind went blank.
However, I tried to change those values and it still applied them. What I noticed is that the first line isn't indented like the rest. Since options.rpy is almost entirely an init python block, and that statement is in Python, indentation is part of the structure. Try indenting it and see if it registers?Code: Select all
# indented and aligned with the rest style.window.background = Frame("Textbox1.png", 12, 12) ## Margin is space surrounding the window, where the background ## is not drawn. style.window.left_margin = 385 # rest of code # ...
Code: Select all
init python:
persistent.style = ""Code: Select all
define narrator = Character(None, what_outlines=my_n)
define stw = Character(None, show_two_window=True)
define k = Character("Kira", color="#ffffff", kind=stw, what_outlines=my_k, who_outlines=[(3, "#b6a472", 0, 0)],
# styling the namebox
# default is namebox1, change if otherwise
show_custom_who_background=ConditionSwitch(
"persistent.style == 'A'", "Namebox1A.png",
"True", "Namebox1.png",
)
)
define k2 = Character(None, what_outlines=my_k)
define r = DynamicCharacter("player_name", color="#ffffff", show_two_window=True, what_outlines=my_r, who_outlines = [(3, "#79003f", 0, 0)],
# styling the namebox
# default is namebox1, change if otherwise
show_custom_who_background=ConditionSwitch(
"persistent.style == 'A'", "Namebox2A.png",
"True", "Namebox2.png",
)
)
define g = Character("Grant", color="#ffffff", kind=stw, what_outlines=my_g, who_outlines = [(3, "#50697f", 0, 0)],
# styling the namebox
# default is namebox1, change if otherwise
show_custom_who_background=ConditionSwitch(
"persistent.style == 'A'", "Namebox2A.png",
"True", "Namebox2.png",
)
)
define gs = Character("Kimmy", color="#ffffff", kind=stw, what_outlines=my_gs, who_outlines = [(3, "#c95f8c", 0, 0)],
# styling the namebox
# default is namebox1, change if otherwise
show_custom_who_background=ConditionSwitch(
"persistent.style == 'A'", "Namebox2A.png",
"True", "Namebox2.png",
)
)Code: Select all
screen say(who, what, side_image=None, two_window=False, # the usual arguments
custom_who_background="say_who_window_background" # for the custom namebox
):
# Defaults for side_image and two_window
default side_image = None
default two_window = False
# Decide if we want to use the one-window or two-window varaint.
if not two_window:
# The one window variant.
window:
id "window"
# change textbox style
background ConditionSwitch(
"persistent.style == 'A'", "Textbox2.png",
"True", "Textbox1.png"
)
has vbox:
style "say_vbox"
if who:
text who id "who"
text what id "what"
else:
# The two window variant.
vbox:
style "say_two_window_vbox"
if who:
window:
style "say_who_window"
background custom_who_background
text who:
id "who"
window:
id "window"
# change textbox style
background ConditionSwitch(
"persistent.style == 'A'", "Textbox2.png",
"True", "Textbox1.png"
)
has vbox:
style "say_vbox"
text what id "what"
# If there's a side image, display it above the text.
if side_image:
add side_image
else:
add SideImage() xalign 0.0 yalign 1.0
# Use the quick menu.
use quick_menuCode: Select all
frame:
style_group "pref"
has vbox
label _("Textbox Style")
textbutton "Standard" action SetField(persistent, "style", "")
textbutton "Plain" action SetField(persistent, "style", "A")Code: Select all
style.window.background = Frame("Textbox1.png", 12, 12)
## Margin is space surrounding the window, where the background
## is not drawn.
style.window.left_margin = 385
style.window.right_margin = 385
style.window.top_margin = 0
style.window.bottom_margin = 15
## Padding is space inside the window, where the background is
## drawn.
style.window.left_padding = 20
style.window.right_padding = 20
style.window.top_padding = 15
style.window.bottom_padding = 14
## This is the minimum height of the window, including the margins
## and padding.
style.window.yminimum = 132
#Namebox
style.say_who_window.background = Frame("namebox1.png", 8, 8)
style.say_who_window.ypos = 102
style.say_who_window.left_margin = 384
style.say_who_window.xminimum = 25
style.say_who_window.yminimum = 10
#Input Prompt
style.input_prompt.outlines = [(3.3, "#2d2d2d", 0, 0)]
style.input.color = '#ffffff'
style.input.outlines = [(3.3, "#79003f", 0, 0)]Code: Select all
# # change textbox style
# background ConditionSwitch(
# "persistent.style == 'A'", "Textbox2.png",
# "True", "Textbox1.png"
# )Code: Select all
# replace conditionswitch with if statement
if persistent.style == "A":
background "Textbox2.png"
else:
background "Textbox1.png"Like this?:SinnyROM wrote:I looked over your code, and it looks like it should work fine, since that line is only changing the background. I may be missing something as well haha.
Does it work if it's just an if statement?Code: Select all
# replace conditionswitch with if statement if persistent.style == "A": background "Textbox2.png" else: background "Textbox1.png"
Code: Select all
window:
id "window"
# change textbox style
if persistent.style == "A":
background "Textbox2.png"
else:
background "Textbox1.png"
has vbox:
style "say_vbox"
if who:
text who id "who"
text what id "what"
else:
# The two window variant.
vbox:
style "say_two_window_vbox"
if who:
window:
style "say_who_window"
background custom_who_background
text who:
id "who"
window:
id "window"
# change textbox style
if persistent.style == "A":
background "Textbox2.png"
else:
background "Textbox1.png"
has vbox:
style "say_vbox"
text what id "what"File "game/screens.rpy", line 30: The has statement may not be given after a child has been supplied.
has vbox:
^
Code: Select all
# has vbox:
# style "say_vbox"
#
# text what id "what"
vbox:
style "say_vbox"
text what id "what"Code: Select all
screen say(who, what, side_image=None, two_window=False, # the usual arguments
custom_who_background="say_who_window_background" # for the custom namebox
):
# Defaults for side_image and two_window
default side_image = None
default two_window = False
# Decide if we want to use the one-window or two-window varaint.
if not two_window:
# The one window variant.
window:
id "window"
# change textbox style
if persistent.style == "A":
background "Textbox2.png"
else:
background "Textbox1.png"
vbox:
style "say_vbox"
if who:
text who id "who"
text what id "what"
else:
# The two window variant.
vbox:
style "say_two_window_vbox"
if who:
window:
style "say_who_window"
background custom_who_background
text who:
id "who"
window:
id "window"
# change textbox style
if persistent.style == "A":
background "Textbox2.png"
else:
background "Textbox1.png"
vbox:
style "say_vbox"
text what id "what"
# If there's a side image, display it above the text.
if side_image:
add side_image
else:
add SideImage() xalign 0.0 yalign 1.0
# Use the quick menu.
use quick_menuCode: Select all
label pick_style1:
$style.window.background = Frame("background1.png", 12, 12)
$style.rebuild()
return
label pick_style2:
$style.window.background = Frame("background2.png", 12, 12)
$style.rebuild()
returnCode: Select all
frame:
style_group "pref"
has vbox
label _("Style")
textbutton _("Style 1") action Jump('pick_style1')
textbutton _("Style 2") action Jump('pick_style2')Code: Select all
frame:
style_group "pref"
has vbox
label _("Textbox Style")
textbutton "Standard" action [SetField(persistent, "style", ""), Jump('pick_style1')]
textbutton "Plain" action [SetField(persistent, "style", "A"), Jump('pick_style2')]