How/where is the say window textbox positioned? [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
fluxus
Regular
Posts: 133
Joined: Thu Jun 19, 2014 8:06 am
Projects: Animal Anaesthesia (a teaching game)
Contact:

How/where is the say window textbox positioned? [Solved]

#1 Post by fluxus »

Hello,

I have some trouble figuring out how to position the text box for dialogue anywhere else than at the bottom of the screen.

It could probably be done from options.rpy, but since it isn't, I assume it's done through either styles or themes.
And the question is if I need to take other things into account. I might be able to figure that part out by looking at the code and settings nearby.

If someone can point me to where :]

Example:
Let's say I want all dialogue to take place at the top of the screen instead of at the bottom. Where do I define this?
(And, yes, that'd be clunky, but with some almost-a-speech-bubble customization it could be useful)
Last edited by fluxus on Tue Jun 24, 2014 5:06 am, edited 1 time in total.

mjshi
Regular
Posts: 179
Joined: Wed Mar 13, 2013 9:55 pm
Completed: MazeSite01, Ponderings of Time
Contact:

Re: How/where is the say window textbox positioned?

#2 Post by mjshi »

You need to define the xpos (x position) and ypos (y position), in pixels, of your textbox in the Options script file.

Code: Select all

    #########################################
    ## These settings let you customize the window ...blah blah, etc.
    ## add in these style statements:
    style.window.xpos = 400 #this is what the values would be if you wanted the text box to be on the top
    style.window.ypos = 150

User avatar
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: How/where is the say window textbox positioned?

#3 Post by OokamiKasumi »

mjshi wrote:You need to define the xpos (x position) and ypos (y position), in pixels, of your textbox in the Options script file.

Code: Select all

    #########################################
    ## These settings let you customize the window ...blah blah, etc.
    ## add in these style statements:
    style.window.xpos = 400 #this is what the values would be if you wanted the text box to be on the top
    style.window.ypos = 150
Um...
xpos is across or side to side. <->
ypos is up-down. ^v

What this code does is make the box 400px to the right, and 150px up from the bottom.

The only way I've discovered to lift the textbox from the bottom is by adding to the bottom_margin.

Code: Select all

    style.say_window.bottom_margin = 500
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

mjshi
Regular
Posts: 179
Joined: Wed Mar 13, 2013 9:55 pm
Completed: MazeSite01, Ponderings of Time
Contact:

Re: How/where is the say window textbox positioned?

#4 Post by mjshi »

Seriously? I actually tested these and it worked for me ._.

Image

You can actually move them around too...
see, if you had in the code

Code: Select all

    style.window.xpos = 500 
    style.window.ypos = 150
it would move over to the right a few pixels:

Image

User avatar
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: How/where is the say window textbox positioned?

#5 Post by OokamiKasumi »

mjshi wrote:Seriously? I actually tested these and it worked for me ._.

You can actually move them around too...
see, if you had in the code

Code: Select all

    style.window.xpos = 500 
    style.window.ypos = 150
it would move over to the right a few pixels:
Oddly, this does indeed work in an 800x600game. However, when I use it in a 1366x768 game, it only works when there's no dialogue.

No dialogue, using 'window show':
xpos_2.jpg
However when there is dialogue the textbox pops back down to the bottom.
xpos_1.jpg
My textbox code.
-- I removed all the margins just to be sure.

Code: Select all

    ##-------------- Textbox ----------------------
init -2:
    style window:

        ## Frame ------------------------
        background  Frame("ui/textbox.png", 0, 0)
        xpos 683 
        ypos 150        

        ## No Frame --------------------
        # background  "ui/textbox.png"

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

        # left_margin  100
        # right_margin  100
        # top_margin  0
        # bottom_margin  560

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

        left_padding  260
        right_padding  290
        top_padding  25
        bottom_padding  25

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

        # xminimum 500
        # yminimum 235 
my character definition code:

Code: Select all

    define a = Character(None, 
        what_prefix="\"",
        what_suffix="\"",
        show_two_window = True,
        show_side_image=Image("ch/ArchieS.png", xalign=0.10, yalign=0.0),
        ctc="ctc_blink",
        ctc_position="fixed", 
        )
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

mjshi
Regular
Posts: 179
Joined: Wed Mar 13, 2013 9:55 pm
Completed: MazeSite01, Ponderings of Time
Contact:

Re: How/where is the say window textbox positioned?

#6 Post by mjshi »

I must say, that's a very vintage-looking test project xD

Anyway, here's a window sized 400x400, with xpos at 200, ypos at 150:

Image

Here's a window sized 1000x700, with xpos at 500, ypos at 150:
Screenshot_1.png
It still works with a clean, untouched script, maybe it's the other cookbook scripts you've added on forcing it back there? I have no idea.

Also, I've noticed an interesting correlation- if the window is at the top, ypos is 150; and the xpos is whatever the window x value is, divided by two. (see, 400x400, xpos 200. 1000x700, xpos 500. 800x600, xpos 400, etc etc)

User avatar
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: How/where is the say window textbox positioned?

#7 Post by OokamiKasumi »

mjshi wrote:I must say, that's a very vintage-looking test project xD
Thank you!
-- I was playing around with some Public Domain Regency era illustrations.
mjshi wrote:It still works with a clean, untouched script, maybe it's the other cookbook scripts you've added on forcing it back there? I have no idea.
It's possible, I guess?
mjshi wrote:Also, I've noticed an interesting correlation- if the window is at the top, ypos is 150; and the xpos is whatever the window x value is, divided by two. (see, 400x400, xpos 200. 1000x700, xpos 500. 800x600, xpos 400, etc etc)
Yep, I spotted that. It's how I got the box at the top, even if it's only without text. It's possible that the image is being set so far over (x) it pops out the top?

Anyway, I guess I'll just have to stick with using a high bottom margin for this one.
xpos_3.jpg
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

User avatar
fluxus
Regular
Posts: 133
Joined: Thu Jun 19, 2014 8:06 am
Projects: Animal Anaesthesia (a teaching game)
Contact:

Re: How/where is the say window textbox positioned?

#8 Post by fluxus »

Hello!

This is your intrepid asker reporting back.

options.rpy:

Code: Select all

style.window.yalign = 0.0
seems to do the trick, although I still have a so far unexplained discolouring of the background image where the textbox is normally positioned. But that might be an effect of me messing with other things.

Using a custom narrator-character and custom-styling *that* window is probably the safer option to choose, but not being able to manipulate such a central part of the interface bothered me to no end.

I'd probably have found this out sooner if I'd read your answers more carefully; I've mostly been messing with screens.rpy thinking that the textbox is a screen. So it must be configured there, right? No.. :]
Quite nicely explained though. Thank you.

Is there a reason in particular for using ypos instead of yalign? Admittedly I haven't tested rigorously :]

The coordinate numbers might have something to do with the way ren'py wants to match up x/yanchor and x/ypos, but I'm not sure. It's different to how I'm used to thinking of things, but seems to work well for supporting the x/yalign statements.

User avatar
fluxus
Regular
Posts: 133
Joined: Thu Jun 19, 2014 8:06 am
Projects: Animal Anaesthesia (a teaching game)
Contact:

Re: How/where is the say window textbox positioned?

#9 Post by fluxus »

Back with news of the discolouring:
It was seemingly caused by scaling the previous background image to 800x600.
At least, changing to an image which was already scaled fixed the issue.

mjshi
Regular
Posts: 179
Joined: Wed Mar 13, 2013 9:55 pm
Completed: MazeSite01, Ponderings of Time
Contact:

Re: How/where is the say window textbox positioned? [Solved]

#10 Post by mjshi »

No particular reason, but that was the way I learned it xD

I think you can use the two of them interexchangably, yalign would just be fractions while ypos is a definite pixel value (namely, the height of your textbox if you wanted it at the top)

User avatar
fluxus
Regular
Posts: 133
Joined: Thu Jun 19, 2014 8:06 am
Projects: Animal Anaesthesia (a teaching game)
Contact:

Re: How/where is the say window textbox positioned? [Solved]

#11 Post by fluxus »

@mjshi: Ok, I'll continue my fractional ways then.. thanks! :)

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot], piinkpuddiin, snotwurm