NVL mode padding issue

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
CyDementia
Regular
Posts: 28
Joined: Wed Mar 14, 2018 5:54 pm
Contact:

NVL mode padding issue

#1 Post by CyDementia »

Hello guys. Problem can be seen on the screenshot. What I want to do is two different pads. First pad is from the top edge of the screen to the first text block (10% for example) and second are pads between remaining blocks of text (all 6% for example). I managed to solve this problem partially by using pixels instead of percents: in this case all pads are equal but the key word is "all" including the first one. Can't understand what from the percent is calculated and resulting in such a strange way. I hope to find a solution exactly with using percents and not pixels. Thank you in advance.
Image
Last edited by CyDementia on Fri Mar 16, 2018 11:26 pm, edited 2 times in total.

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: NVL mode padding issue

#2 Post by Milkymalk »

You have to understand what padding means:
- padding: the distance between an object's border and the objects inside it
- spacing: the distance between objects inside the object

Maybe post the code? There seems to be a whole lot strange with it.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

CyDementia
Regular
Posts: 28
Joined: Wed Mar 14, 2018 5:54 pm
Contact:

Re: NVL mode padding issue

#3 Post by CyDementia »

Milkymalk wrote: Fri Mar 16, 2018 12:03 am You have to understand what padding means:
- padding: the distance between an object's border and the objects inside it
- spacing: the distance between objects inside the object

Maybe post the code? There seems to be a whole lot strange with it.
Here is the code (I didn't add anything, only changed existing):

Code: Select all


############### GUI.rpy ###############

define gui.nvl_borders = Borders(0, 0, 0, 0)  ## (0, 10, 0, 20) 

define gui.nvl_list_length = 9

define gui.nvl_height = None

define gui.nvl_spacing = 0       

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 

define gui.nvl_text_xpos = 275   
define gui.nvl_text_ypos = 0   
define gui.nvl_text_width = 550  
define gui.nvl_text_xalign = 0.0 

define gui.nvl_thought_xpos = 0.1
define gui.nvl_thought_ypos = 0.1
define gui.nvl_thought_width = 0.65
define gui.nvl_thought_xalign = 0.0

define gui.nvl_button_xpos = 450
define gui.nvl_button_xalign = 0.0

############### SCREENS.rpy ###############

screen nvl(dialogue, items=None):
    
    window:
        style "nvl_window"
        

        has vbox:
            spacing gui.nvl_spacing

        if gui.nvl_height:

            vpgrid:
                cols 1
                yinitial 1.0

                use nvl_dialogue(dialogue)

        else:

            use nvl_dialogue(dialogue)

        for i in items:

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

    add SideImage() xalign 0.0 yalign 1.0

    use quick_menu
    
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
                    
                    
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")

On screenshot I'm using nvl_thought section.

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: NVL mode padding issue

#4 Post by Milkymalk »

I'm kind of in a hurry now, so just an idea:

gui.nvl_thought_ypos 0.1 positions each entry 0.1 from its base position, the base position being where it's supposed to be. But that doesn't shift the position of the following entries downwards, so they appear to be further up than they should.

You should actually use the spacing style attribute for the individial entries insteasd of ypos.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

CyDementia
Regular
Posts: 28
Joined: Wed Mar 14, 2018 5:54 pm
Contact:

Re: NVL mode padding issue

#5 Post by CyDementia »

Milkymalk wrote: Fri Mar 16, 2018 12:20 pm I'm kind of in a hurry now, so just an idea:

gui.nvl_thought_ypos 0.1 positions each entry 0.1 from its base position, the base position being where it's supposed to be. But that doesn't shift the position of the following entries downwards, so they appear to be further up than they should.

You should actually use the spacing style attribute for the individial entries insteasd of ypos.
I had the same thought but the problem is that I don't know how to do it properly. I would appreciate the code but thank you anyway.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: NVL mode padding issue

#6 Post by Imperf3kt »

In gui.rpy file, you want to edit the history height to adjust spacing of text. Use None for automatic spacing based on size, and a number for a set gap for every text.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

CyDementia
Regular
Posts: 28
Joined: Wed Mar 14, 2018 5:54 pm
Contact:

Re: NVL mode padding issue

#7 Post by CyDementia »

Imperf3kt wrote: Fri Mar 16, 2018 5:50 pm In gui.rpy file, you want to edit the history height to adjust spacing of text. Use None for automatic spacing based on size, and a number for a set gap for every text.
Question isn't about history, it's about NVL mode. But I tried it anyway and just broke my history spacing with "None" parameter.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: NVL mode padding issue

#8 Post by Imperf3kt »

Why did I write history...
Same deal applies, but replace the word history, with "NVL"
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

CyDementia
Regular
Posts: 28
Joined: Wed Mar 14, 2018 5:54 pm
Contact:

Re: NVL mode padding issue

#9 Post by CyDementia »

Imperf3kt wrote: Fri Mar 16, 2018 10:09 pm Why did I write history...
Same deal applies, but replace the word history, with "NVL"
I've added

Code: Select all

define gui.nvl_thought_height = 0.2
to my /gui.rpy but it didn't change anything. Tried with pixels too.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: NVL mode padding issue

#10 Post by Imperf3kt »

I meant this in gui.rpy around line 366

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 = 173

## 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 = 15
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

CyDementia
Regular
Posts: 28
Joined: Wed Mar 14, 2018 5:54 pm
Contact:

Re: NVL mode padding issue

#11 Post by CyDementia »

Imperf3kt wrote: Sat Mar 17, 2018 11:23 pm I meant this in gui.rpy around line 366

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 = 173

## 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 = 15
I remember now that it was the first thing I tried to do back then and it didn't work. I tried to change following parameters in all possible ways and it either become totally misplaced or resulting in what is on the screenshot.

Code: Select all

define gui.nvl_spacing = 0

define gui.nvl_height = None

define gui.nvl_thought_ypos = 0.1 
With code above I have a result which is shown on the screenshot (increasing nvl_spacing value just increases that unequal spaces).
If I don't set gui.nvl_height to None, blocks of text have different spacing between them by default (since blocks aren't always 1 or 2 or 3 strings). So this one always None for me.
There is something with gui.nvl_thought_ypos (if set to pixels and not percent everything is ok but as I said before I need first space from the top edge of the screen to be different). Or maybe something connected with nvl_thought (which is not just nvl).

User avatar
Treladonia
Newbie
Posts: 5
Joined: Sat Oct 12, 2019 4:17 pm
Organization: Kuehler Corrada Productions
Deviantart: Journie
itch: treladon
Contact:

Re: NVL mode padding issue

#12 Post by Treladonia »

I know this post is super old, but I was having a similar problem, and I think I found the solution.

Yes, you want gui.nvl_height to stay at "None" for the automatic height adjustment. Yes, defining gui.nvl_thought_ypos at a lower value than the default will close that huge space between entries.

But if you want the nvl entries to start further from the top than that gui.nvl_thought_ypos value can give you, then what you want to change is this piece of code at line 363 of the gui.rpy file:

Code: Select all

gui.nvl_borders = Borders(0, 10, 0, 20)
Specifically, increase the second value from 10 to, say, 40:

Code: Select all

gui.nvl_borders = Borders(0, 40, 0, 20)
This will push your first entry down a bit.
The Tasks of Messengers & Guardians: Chapter 1

"We are the times. Such as we are, such are the times."

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]