Different Nameboxes for Different Characters [SOLVED]

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
Thee Forsaken One
Regular
Posts: 196
Joined: Sun Mar 01, 2009 8:10 pm
Completed: RE: Alistair++; Backstage Pass; Three Guys That Paint; The Reject Demon Toko - Ch 0; The Menagerie
Projects: Winning Hearts; Astral Hours
Organization: Forsaken Productions
Tumblr: ForsakenProductions
Deviantart: TheeForsakenOne
Location: Scotland
Contact:

Different Nameboxes for Different Characters [SOLVED]

#1 Post by Thee Forsaken One »

I've been trying to get custom nameboxes working using some tutorials I've found scattered about this forum. I haven't been able to get it working, however. All the variations keep producing the same traceback:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 12, in script
    
Exception: Unknown keyword arguments: who_window_style

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 12, in script
    
  File "C:\Users\Owner\renpy-6.14.1-sdk\renpy\ast.py", line 593, in execute
    renpy.exports.say(who, what, interact=self.interact)
  File "C:\Users\Owner\renpy-6.14.1-sdk\renpy\exports.py", line 1024, in say
    who(what, interact=interact)
  File "C:\Users\Owner\renpy-6.14.1-sdk\renpy\character.py", line 826, in __call__
    self.do_display(who, what, cb_args=self.cb_args, **display_args)
  File "C:\Users\Owner\renpy-6.14.1-sdk\renpy\character.py", line 688, in do_display
    **display_args)
  File "C:\Users\Owner\renpy-6.14.1-sdk\renpy\character.py", line 465, in display_say
    what_text = show_function(who, what_string)
  File "C:\Users\Owner\renpy-6.14.1-sdk\renpy\character.py", line 672, in do_show
    **self.show_args)
  File "C:\Users\Owner\renpy-6.14.1-sdk\renpy\character.py", line 275, in show_display_say
    return renpy.display.screen.get_widget(screen, "what", layer)
  File "C:\Users\Owner\renpy-6.14.1-sdk\renpy\display\screen.py", line 968, in get_widget
    screen.update()
  File "C:\Users\Owner\renpy-6.14.1-sdk\renpy\display\screen.py", line 555, in update
    self.screen.function(**self.scope)
  File "C:\Users\Owner\renpy-6.14.1-sdk\renpy\ast.py", line 148, in apply_arguments
    return parameters.apply(args, kwargs, ignore_errors)
  File "C:\Users\Owner\renpy-6.14.1-sdk\renpy\ast.py", line 136, in apply
    raise Exception("Unknown keyword arguments: %s" % ( ", ".join(values.keys())))
Exception: Unknown keyword arguments: who_window_style

Windows-7-6.1.7601-SP1
Ren'Py 6.99.0.303
tgtp-GUI 0.0
These are the relevant parts of the code (I'm testing using the default game structure):

In script.rpy:

Code: Select all

# Declare characters used by this game.
define e = Character('Eileen', color="#c8ffc8", show_who_window_style="say_who_windowBrown", show_two_window = True)
In options.rpy:

Code: Select all

    style.say_who_windowBlue = Style ('say_who_window')
    style.say_who_windowBlue.background = "UI/Textbox/name_tag_blue.png"
    
    style.say_who_windowBrown = Style ('say_who_window')
    style.say_who_windowBrown.background = "UI/Textbox/name_tag_brown.png"
    
    style.say_who_windowGreen = Style ('say_who_window')
    style.say_who_windowGreen.background = "UI/Textbox/name_tag_green.png"
    
    style.say_who_windowOrange = Style ('say_who_window')
    style.say_who_windowOrange.background = "UI/Textbox/name_tag_orange.png"
    
    style.say_who_windowPink = Style ('say_who_window')
    style.say_who_windowPink.background = "UI/Textbox/name_tag_pink.png"
    
    style.say_who_windowYellow = Style ('say_who_window')
    style.say_who_windowYellow.background = "UI/Textbox/name_tag_yellow.png"
In screens.rpy:

Code: Select all

screen say(who, what, side_image=None, two_window=False):

    # Decide if we want to use the one-window or two-window variant.
        
    default side_image = None
    default two_window = False
    default who_window_style = "say_who_window"
    
    if not two_window:

        # The one window variant.
        window:
            id "window"

            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 who_window_style # New Style!

                    text who:
                        id "who"

            window:
                id "window"

                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_menu
Any ideas? I'm completely stumped.
Last edited by Thee Forsaken One on Fri Mar 27, 2015 12:10 pm, edited 1 time in total.

User avatar
PyTom
Ren'Py Creator
Posts: 16094
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Different Nameboxes for Different Characters

#2 Post by PyTom »

You want to declare who_window_style as an argument, not a default.

Code: Select all

define e = Character('Eileen', color="#c8ffc8", show_who_window_style="say_who_windowBrown", show_two_window = True, show_who_window_style="say_who_window"):
    # ...
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
Thee Forsaken One
Regular
Posts: 196
Joined: Sun Mar 01, 2009 8:10 pm
Completed: RE: Alistair++; Backstage Pass; Three Guys That Paint; The Reject Demon Toko - Ch 0; The Menagerie
Projects: Winning Hearts; Astral Hours
Organization: Forsaken Productions
Tumblr: ForsakenProductions
Deviantart: TheeForsakenOne
Location: Scotland
Contact:

Re: Different Nameboxes for Different Characters

#3 Post by Thee Forsaken One »

You seem to have repeated an argument in that character definition. Am I missing something?

EDIT: Nevermind, I got what you were talking about. Thank you very much. :)

User avatar
Jae
Regular
Posts: 192
Joined: Sun Sep 13, 2015 5:41 pm
Projects: Pokémon Academy Life
Location: New York, NY
Contact:

Re: Different Nameboxes for Different Characters

#4 Post by Jae »

[irrelevant]

Vytswell
Newbie
Posts: 14
Joined: Tue Oct 27, 2020 2:23 pm
Contact:

Re: Different Nameboxes for Different Characters

#5 Post by Vytswell »

PyTom wrote: Fri Mar 27, 2015 11:52 am You want to declare who_window_style as an argument, not a default.

Code: Select all

define e = Character('Eileen', color="#c8ffc8", show_who_window_style="say_who_windowBrown", show_two_window = True, show_who_window_style="say_who_window"):
    # ...
I'm trying to do this on latest RenPy and RenPy says that I have argument repeated, if I'm deleting repeating argument I get

Code: Select all

Exception: Unknown keyword arguments: who_window_style

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: Different Nameboxes for Different Characters [SOLVED]

#6 Post by _ticlock_ »

Hi, Vytswell,

I think when defining character you need to use window_style: check the documentation https://www.renpy.org/doc/html/dialogue ... er-objects.

Code: Select all

define e = Character('Eileen', color="#c8ffc8", window_style="say_who_windowBrown"):

Vytswell
Newbie
Posts: 14
Joined: Tue Oct 27, 2020 2:23 pm
Contact:

Re: Different Nameboxes for Different Characters [SOLVED]

#7 Post by Vytswell »

_ticlock_ wrote: Sat Nov 14, 2020 11:57 pm Hi, Vytswell,

I think when defining character you need to use window_style: check the documentation https://www.renpy.org/doc/html/dialogue ... er-objects.

Code: Select all

define e = Character('Eileen', color="#c8ffc8", window_style="say_who_windowBrown"):
I'm getting

Code: Select all

Exception: Style 'say_who_windowGray' does not exist.
But I have this style in my options.rpy

Code: Select all

$ style.say_who_windowGray = Style ('say_who_window')
$ style.say_who_windowGray.background = "gui/colored/gray.png"

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: Different Nameboxes for Different Characters [SOLVED]

#8 Post by _ticlock_ »

Vytswell wrote: Sun Nov 15, 2020 4:08 am I'm getting

Code: Select all

Exception: Style 'say_who_windowGray' does not exist.
But I have this style in my options.rpy

Code: Select all

$ style.say_who_windowGray = Style ('say_who_window')
$ style.say_who_windowGray.background = "gui/colored/gray.png"
Just checked and it worked for me:

Code: Select all

init python:
    style.say_who_windowGray = Style ('say_who_window')
    style.say_who_windowGray.background = "#ffff"
    
define e = Character("Eileen", color="#ff0000", what_color = "#ff0000", window_style = "say_who_windowGray")

label start:
    e "Window style test"
Check the spelling, Force Recompile, etc.

Post Reply

Who is online

Users browsing this forum: decocloud, Google [Bot]