How to move text up/down (on a y-axis) with NVL format? [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
HikariJake
Newbie
Posts: 6
Joined: Thu Mar 01, 2018 9:29 pm
Contact:

How to move text up/down (on a y-axis) with NVL format? [SOLVED]

#1 Post by HikariJake »

The answer to this is probably really obvious but I'm very new to Ren'Py and suck at coding so here I am (I actually made an account just for this question lol... Nice to meet you guys :lol: )
All I want to do is move the first line of NVL text mode down just a smidge. I think having the text start at the very top of the screen doesn't look all that professional.

Image

Plus, eventually I'm going to make my own text box, and the box is going to be practically centered on the screen so I need to move / reposition the text.
Thank you for any support :D

EDIT: I guess I should add some of the code I have, huh?

Script.rpy:

Code: Select all

# The script of the game goes in this file.

init python:
    config.font_replacement_map["SystemBold.ttf", False, True] = ("SystemBold.ttf", False, False)
    config.nvl_page_ctc = ("ctc_blink2")

image bglake = "lake.jpg"
image bgschool = "school.jpg"
image ctc_blink:
    "images/ctc_01.png"
    linear 0.5 alpha 1.0
    "images/ctc_03.png"
    linear 0.5 alpha 1.0
    repeat
image ctc_blink2:
    "images/ctc_02.png"
    linear 0.5 alpha 1.0
    "images/ctc_03.png"
    linear 0.5 alpha 1.0
    repeat

init:
    $ narrator = Character(None,
                            kind=nvl,
                            ctc="ctc_blink",
                            ctc_position="nestled")

define quote = Character(None,
                        kind=nvl,
                        ctc="ctc_blink",
                        ctc_position="nestled",
                        what_prefix="“",
                        what_suffix="”")

label start:

label Meeting:
    stop music
    play music "audio/BGMmp3" fadein 1.0

    "Oh no...!"
    "Now the line spacing is all messed up!"
    "What to do..."
    "Well, at least now the text doesn't start from the very top of the screen, eheheh..."
    nvl clear
NVL GUI.rpy:

Code: Select all

## NVL-Mode ####################################################################
##
## The NVL-mode screen displays the dialogue spoken by NVL-mode characters.

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

## The maximum number of NVL-mode entries Ren'Py will display. When more entries
## than this are to be show, the oldest entry will be removed.
define gui.nvl_list_length = 12

## 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 #If this is bigger than gui.nvl_text_ypos, it makes a difference. If smaller, it makes no difference.

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

## The position, width, and alignment of the dialogue text.
define gui.nvl_text_xpos = 360
define gui.nvl_text_ypos = 10 #Line spacing
define gui.nvl_text_width = 1200
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 = 360
define gui.nvl_thought_ypos = 10
define gui.nvl_thought_width = 1200
define gui.nvl_thought_xalign = 0.0

## The position of nvl menu_buttons.
define gui.nvl_button_xpos = 675
define gui.nvl_button_xalign = 0.0
NVL Screens.rpy: (I've never touched this, it makes no sense to me :P But maybe the answer could lie in here?)

Code: Select all

## NVL screen ##################################################################
##
## This screen is used for NVL-mode dialogue and menus.
##
## https://www.renpy.org/doc/html/screen_special.html#nvl


screen nvl(dialogue, items=None):

    window:
        style "nvl_window"

        has vbox:
            spacing gui.nvl_spacing

        ## Displays dialogue in either a vpgrid or the vbox.
        if gui.nvl_height:

            vpgrid:
                cols 1
                yinitial 1.0

                use nvl_dialogue(dialogue)

        else:

            use nvl_dialogue(dialogue)

        ## Displays the menu, if given. The menu may be displayed incorrectly if
        ## config.narrator_menu is set to True, as it is above.
        for i in items:

            textbutton i.caption:
                action i.action
                style "nvl_button"

    add SideImage() xalign 0.0 yalign 1.0


screen nvl_dialogue(dialogue):

    for d in dialogue:

        window:
            id d.window_id

            fixed:
                yfit gui.nvl_height is None

                if d.who is not None:

                    text d.who:
                        id d.who_id

                text d.what:
                    id d.what_id


## This controls the maximum number of NVL-mode entries that can be displayed at
## once.
define config.nvl_list_length = gui.nvl_list_length

style nvl_window is default
style nvl_entry is default

style nvl_label is say_label
style nvl_dialogue is say_dialogue

style nvl_button is button
style nvl_button_text is button_text

style nvl_window:
    xfill True
    yfill True

    background "gui/nvl.png"
    padding gui.nvl_borders.padding

style nvl_entry:
    xfill True
    ysize gui.nvl_height

style nvl_label:
    xpos gui.nvl_name_xpos
    xanchor gui.nvl_name_xalign
    ypos gui.nvl_name_ypos
    yanchor 0.0
    xsize gui.nvl_name_width
    min_width gui.nvl_name_width
    text_align gui.nvl_name_xalign

style nvl_dialogue:
    xpos gui.nvl_text_xpos
    xanchor gui.nvl_text_xalign
    ypos gui.nvl_text_ypos
    xsize gui.nvl_text_width
    min_width gui.nvl_text_width
    text_align gui.nvl_text_xalign
    layout ("subtitle" if gui.nvl_text_xalign else "tex")

style nvl_thought:
    xpos gui.nvl_thought_xpos
    xanchor gui.nvl_thought_xalign
    ypos gui.nvl_thought_ypos
    xsize gui.nvl_thought_width
    min_width gui.nvl_thought_width
    text_align gui.nvl_thought_xalign
    layout ("subtitle" if gui.nvl_text_xalign else "tex")

style nvl_button:
    properties gui.button_properties("nvl_button")
    xpos gui.nvl_button_xpos
    xanchor gui.nvl_button_xalign

style nvl_button_text:
    properties gui.button_text_properties("nvl_button")
Bonus question (completely unrelated to the former):
Is is possible to make the Dialogue History show by scrolling up with the scroll wheel (middle button on mouse) like in most visual novels?
Last edited by HikariJake on Sat Mar 03, 2018 11:51 pm, edited 4 times in total.

HikariJake
Newbie
Posts: 6
Joined: Thu Mar 01, 2018 9:29 pm
Contact:

Re: How to move text up/down (on a y-axis) with NVL format?

#2 Post by HikariJake »

So I found out how to move the text down... except it ended up widening the space between ALL of the lines :cry:
What I did was went into gui.rpy and changed the "text_ypos" from 10 to 60...
## The position, width, and alignment of the dialogue text.
define gui.nvl_text_xpos = 360
define gui.nvl_text_ypos = 60
define gui.nvl_text_width = 1200
define gui.nvl_text_xalign = 0.0
But now the lines are like this:
Image

I'd like the line spacing to be somewhat like Saya no Uta, if possible...
Image

If only this tutorial used the new GUI :cry: The other new GUI tutorials don't seem to work for my purposes...
I might just switch to Legacy interface... I dunno, there's way more comprehensive tutorials for Legacy than for New GUI.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: How to move text up/down (on a y-axis) with NVL format?

#3 Post by Milkymalk »

You can keep distance from the top by using padding:

Code: Select all

screen nvl(dialogue, items=None):

    window:
        style "nvl_window"

        has vbox:
            spacing gui.nvl_spacing
            top_padding 20 # keeps a distance of 20 pixels to the top border
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

HikariJake
Newbie
Posts: 6
Joined: Thu Mar 01, 2018 9:29 pm
Contact:

Re: How to move text up/down (on a y-axis) with NVL format?

#4 Post by HikariJake »

Milkymalk wrote: Sat Mar 03, 2018 12:24 am You can keep distance from the top by using padding:

Code: Select all

screen nvl(dialogue, items=None):

    window:
        style "nvl_window"

        has vbox:
            spacing gui.nvl_spacing
            top_padding 20 # keeps a distance of 20 pixels to the top border
First of all, thanks a ton for the help!

However, I ended up getting this error:

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/screens.rpy", line 1299: u'top_padding' is not a keyword argument or valid child for the vbox statement.
    top_padding 20 
               ^

Ren'Py Version: Ren'Py 6.99.14.2.3244
Sat Mar 03 16:46:59 2018

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: How to move text up/down (on a y-axis) with NVL format?

#5 Post by Milkymalk »

Ah, this means that you can't use top_padding as a keyword for a vbox. Try putting it as a keyword for the window, directly under the style keyword.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

HikariJake
Newbie
Posts: 6
Joined: Thu Mar 01, 2018 9:29 pm
Contact:

Re: How to move text up/down (on a y-axis) with NVL format?

#6 Post by HikariJake »

Woohoo! Looks like that did the trick.
Might even move the text down a bit more, actually :lol: Thank you!

Image

Post Reply

Who is online

Users browsing this forum: Google [Bot]