Page 1 of 1

Problems about properties

Posted: Mon Dec 20, 2010 6:38 am
by Majirefy
Hi, anybody! Sorry my English is so...funny... Really bad at English!
I know there is a method to enable to display your text box with a box telling who says it by defining the character like this:

Code: Select all

define s = Character('上官零', font="Font//kaiu.ttf", what_font="Font//FZBaoSong.TTF", size=24, bold=False, color="#999999", what_color="#999999", show_two_window=True, ctc="System/ParaEnd.png")
Here, there is a bool variable called show_two_window is true, and then I want to custom the "name box". So in options.rpy, I set this:

Code: Select all

style.say_who_window.background = "GUI//Name2.png"
And it works well!

But I referred to the wiki, and failed to find the property called "say_who_window".
So my problem is: How can I get to know these properties? I still cannot find these properties in this link:
http://renpy.org/wiki/renpy/doc/referen ... and_Styles

Now thank you for your help.

Re: Problems about properties

Posted: Mon Dec 20, 2010 3:56 pm
by Aleema
Hover your mouse over the object you want to change. Hit the buttons SHIFT + I (just a capital "I") and you'll get the "style inspector". The last style listed is usually what you want.

Re: Problems about properties

Posted: Tue Dec 21, 2010 12:18 am
by Majirefy
Sorry to say... But I still do not know how to use these properties.
As I have defined in my scripts.rpy a character, and I wanna change the style of text box of the character, so my defination is like this:

Code: Select all

define s = Character('上官零', font="Font//kaiu.ttf", what_font="Font//FZBaoSong.TTF", size=24, bold=False, color="#999999", what_color="#999999", show_two_window=True, ctc=anim.Blink("System//ParaEnd.png"), say_window="GUI//Message1.png")
A bit long, but the problem is, when I launch my project, error comes:
Exception: Style property say_window is unknown.
So I guess there must be something I do not know... How to solve it? Or how can I use the property?
Can I write it like this(Surely, this is wrong, but I don't know why):

Code: Select all

define s = Character('上官零', font="Font//kaiu.ttf", what_font="Font//FZBaoSong.TTF", size=24, bold=False, color="#999999", what_color="#999999", show_two_window=True, ctc=anim.Blink("System//ParaEnd.png"), say_window.background="GUI//Message1.png")
This is wrong by telling me this:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 1: ordinal not in range(128)

Re: Problems about properties

Posted: Tue Dec 21, 2010 12:50 pm
by Alex
Exception: Style property say_window is unknown.
Use "window_background" instead.
http://www.renpy.org/wiki/renpy/FAQ#How ... _screen.3F

And note about error messages - Ren'py tells you not only what kind of error you've made, but also the number of line where this error found. So, look closely to that line, and next time it is better to post full error message and part of your code that included line with error and couple of lines before it and after.

Re: Problems about properties

Posted: Tue Dec 21, 2010 3:03 pm
by Majirefy
Very helpful, indeed!
But I'm afraid I still have problems getting to know which is which property...
So can give me more detailed method to find out each property?

Re: Problems about properties

Posted: Tue Dec 21, 2010 3:15 pm
by Aleema
You're not making your character unicode compatible -- recognizing your language's characters. You have to place a "u" before your names. Like this:

Code: Select all

define s = Character(u'上官零')
That should keep the second error from happening.
For the first error, changing styles for characters only is a little more difficult because you have to put "say_" or "what_" or "who_" before your property, when outside of Character definements, you don't. To change the background of a specific character, you have to say:

Code: Select all

define s = Character(u'上官零', window_background=Frame("GUI//Message1.png", 15, 15))
Or just "window_background="GUI//Message1.png"" like you had before.
There isn't a better way to finding styles than using the Style Inspector and reading the wiki on properties, sorry ... I guess the best way is to just ask someone here.
If you want to just change the game's text box for ALL characters, not just for 上官零, then you should be altering these lines of code already in your options.rpy file:

Code: Select all

## These settings let you customize the window containing the
    ## dialogue and narration, by replacing it with an image.

    ## The background of the window. In a Frame, the two numbers
    ## are the size of the left/right and top/bottom borders,
    ## respectively.

    # style.window.background = Frame("frame.png", 12, 12)

    ## Margin is space surrounding the window, where the background
    ## is not drawn.

    # style.window.left_margin = 6
    # style.window.right_margin = 6
    # style.window.top_margin = 6
    # style.window.bottom_margin = 6

    ## Padding is space inside the window, where the background is
    ## drawn.

    # style.window.left_padding = 6
    # style.window.right_padding = 6
    # style.window.top_padding = 6
    # style.window.bottom_padding = 6

    ## This is the minimum height of the window, including the margins
    ## and padding.

    # style.window.yminimum = 250
You'll have to uncomment them to use them. That means remove the # mark.
Margin is how far the screen is away from the text box. Padding is how far the text in the text box is away from the edge of the box.