Ren'Py How to decrease Dialog box size, or make it transparent in my game?

Sep 3, 2020
84
40
I'm making a personal game with my own renders and have been simply using the example to create a background image and dialog on the screen like:

scene 44
z "Nice to meet you, please take a seat."

But the text box takes up so much of the lower screen, I want to either make it transparent, or vastly reduce it so it doesn't sit over so much of the image.

Anyone able to help please, in a very simplistic step-by-step manner?
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,611
2,258
The main thing you want is the screen say():, stored in screens.rpy.

That's pretty much the box and all it's subparts/components that appears at the bottom of the screen.

The screen: uses various style statements to flesh out the basic design.

The short version is that there is couple of window statements that draw the bits you can see. The first main window known as "textbox" shows any dialogue shown by the game and a second (usually smaller) window called "namebox" shows the character's name (assuming a character is speaking).

If you look at the code, you'll see a line:
Python:
background Image("gui/textbox.png", xalign=0.5, yalign=1.0)

This is the main image used behind the text. It can be the full width of the screen, or one pixel wide (it's automatically repeated horizontally to fill the screen). So if you want to make it more transparent, you need only edit /game/gui/textbox.png with your favorite graphics editor (Photoshop/GIMP). Or create a brand new image with the same name. Or create a brand new image and change the line I've quoted above to point to the new image. You know... whatever...

A similar line and image exist for the namebox. This can be a little more awkward, as you can't always predict what size image you needed (different games use different character names - imagine "Jo" -vs- "Professor Christoffersson"). But it's all configurable. Which brings me to my next point...

If you look at the screen definition, you'll see it's using a lot of predefined variables... like gui.textbox_height or gui.name_ypos. These are usually set in /game/gui.rpy.

So if you make the overall box image smaller, you can adjust gui.textbox_height to let RenPy know that the available space it can show text at the bottom of the screen is smaller.

You can also alter things like gui.dialogue_xpox, gui.dialogue_ypos and gui.dialogue_width to alter where within that window the text will appear (reducing the xpos and increasing the width can still leave the text centered, but wider for example). Just be careful if you ever plan to use side images (character portraits) though not to make the text so wide it overlaps the area those pictures may appear.

Obviously if you make the overall box smaller, you may need to reposition where the namebox appears. It's unlikely you need to adjust it manually though, as the namebox is automatically positioned relative to the overall textbox. But maybe you'd want to tweak it if you've made the font smaller or bigger or something.