[Tutorial] Customizing the NVL Textbox

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Message
Author
Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: [Tutorial] Customizing the NVL Textbox

#31 Post by Ryue »

As the new gui has one bug finally eliminated (multiline nvl texts now no longer crush the layout!), I need to use the new gui^^.

Important things in the new gui:

Screens.rpy:

Code: Select all

define config.nvl_list_length = 6 # How many nvl lines will be displayed max.
Gui.rpy:

Code: Select all

# The borders of the background of the NVL-mode background window.
define gui.nvl_borders = Borders(0, 10, 0, 20)

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

## The spacing between NVL-mode entries when gui.nvl_height is None, and between
## NVL-mode entries and an NVL-mode menu.
define gui.nvl_spacing = 10

## The position, width, and alignment of the label giving the name of the
## speaking character.
define gui.nvl_name_xpos = 430
define gui.nvl_name_ypos = 0
define gui.nvl_name_width = 150
define gui.nvl_name_xalign = 1.0

## The position, width, and alignment of the dialogue text.
define gui.nvl_text_xpos = 450
define gui.nvl_text_ypos = 8
define gui.nvl_text_width = 590
define gui.nvl_text_xalign = 0.0

## The position, width, and alignment of nvl_thought text (the text said by the
## nvl_narrator character.)
define gui.nvl_thought_xpos = 240
define gui.nvl_thought_ypos = 0
define gui.nvl_thought_width = 780
define gui.nvl_thought_xalign = 0.0

## The position of nvl menu_buttons.
define gui.nvl_button_xpos = 450
define gui.nvl_button_xalign = 0.0
define gui.nvl_height = None is something of a must if you want to use says with different number of lines (as else all lines will have a height displayed as the one with the maximum number of lines has).

With nvl_height = 115 it would look like this:
Image
With nvl_height = None it would look like this:
Image


I'm lazy myself but I HATE to use code I don't understand so even for tutorials like yours I usually do one and only one thing first: I try to understand them (aka what is done how and why) and then I do it myself^^'
(Maybe programmers pride, maybe old school, no clue why in essence I do it that way but that is me^^')
Last edited by Ryue on Tue Nov 22, 2016 4:18 pm, edited 1 time in total.

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: [Tutorial] Customizing the NVL Textbox

#32 Post by OokamiKasumi »

Ryue wrote:As the new gui has one bug finally eliminated (multiline nvl texts now no longer crush the layout!), I need to use the new gui^^.
AWESOME! And very useful.
-- I've added the links to both your entries to the first page for those using the New GUI style.

Can you add a Screenshot to your entry(s) to show the readers what the results look like?
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

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: [Tutorial] Customizing the NVL Textbox

#33 Post by Ryue »

OokamiKasumi wrote:
Ryue wrote:As the new gui has one bug finally eliminated (multiline nvl texts now no longer crush the layout!), I need to use the new gui^^.
AWESOME! And very useful.
-- I've added the links to both your entries to the first page for those using the New GUI style.

Can you add a Screenshot to your entry(s) to show the readers what the results look like?
You mean the =None? can do that.

For the other entries: they are the default entries in the appropriate files.

I edited the post I made and added the screenshots.

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: [Tutorial] Customizing the NVL Textbox

#34 Post by OokamiKasumi »

Ryue wrote:
OokamiKasumi wrote:Can you add a Screenshot to your entry(s) to show the readers what the results look like?
You mean the =None? can do that.
Thanks!
Ryue wrote:For the other entries: they are the default entries in the appropriate files.
Got'cha.
Ryue wrote:I edited the post I made and added the screenshots.
It looks great, thank you!
Ryue wrote:I'm lazy myself but I HATE to use code I don't understand so even for tutorials like yours I usually do one and only one thing first: I try to understand them (aka what is done how and why) and then I do it myself^^'
(Maybe programmers pride, maybe old school, no clue why in essence I do it that way but that is me^^')
I'm the same way, I also don't like using code I don't understand. (That's just begging for errors I have no clue how to fix.) What I do is make sample games to work out how blocks of code work. Once I figure out how to get them to run properly, I just copy-paste the code from the samples into the games I'm actually trying to make. As they say: "Practice makes...better."
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

Georgel
Newbie
Posts: 23
Joined: Tue Mar 22, 2016 8:03 am
Organization: Seventh Heart Sudios
Location: Romania, Bucharest
Contact:

Re: [Tutorial] Customizing the NVL Textbox

#35 Post by Georgel »

Is it possible to change the default behavior of window where the window hides during animations if nvl was used in the game?

IndieAuthor
Newbie
Posts: 1
Joined: Mon Apr 03, 2017 9:19 pm
Contact:

Re: [Tutorial] Customizing the NVL Textbox

#36 Post by IndieAuthor »

I know. I'm late ... but what about WIDTH .... I'd like to have my NVL box cover only about 50% of the screen

willanik
Regular
Posts: 35
Joined: Fri Mar 24, 2017 7:44 pm
Contact:

Re: [Tutorial] Customizing the NVL Textbox

#37 Post by willanik »

IndieAuthor wrote:I know. I'm late ... but what about WIDTH .... I'd like to have my NVL box cover only about 50% of the screen
Hey IndieAuthor, a late reply to your question. In a different program I make a custom nvl background box (e.g. a coloured rectangle as a png file). When I make it I set its dimensions to the height and width that I want. So if I am working with 1920 by 1280 in Ren’py and want the nvl box to cover half the screen, I set its width to be 960.

Now, a question of my own. I can vary the position of the NVL text, using the guide from earlier in this thread. But I also want to vary the position of the nvl background box. The default for my nvl background is the upper left corner of the page; how can I move it down and to the right a little so that it does not site hard against the corner of the page?

Thanks,
W

User avatar
noeinan
Eileen-Class Veteran
Posts: 1153
Joined: Sun Apr 04, 2010 10:10 pm
Projects: Ren'Py QuickStart, Crimson Rue
Organization: Statistically Unlikely Games
Deviantart: noeinan
Github: noeinan
Location: Washington State, USA
Contact:

Re: [Tutorial] Customizing the NVL Textbox

#38 Post by noeinan »

Thanks so much for this guide! It's been really helpful as I'm using nvl mode for the first time in a game I'm working on.

Regarding the new code, I've run into a bit of an issue and was wondering if anyone had some insight?
Ryue wrote: Tue Nov 22, 2016 4:00 pm
Gui.rpy:

Code: Select all

## The position, width, and alignment of nvl_thought text (the text said by the
## nvl_narrator character.)
define gui.nvl_thought_xpos = 240
define gui.nvl_thought_ypos = 0
define gui.nvl_thought_width = 780
define gui.nvl_thought_xalign = 0.0

Here, I'm wanting my nvl text to start a bit lower on the screen so I changed gui.nvl_thought_ypos to 150. However, when I do that, it is also adding 150px spacing between lines! Even though I've set gui.nvl_spacing to only 10. It seems to me that it should be spacing normally, but just starting the text 150px lower? Here's the exact code, any help is much appreciated!

Code: Select all

init python:

## ---- No Frame (non-adjustable) Nvl Box------
    style.nvl_window.background = "gui/nvl.png"

define config.nvl_list_length = 6 # How many nvl lines will be displayed max.

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

## The spacing between NVL-mode entries when gui.nvl_height is None, and between
## NVL-mode entries and an NVL-mode menu.
define gui.nvl_spacing = 10

## The position, width, and alignment of the label giving the name of the
## speaking character.
define gui.nvl_name_xpos = 1140
define gui.nvl_name_ypos = 0
define gui.nvl_name_width = 150
define gui.nvl_name_xalign = 1.0

## The position, width, and alignment of the dialogue text.
define gui.nvl_text_xpos = 1160
define gui.nvl_text_ypos = 8
define gui.nvl_text_width = 650
define gui.nvl_text_xalign = 0.0

## The position, width, and alignment of nvl_thought text (the text said by the
## nvl_narrator character.)
define gui.nvl_thought_xpos = 940
define gui.nvl_thought_ypos = 0
define gui.nvl_thought_width = 950
define gui.nvl_thought_xalign = 0.0

## The position of nvl menu_buttons.
define gui.nvl_button_xpos = 450
define gui.nvl_button_xalign = 0.0
Image

Image
Image

User avatar
noeinan
Eileen-Class Veteran
Posts: 1153
Joined: Sun Apr 04, 2010 10:10 pm
Projects: Ren'Py QuickStart, Crimson Rue
Organization: Statistically Unlikely Games
Deviantart: noeinan
Github: noeinan
Location: Washington State, USA
Contact:

Re: [Tutorial] Customizing the NVL Textbox

#39 Post by noeinan »

Got an answer to this in another thread, so I'm posting here in case anyone else runs into this problem!
MaydohMaydoh wrote: Mon Apr 27, 2020 12:31 pm

Code: Select all

gui.nvl_borders = Borders(0, 10, 0, 20)
is what's used to change the nvl window padding. Changing the second value in Borders with adjust the height at which the dialogue will start appearing.
Else you can use style.nvl_window.top_padding
Image

Image
Image

Post Reply

Who is online

Users browsing this forum: No registered users