Duplicated text in NVL screen with a viewport.

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
User avatar
Zeroized
Regular
Posts: 33
Joined: Sat Mar 23, 2013 12:33 am
Contact:

Duplicated text in NVL screen with a viewport.

#1 Post by Zeroized »

Greetings.
I added a viewport to the NVL screen and I'm using it to display text. The viewport works, I can show long paragraphs and I can scroll them, however, when I scroll I can see the original text behind the viewport, like I have the normal NVL screen displaying the text and over that screen the viewport. I tried to fix it, but nothing works.
Any ideas about how to fix this? I attached the code I use for the NVL screen.
Thanks in advance.

Code: Select all

screen nvl:
    $ number = 0
    on "show" action Show("quick")
    on "hide" action Hide("quick")

    window:
        style "nvl_window"
        
        has viewport:
            scrollbars "vertical"
            mousewheel "change"

        has vbox:
            style "nvl_vbox"

        # Display dialogue.
        for who, what, who_id, what_id, window_id in dialogue:
            window:
                id window_id

                has hbox:
                    spacing 10

                if who is not None:
                    text who id who_id

                text what id what_id

        # Display a menu, if given.
        if items:

            vbox:
                id "menu"
                
                for caption, action, chosen in items:
                    $ number +=1
                    if caption == "Back":
                        if action:
                            key '0' action action
                            button:
                                action action
                                style "nvl_menu_choice_button"
                                text caption style "nvl_menu_choice"
                        else:
                            text caption style "nvl_menu_caption"
                    else:    
                        if action:
                            if(number <= 9 and number != 0):
                                key str(number) action action
                            button:
                                action action
                                style "nvl_menu_choice_button"
                                text caption style "nvl_menu_choice"
                        else:
                            text caption style "nvl_menu_caption"

    add SideImage() xalign 0.0 yalign 1.0

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Duplicated text in NVL screen with a viewport.

#2 Post by kivik »

Can you show us screenshot to clarify what you mean?

From what I understand, you've got two versions of the NVL screen being displayed, one with the viewport and one without - but since your window has transparency you can see through the viewport version to the one underneath and you can notice it when you scroll the text.

If that's the case the more likely issue is that two NVL screens are being shown, meaning the problem won't be in the screen code but somewhere else.

I'm only guessing based on my understanding of what you said though.

User avatar
Zeroized
Regular
Posts: 33
Joined: Sat Mar 23, 2013 12:33 am
Contact:

Re: Duplicated text in NVL screen with a viewport.

#3 Post by Zeroized »

Here it is, sorry about the delay, I wasn't able to take a screenshot at work.
Attachments
Untitled.png

philat
Eileen-Class Veteran
Posts: 1900
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Duplicated text in NVL screen with a viewport.

#4 Post by philat »

Not sure what's going on, but the python parts ($ number ~ ) probably don't work anyway. Where did you get this? How are you using it? (i.e., not the screen part, the script part)

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Duplicated text in NVL screen with a viewport.

#5 Post by kivik »

Yeah it's a window over a window, you need to check how you show the nvl window to see what's triggered it to show two. I can see the scrollbar in the window beneath, so it's the same screen duplicated.

User avatar
Zeroized
Regular
Posts: 33
Joined: Sat Mar 23, 2013 12:33 am
Contact:

Re: Duplicated text in NVL screen with a viewport.

#6 Post by Zeroized »

I don't think it's related to the nvl window.
I've been doing some tests, the screen duplicates only when a menu with two or more options appears.
If I display a menu with only one option, there are no duplicates on the screen. Maybe the vbox there is making weird stuff happen?
Attachments
twomenu.png
onemenu.png

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Duplicated text in NVL screen with a viewport.

#7 Post by kivik »

How weird, can you show us the code to the nvl dialogues?

May need someone more cleverer than me to figure this out, I can't see where the problem is in the screen code, so unless Renpy does something weird when it loads NVL screens with multiple menu options, but I don't see why it would o.O

User avatar
Zeroized
Regular
Posts: 33
Joined: Sat Mar 23, 2013 12:33 am
Contact:

Re: Duplicated text in NVL screen with a viewport.

#8 Post by Zeroized »

Code: Select all

label background_fix:
    if config.developer == True:
        jump deathgripsexample
        
 label deathgripsexample:
    nvl clear
    menu:
        "Set thing to true to check if the ifs are fucking stuff up":
            $ thing = True
        "Set thing to false":
            $ thing = False
    if thing == True:
        snarrator "BEWAAAAAAAAAAAAAAAARE{nw}"
    snarrator "I close my eyes and seize it, I clench my fists and beat it, I light my torch and burn it, I am the beast I worship.{nw}"
    snarrator "I close my eyes and seize it, I clench my fists and beat it, I light my torch and burn it, I am the beast I worship.{nw}"
    snarrator "And I know soon come my time - For in mine void a pale horse burns - But I fear not the time I'm taken - Past the point of no return{nw}"
    snarrator "Wage war like no tomorrow - Cause no hell, there won't be one - For all who deny the struggle - The triumphant overcome{nw}"
    snarrator "Trips to where few have been\n
               Out of thin air, upon high winds\n
               Rites begin when the sun descends\n
               Have felt what few will ever know\n
               Have seen the truth beneath the glow\n
               Of the ebb and flow\n 
               where the roots of all mysteries grow\n
               I am below, so far below\n
               The bottom line\n
               Transmitting live, transmissions rise\n
               From the depths out of controlled by\n
               Suspended glance of an unblinking eyes\n
               Imminent gaze cast 'pon the path that winds\n
               'Pon the path I find, and claim as mine\n
               To ride the waves\n
               Of unrest\n
               Made to make me shine as a testament\n
               To why the ways of the blind will never get\n
               Shit but shanked by my disrespect\n
               Dismiss this life, worship death\n
               Cold blood night of serpent's breath\n
               Exhaled like spells from the endlessness\n
               In the bottomless wells of emptiness\n
               Channeled to invoke what we represent\n{nw}"
    snarrator "Secret order{nw}"
    snarrator "Elitist horde of{nw}"
    snarrator "Creeping fire{nw}"
    snarrator "Seizing power{nw}"
    snarrator "Riders of the lupus hour{nw}"
    snarrator "Eye on palm{nw}"
    snarrator "Time is gone{nw}"
    snarrator "Moonlight drawn{nw}"
    snarrator "Fly til dawn{nw}"
    snarrator "Sacrifice to rise beyond{nw}"
    snarrator "Deep inside the violent calm{nw}"
    snarrator "Of the coming storm{nw}"
    snarrator "In blood sworn{nw}"
    snarrator "To glorify and for life adorn{nw}"
    snarrator "With all that dies to become unborn{nw}"
    snarrator "I close my eyes and seize it, I clench my fists and beat it, I light my torch and burn it, I am the beast I worship.{nw}"
    snarrator "I close my eyes and seize it, I clench my fists and beat it, I light my torch and burn it, I am the beast I worship.{nw}"
    menu:
        "Back":
            nvl clear
            jump background_done
        #"Confirmation":
        #    nvl clear
        #    jump background_done
I only uncomment the 2nd option on the menu and the text gets duplicated.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Duplicated text in NVL screen with a viewport.

#9 Post by kivik »

I'm afraid I'm really not sure what it could be from that. Out of curiousity, have you used define menu = nvl_menu?

Can you also show us the code after the menu jumps? I can't tell from your description whether the the overlapping happens immediately or after the menu choice happens.

If, by some strange reason, it's because nvl_mode and viewport don't mix well, then it's a bug that you need to report. But maybe someone more experienced can figure out what's really going on.

All I can tell from the screenshot is that you've got two screens (both with viewports) on top of each other. I don't have the actual text as reference to see whether the screen underneath is identical to the one above - so I can't eliminate that possibly either. Perhaps you should start a new project, just copy over a bare minimum of the code you used to create the viewport screens, and try and recreate the problem - then share the entire code with us, then we can get hands on to have a look?

User avatar
Zeroized
Regular
Posts: 33
Joined: Sat Mar 23, 2013 12:33 am
Contact:

Re: Duplicated text in NVL screen with a viewport.

#10 Post by Zeroized »

All right, I'll do so.

User avatar
Zeroized
Regular
Posts: 33
Joined: Sat Mar 23, 2013 12:33 am
Contact:

Re: Duplicated text in NVL screen with a viewport.

#11 Post by Zeroized »

I apologize for the doubleposting.
I can't replicate the bug on a new project, but as a solution I created a new screen called "nvl_choice" to display the menu.
The problem is that the new menu is displayed as an ADV style menu, the whole text on the screen disappears and the menu gets displayed in the middle.
How can I display it as a NVL style menu? As in, displaying the choices under the screen text.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Duplicated text in NVL screen with a viewport.

#12 Post by kivik »

Can you not recreate it with your original game's code? How did you do it in your original game code?

User avatar
Zeroized
Regular
Posts: 33
Joined: Sat Mar 23, 2013 12:33 am
Contact:

Re: Duplicated text in NVL screen with a viewport.

#13 Post by Zeroized »

I copied the screen code to a new created project, and it works without issues. The problem lies on the main game.
In fact, using the displayable inspector I can see that everything works properly until a menu with more than one option gets displayed. Then, a whole new NVL screen appears, showing the same text and the menu options.
Now, after digging on the documentation, I created a new menu screen called "nvl_choice", but now, when I display a menu, the NVL screen that should be displaying the text disappears.
I want to check if the text gets duplicated if I use the "nvl_choice" screen and if it does, I'll just use ADV menus and call it a day.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]