Text Box Issues

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
bd4l
Newbie
Posts: 9
Joined: Sat Dec 24, 2016 1:42 am
Contact:

Text Box Issues

#1 Post by bd4l » Tue Jan 03, 2017 10:34 pm

I am having some trouble with the text boxes for my first game. My game is structured with a narrator who provides the general story details in full paragraphs of information. I am using NVL formatting so the text can fill most of the screen if needed for this narration.

The first problem I have run into is that the narrator text does not offset like the character text. Because the character dialogue text has a character name attached to it, the actual text box is offset to the right, the narrator text box does not have a character name attached to it so the text box starts further to the left, which looks very strange when alternating narration and character text is on the same screen. I would like the narrators text box to be offset to line up with the character dialogue text boxes so all of the text lines up with the names of characters for dialogue offset to the left.

The second problem I am running into is getting the text boxes to be the appropriate size. From what I can tell each text box is a generic height (I have not modified any of the base settings other than adopting NVL mode). Because of that generic height, sometimes there is a lot of blank space between lines of text, and other times, there is no space at all. The worst though is when the narrators text get's longer than one or two sentences and it completely disappears off the bottom of the text box. I would like to have the text boxes auto resize based on the amount of text included in the text box with a single blank line of space below the last line of text to clearly separate each block of text.

I've attached a screenshot of what I am seeing. The code below is the code that I used which led to the screenshot.

Code: Select all

define mc = Character('[c_name]', kind=nvl, color="#99FF66")
define narrator = nvl_narrator
define c_name = "Main Character"

init python:
    config.nvl_paged_rollback = True

label start:
    "This is text without a character assigned to it."
    mc "This is text from the main character."
    narrator "This is text from the narrator."
    "This is an extremely long set of text, it may contain several sentences of text and
     can be the length of a paragraph in a typical book. At some point the text contained
     in this box will be more than the box is designed to hold, I need the text boxes to
     automatically adjust in size so that long paragraphs dispaly long text boxes, and short
     paragraphs are shown in small text boxes. I can then use the nvl clear command to
     clear text boxes at the end of each page of text."

Any help is greatly appreciated. Thanks in advance.
Attachments
Text box issues.PNG

User avatar
Qlara
Regular
Posts: 80
Joined: Fri Nov 28, 2014 10:22 am
Completed: Carmilla
Skype: kantonija
itch: visualgothic
Location: Berlin
Contact:

Re: Text Box Issues

#2 Post by Qlara » Tue Jan 03, 2017 11:47 pm

Hello bd4l,
I only just realized that the default definitions for text box and nvl are missing from the options.rpy file when I create a new game with the latest Ren'Py version. I think they used to be located there (and can still be found in the tutorial game folder options.rpy). Depending on which version you use you might just have to find and uncomment them or copy and paste them.
Here's my code pieced together from the old options.rpy and tutorials here in this forum:
(Copy and paste it into options.rpy - or replace- and play around with the values)

Code: Select all

# my default text window #
    style.window.background = Frame("frame.png", 20, 20) #frame.png is my textbox image located in game folder  
## Margin is space surrounding the window, where the background is not drawn.
    style.window.left_margin = 30
    style.window.right_margin = 30
    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 = 30
    style.window.right_padding = 30
    style.window.top_padding = 10
    style.window.bottom_padding = 10
## This is the minimum height of the window, including the margins and padding.
    style.window.yminimum = 200
### My NVL window design#####################################
    style.nvl_window.background = Frame("nvl_window.png", 0, 0) 
    style.nvl_window.top_margin = 70
    style.nvl_window.bottom_margin = 70
    style.nvl_window.left_margin = 90
    style.nvl_window.right_margin = 90
So in options.rpy I have defined my default speaker window and nvl box look.
In the script file, in the character definitions you can change these values for single characters, for example like this for the following speakers:
g is a normal speaker
gt is the same but with side image called "gen_small"
narG is full screen nvl box with added side image
Try playing with these values, especially with "what_xpos" which is the text offset value.

Code: Select all

define  g     = Character ('General', color="#c4dfff", what_color="#c4dfff", show_two_window=True)
define  gt    = Character ('', color="#588CD8", what_color="#9CC9D8", what_italic=True, what_xpos=150, window_right_padding=60, image="gen_small")
define  narG = Character (kind=nvl, what_color="#FFA146", what_italic=False, image="gen_xsmall")

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1883
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Text Box Issues

#3 Post by Ocelot » Wed Jan 04, 2017 2:05 am

default definitions for text box and nvl are missing from the options.rpy file
Because now they are in screens.rpy, using new style statements instead of outdated code style declarations.
< < insert Rick Cook quote here > >

bd4l
Newbie
Posts: 9
Joined: Sat Dec 24, 2016 1:42 am
Contact:

Re: Text Box Issues

#4 Post by bd4l » Fri Jan 06, 2017 2:02 pm

Thanks for the help so far. With that information I was able to get a character developed that lines up the text windows between my 'blank' narrator and my characters speech. That just leaves me with the issue of the text boxes being a designated size. Is there anyway to make the text boxes determine their height based on the amount of text in the box instead of the preset default size?

Thanks again.

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Text Box Issues

#5 Post by Divona » Fri Jan 06, 2017 3:34 pm

bd4l wrote:Is there anyway to make the text boxes determine their height based on the amount of text in the box instead of the preset default size? Thanks again.
In "gui.rpy", set "define gui.nvl_height" to "None":

Code: Select all

## The height of an NVL-mode entry. Set this to None to have the entries
## dynamically adjust height.
define gui.nvl_height = None
Completed:
Image

bd4l
Newbie
Posts: 9
Joined: Sat Dec 24, 2016 1:42 am
Contact:

Re: Text Box Issues

#6 Post by bd4l » Fri Jan 06, 2017 5:26 pm

That did it. Thanks so much!!! :D
Divona wrote:
bd4l wrote:Is there anyway to make the text boxes determine their height based on the amount of text in the box instead of the preset default size? Thanks again.
In "gui.rpy", set "define gui.nvl_height" to "None":

Code: Select all

## The height of an NVL-mode entry. Set this to None to have the entries
## dynamically adjust height.
define gui.nvl_height = None

Post Reply

Who is online

Users browsing this forum: _ticlock_