Using multiple name boxes + properties questions
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.
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.
-
- Veteran
- Posts: 298
- Joined: Fri Apr 20, 2012 4:44 am
- Contact:
Using multiple name boxes + properties questions
Sorry, I'm just trying to sort out some UI issues with my novel. As before I have searched google/the forums but for some reason I can't find out the code to set different name boxes for different characters? I know how to change the text box for each character (http://www.renpy.org/wiki/renpy/doc/FAQ ... own_box.3F) but not the name box. I tried playing with the code in that link but couldn't figure it out...
My second question is, how do I make the name boxes a fixed size? I tried putting the code mentioned in that link (specifically: style.say_who_window.xminimum = 150, style.say_who_window.yminimum = 15) with increased values but it doesn't seem to changing anything?
My second question is, how do I make the name boxes a fixed size? I tried putting the code mentioned in that link (specifically: style.say_who_window.xminimum = 150, style.say_who_window.yminimum = 15) with increased values but it doesn't seem to changing anything?
alwaysthesamebluesky.com
- OokamiKasumi
- Eileen-Class Veteran
- Posts: 1779
- Joined: Thu Oct 14, 2010 3:53 am
- Completed: 14 games released -- and Counting.
- Organization: DarkErotica Games
- Deviantart: OokamiKasumi
- Location: NC, USA
- Contact:
Re: Using multiple name boxes + properties questions
EDIT: 1/06/2014crimsonnight wrote:...for some reason I can't find out the code to set different name boxes for different characters? ... My second question is, how do I make the name boxes a fixed size?
-- For some reason my original instructions no longer work. So, an Update! For reference, the current code came from Here: http://lemmasoft.renai.us/forums/viewto ... 89#p143604
These are my two Who boxes: Note: I preface my filenames with 'ui/' because in the game, I keep all my text boxes and button graphics in a file called ui (user interface.)
First!
-- Go to options.rpy and add in your two new Styles:
Code: Select all
## Frame ------------------------
# style.say_who_window.background = Frame("ui/frame.png", 0, 0)
## No Frame --------------------
style.say_who_window.background = "ui/WhoBox.png"
style.say_who_windowPNK = Style ('say_who_window')
style.say_who_windowPNK.background = "ui/WhoBoxPNK.png"
style.say_who_windowBLU = Style ('say_who_window')
style.say_who_windowBLU.background = "ui/WhoBoxBLU.png"
Next...
-- Go to screens.rpy under screen say:
First add a new default that allows the game to recognize the new styles.
Code: Select all
# Defaults for side_image and two_window
default side_image = None
default two_window = False
default who_window_style = "say_who_window" # New default!
Code: Select all
# The two window variant.
vbox:
style "say_two_window_vbox"
if who:
window:
style who_window_style # New Style!
text who:
id "who"
Code: Select all
define gi = Character('Giselle',
color="6699cc",
show_who_window_style="say_who_windowPNK",
show_two_window = True,
ctc="ctc_blink",)
define a = Character('Arthur',
color="9966cc",
show_who_window_style="say_who_windowBLU",
show_two_window = True,
ctc="ctc_blink",)
It looks like this!
-- Pink box: -- Blue box: I hope that helps.
Last edited by OokamiKasumi on Mon Jan 06, 2014 9:36 am, edited 3 times in total.
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed:
"No amount of great animation will save a bad story." -- John Lasseter of Pixar
Most recent Games Completed:
- The Walk[Psychological][NanoWinter] ~ PG New!
- Trap! [ModernFantasy][VN] ~ PG16
- The Adventures of Prince Ivan [Fant/Adv/VN] ~ PG
"No amount of great animation will save a bad story." -- John Lasseter of Pixar
-
- Veteran
- Posts: 298
- Joined: Fri Apr 20, 2012 4:44 am
- Contact:
Re: Using multiple name boxes + properties questions
Hi, thanks for that I actually guessed it was 'say_who_window' before but it crashes for some reason at the point it's meant to be displayed would you be able to tell me if there's anything wrong with my code please?
This is the error message:
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 507, in script
File "game\screens.rpy", line 41, in python
Exception: Style property say_who_window is unknown.
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\execution.py", line 288, in run
node.execute()
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\ast.py", line 453, in execute
renpy.exports.say(who, what, interact=self.interact)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\exports.py", line 757, in say
who(what, interact=interact)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\character.py", line 795, in __call__
self.do_display(who, what, cb_args=self.cb_args, **display_args)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\character.py", line 671, in do_display
**display_args)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\character.py", line 450, in display_say
what_text = show_function(who, what_string)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\character.py", line 655, in do_show
**self.show_args)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\character.py", line 263, in show_display_say
return renpy.display.screen.get_widget(screen, "what")
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\display\screen.py", line 620, in get_widget
screen.update()
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\display\screen.py", line 266, in update
self.screen.function(**self.scope)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\screenlang.py", line 1217, in __call__
renpy.python.py_exec_bytecode(self.code.bytecode, locals=scope)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\python.py", line 1297, in py_exec_bytecode
exec bytecode in globals, locals
File "game\screens.rpy", line 41, in <module>
id "who"
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\ui.py", line 448, in __call__
w = self.function(*args, **keyword)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\text\text.py", line 1097, in __init__
super(Text, self).__init__(**properties)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\display\core.py", line 131, in __init__
self.style = renpy.style.Style(style, properties, heavy=True)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\style.py", line 823, in __init__
build_style(self)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\style.py", line 632, in build_style
my_updates.extend(expand_properties(p))
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\style.py", line 510, in expand_properties
raise Exception("Style property %s is unknown." % prop)
Exception: Style property say_who_window is unknown.
Code: Select all
define r = DynamicCharacter("player_name", color="#404040", show_two_window=True, say_who_window="Namebox2.png",
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 507, in script
File "game\screens.rpy", line 41, in python
Exception: Style property say_who_window is unknown.
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\execution.py", line 288, in run
node.execute()
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\ast.py", line 453, in execute
renpy.exports.say(who, what, interact=self.interact)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\exports.py", line 757, in say
who(what, interact=interact)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\character.py", line 795, in __call__
self.do_display(who, what, cb_args=self.cb_args, **display_args)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\character.py", line 671, in do_display
**display_args)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\character.py", line 450, in display_say
what_text = show_function(who, what_string)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\character.py", line 655, in do_show
**self.show_args)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\character.py", line 263, in show_display_say
return renpy.display.screen.get_widget(screen, "what")
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\display\screen.py", line 620, in get_widget
screen.update()
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\display\screen.py", line 266, in update
self.screen.function(**self.scope)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\screenlang.py", line 1217, in __call__
renpy.python.py_exec_bytecode(self.code.bytecode, locals=scope)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\python.py", line 1297, in py_exec_bytecode
exec bytecode in globals, locals
File "game\screens.rpy", line 41, in <module>
id "who"
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\ui.py", line 448, in __call__
w = self.function(*args, **keyword)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\text\text.py", line 1097, in __init__
super(Text, self).__init__(**properties)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\display\core.py", line 131, in __init__
self.style = renpy.style.Style(style, properties, heavy=True)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\style.py", line 823, in __init__
build_style(self)
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\style.py", line 632, in build_style
my_updates.extend(expand_properties(p))
File "C:\Users\Grant\Google Drive\Writing\Always The Same Blue Sky\Visual Novel Project\Ren'Py\renpy\style.py", line 510, in expand_properties
raise Exception("Style property %s is unknown." % prop)
Exception: Style property say_who_window is unknown.
alwaysthesamebluesky.com
-
- Veteran
- Posts: 479
- Joined: Tue Jun 05, 2012 2:01 am
- Contact:
Re: Using multiple name boxes + properties questions
A different approach I have confirmed works:
In screens.rpy, edit your "screen say" like so:
Then define a character like so:
In screens.rpy, edit your "screen say" like so:
Code: Select all
[...]
vbox:
style "say_two_window_vbox"
if who:
window:
style "say_who_window"
background custom_who_background # ADD TIHS LINE
text who:
id "who"
[...]
Code: Select all
define Charmeleon = Character("Charry", show_two_window = True,
show_custom_who_background = Solid("#F00", minimum = (200, 50)))
-
- Veteran
- Posts: 298
- Joined: Fri Apr 20, 2012 4:44 am
- Contact:
-
- Veteran
- Posts: 298
- Joined: Fri Apr 20, 2012 4:44 am
- Contact:
Re: Using multiple name boxes + properties questions
Sorry one last problem lol, how do I justify the text in the box? If you look at the attached, you can see the text is currently too far down on the Y axis. Also is there a way to add an outline to the name box text in the same way I have with the text box text?
alwaysthesamebluesky.com
-
- Veteran
- Posts: 479
- Joined: Tue Jun 05, 2012 2:01 am
- Contact:
Re: Using multiple name boxes + properties questions
The outline is easy: "who_outlines = [(1, "#00F", 0, 0)]" in your call to Character.
I'm not sure about the alignment thing; I don't see it on a project I made from scratch. My best guess is there's some padding on the window you don't want. Try messing with style.say_who_window a bit (you can change it in options.rpy along with other styles).
I'm not sure about the alignment thing; I don't see it on a project I made from scratch. My best guess is there's some padding on the window you don't want. Try messing with style.say_who_window a bit (you can change it in options.rpy along with other styles).
-
- Veteran
- Posts: 298
- Joined: Fri Apr 20, 2012 4:44 am
- Contact:
Re: Using multiple name boxes + properties questions
Thanks for that, worked a treat
I played around with padding and that before asking, both padding and margin only seem to affect the outside of the box, not the names inside for some reason
I played around with padding and that before asking, both padding and margin only seem to affect the outside of the box, not the names inside for some reason
alwaysthesamebluesky.com
-
- Veteran
- Posts: 479
- Joined: Tue Jun 05, 2012 2:01 am
- Contact:
Re: Using multiple name boxes + properties questions
Oh, I think I realized what's going on: your background isn't big enough to cover the box Ren'Py computes for the "window" widget, and therefore you're getting unintuitive behavior. It should be clearer what's happening if you use a larger image or a solid color while you're tweaking the style settings.
You might need to mess with the yminimum setting on say_who_window to make it behave the way you want.
You might need to mess with the yminimum setting on say_who_window to make it behave the way you want.
-
- Veteran
- Posts: 298
- Joined: Fri Apr 20, 2012 4:44 am
- Contact:
Re: Using multiple name boxes + properties questions
For some reason xminimum/yminimum don't seem to be having an effect - cheers for your help but I decided to just pad the image in Photoshop in the end, it'd still be nice to change the font size for individual character names though
alwaysthesamebluesky.com
- OokamiKasumi
- Eileen-Class Veteran
- Posts: 1779
- Joined: Thu Oct 14, 2010 3:53 am
- Completed: 14 games released -- and Counting.
- Organization: DarkErotica Games
- Deviantart: OokamiKasumi
- Location: NC, USA
- Contact:
Re: Using multiple name boxes + properties questions
No longer relevant.
Last edited by OokamiKasumi on Mon Jan 06, 2014 9:14 am, edited 1 time in total.
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed:
"No amount of great animation will save a bad story." -- John Lasseter of Pixar
Most recent Games Completed:
- The Walk[Psychological][NanoWinter] ~ PG New!
- Trap! [ModernFantasy][VN] ~ PG16
- The Adventures of Prince Ivan [Fant/Adv/VN] ~ PG
"No amount of great animation will save a bad story." -- John Lasseter of Pixar
Re: Using multiple name boxes + properties questions
Um... I think I have a problem. Even though I wrote " background custom_who_background " in the screen and added show_custom_who_background = Solid("#F00", minimum = (200, 50)) to my define character, I get an error saying the custom_who_background is not defined.
This is the traceback:
This is my code for the screen.rpy:
This is how the code for my character looks like:
Can anyone tell me where I went wrong? Any help would be greatly appreciated
(Oh, and I'm using Renpy 6.16.3 with Editra v0.6.99, if that makes any difference )
This is the traceback:
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 188, in script
File "game/screens.rpy", line 42, in python
NameError: name 'custom_who_background' is not defined
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "E:\renpy-6.16.3-sdk\renpy\execution.py", line 288, in run
node.execute()
File "E:\renpy-6.16.3-sdk\renpy\ast.py", line 455, in execute
renpy.exports.say(who, what, interact=self.interact)
File "E:\renpy-6.16.3-sdk\renpy\exports.py", line 803, in say
who(what, interact=interact)
File "E:\renpy-6.16.3-sdk\renpy\character.py", line 807, in __call__
self.do_display(who, what, cb_args=self.cb_args, **display_args)
File "E:\renpy-6.16.3-sdk\renpy\character.py", line 673, in do_display
**display_args)
File "E:\renpy-6.16.3-sdk\renpy\character.py", line 452, in display_say
what_text = show_function(who, what_string)
File "E:\renpy-6.16.3-sdk\renpy\character.py", line 657, in do_show
**self.show_args)
File "E:\renpy-6.16.3-sdk\renpy\character.py", line 263, in show_display_say
return renpy.display.screen.get_widget(screen, "what")
File "E:\renpy-6.16.3-sdk\renpy\display\screen.py", line 620, in get_widget
screen.update()
File "E:\renpy-6.16.3-sdk\renpy\display\screen.py", line 266, in update
self.screen.function(**self.scope)
File "E:\renpy-6.16.3-sdk\renpy\screenlang.py", line 1217, in __call__
renpy.python.py_exec_bytecode(self.code.bytecode, locals=scope)
File "E:\renpy-6.16.3-sdk\renpy\python.py", line 1304, in py_exec_bytecode
exec bytecode in globals, locals
File "game/screens.rpy", line 42, in <module>
background custom_who_background
NameError: name 'custom_who_background' is not defined
Code: Select all
vbox:
style "say_two_window_vbox"
if who:
window:
style "say_who_window"
background custom_who_background
text who:
id "who"
window:
id "window"
has vbox:
style "say_vbox"
text what id "what"
Code: Select all
define l = Character ('Luke', color = "2F28FF",ctc="knife", ctc_position="fixed",window_background = "lukes.png", callback=speaker("boyl"), image = "luke",show_two_window=True,show_custom_who_background = Solid("#F00", minimum = (200, 50)))
(Oh, and I'm using Renpy 6.16.3 with Editra v0.6.99, if that makes any difference )
Re: Using multiple name boxes + properties questions
Neither method works for me, and I've been getting the exact same error as curiosity.
Edit: I did manage to get the code in this thread to work, however!
Edit: I did manage to get the code in this thread to work, however!
Who is online
Users browsing this forum: No registered users