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: 191
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: Dizzy Hearts; The Stargazers Remastered
Organization: Forsaken Productions
Tumblr: ForsakenProductions
Deviantart: TheeForsakenOne
Location: Scotland
Contact:

Different Nameboxes for Different Characters [SOLVED]

#1 Post by Thee Forsaken One » Fri Mar 27, 2015 9:02 am

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.
Image

User avatar
PyTom
Ren'Py Creator
Posts: 15447
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 » 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"):
    # ...
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
Thee Forsaken One
Regular
Posts: 191
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: Dizzy Hearts; The Stargazers Remastered
Organization: Forsaken Productions
Tumblr: ForsakenProductions
Deviantart: TheeForsakenOne
Location: Scotland
Contact:

Re: Different Nameboxes for Different Characters

#3 Post by Thee Forsaken One » Fri Mar 27, 2015 11:57 am

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. :)
Image

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 » Tue Oct 06, 2015 7:34 am

[irrelevant]

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Milkymalk