[SOLVED] ADV-Dialogue on top of NVL?

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
felsenstern
Regular
Posts: 72
Joined: Tue Jul 11, 2017 2:13 am
Contact:

[SOLVED] ADV-Dialogue on top of NVL?

#1 Post by felsenstern »

Hi,

can someone tell me (if possible) how I can keep my NVL-Dialogue visible while showing some ADV-Dialogue? Usually when I use a ADV-Dialogue, the NVL-Window closes until I use another NVL-Dialogue.
Last edited by felsenstern on Mon Jul 05, 2021 3:13 am, edited 3 times in total.
---
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it

User avatar
midgethetree
Regular
Posts: 39
Joined: Wed Dec 30, 2020 3:51 pm
Completed: Back When, The Mother of Pearls, various jam games
Projects: When Everyone's Watching, Deliberation
Github: midgethetree
itch: midge-the-tree
Discord: rainafc#3353
Contact:

Re: ADV-Dialogue on top of NVL?

#2 Post by midgethetree »

Here's the code I used to achieve that in The Mother of Pearls:

Code: Select all

init python:

    def nontransient_nvl(mode, old_modes):

        if mode == 'say' or mode == 'menu':
            widget_properties, dialogue, show_args = _m1_00nvl_mode__nvl_screen_dialogue()
            if dialogue:
                renpy.show_screen('nvl', _layer=config.nvl_layer, _widget_properties=widget_properties, dialogue=dialogue, **show_args)

        elif mode == 'nvl':
            nvl_hide(None)

    config.mode_callbacks.append(nontransient_nvl)
The NVL/say screens are usually shown as transient screens, meaning they're taken away once the interaction is complete if the next interaction doesn't also call for them to be there. This code just shows the NVL screen without being transient whenever the mode switches from NVL to say (ADV)/menu (choices), unless there are no NVL entries (so, if you use nvl clear and then have an ADV character speak, the NVL screen will go away). If you want an empty NVL screen to show in those situations, just remove the "if dialogue" check.

felsenstern
Regular
Posts: 72
Joined: Tue Jul 11, 2017 2:13 am
Contact:

Re: ADV-Dialogue on top of NVL?

#3 Post by felsenstern »

Wow, thanks a lot and I will check out your game ;-)
---
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it

felsenstern
Regular
Posts: 72
Joined: Tue Jul 11, 2017 2:13 am
Contact:

Re: ADV-Dialogue on top of NVL?

#4 Post by felsenstern »

Ok, that was too fast... when I use your code and I come to my first say (after using nvl) I get an error message. Since I have no deeper knowledge of Renpy, I have no idea how to solve that:

Code: Select all

```
I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 28, in script
    e "You've created a new Ren'Py game."
  File "game/screens.rpy", line 1295, in execute
    screen nvl(dialogue, items=None):
  File "game/screens.rpy", line 1295, in execute
    screen nvl(dialogue, items=None):
  File "game/screens.rpy", line 1297, in execute
    window:
  File "game/screens.rpy", line 1300, in execute
    has vbox:
TypeError: 'NoneType' object is not iterable

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 28, in script
    e "You've created a new Ren'Py game."
  File "renpy/ast.py", line 715, in execute
    renpy.exports.say(who, what, *args, **kwargs)
  File "renpy/exports.py", line 1417, in say
    who(what, *args, **kwargs)
  File "renpy/character.py", line 1219, in __call__
    self.do_display(who, what, cb_args=self.cb_args, dtt=dtt, **display_args)
  File "renpy/character.py", line 871, in do_display
    **display_args)
  File "renpy/character.py", line 621, in display_say
    rv = renpy.ui.interact(mouse='say', type=type, roll_forward=roll_forward)
  File "renpy/ui.py", line 298, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "renpy/display/core.py", line 3276, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, **kwargs)
  File "renpy/display/core.py", line 3693, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "renpy/display/core.py", line 567, in visit_all
    d.visit_all(callback, seen)
  File "renpy/display/core.py", line 567, in visit_all
    d.visit_all(callback, seen)
  File "renpy/display/core.py", line 567, in visit_all
    d.visit_all(callback, seen)
  File "renpy/display/screen.py", line 432, in visit_all
    callback(self)
  File "renpy/display/core.py", line 3693, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "renpy/display/screen.py", line 443, in per_interact
    self.update()
  File "renpy/display/screen.py", line 631, in update
    self.screen.function(**self.scope)
  File "game/screens.rpy", line 1295, in execute
    screen nvl(dialogue, items=None):
  File "game/screens.rpy", line 1295, in execute
    screen nvl(dialogue, items=None):
  File "game/screens.rpy", line 1297, in execute
    window:
  File "game/screens.rpy", line 1300, in execute
    has vbox:
  File "renpy/sl2/slast.py", line 1569, in execute
    for index, v in enumerate(value):
TypeError: 'NoneType' object is not iterable

Windows-10-10.0.19041
Ren'Py 7.4.6.1693
Project 3 1.0
Sun Jul  4 23:22:47 2021
```
---
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it

User avatar
midgethetree
Regular
Posts: 39
Joined: Wed Dec 30, 2020 3:51 pm
Completed: Back When, The Mother of Pearls, various jam games
Projects: When Everyone's Watching, Deliberation
Github: midgethetree
itch: midge-the-tree
Discord: rainafc#3353
Contact:

Re: ADV-Dialogue on top of NVL?

#5 Post by midgethetree »

Oh whoops, I forgot that I also removed the lines

Code: Select all

for i in items:

    textbutton i.caption:
        action i.action
        style "nvl_button"
from the nvl screen, since I wasn't using the nvl screen for choices. You can also remove those lines if you also don't need them, otherwise I'd suggest changing the line

Code: Select all

screen nvl(dialogue, items=None):
to

Code: Select all

screen nvl(dialogue, items=[]):

felsenstern
Regular
Posts: 72
Joined: Tue Jul 11, 2017 2:13 am
Contact:

Re: ADV-Dialogue on top of NVL?

#6 Post by felsenstern »

Hmm... haven't thought of adding choices in NVL-Mode, very tempting idea. But, thanks a lot for your efforts, this works now very nicely. I also checked out your game and ... wow, just the possibilities and choices in the beginning are a bit overwhelming.
---
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it

CSK
Newbie
Posts: 16
Joined: Sat Sep 10, 2022 2:42 pm
Contact:

Re: ADV-Dialogue on top of NVL?

#7 Post by CSK »

This is the perfect solution for what I have been looking for and has worked with everything I needed so far, but now I started to work on menu in the project and when using menu (nvl=True): it still shows the line above the choices, but not the choices. I have changed the screen nvl(dialogue, items=None): to screen nvl(dialogue, items=[]): but without noticing any difference. Hope there is a way to make this work with nvl menu as well, or that I might have been doing something wrong in implementing it - tested it in a completely newly created project that pretty much only contains this code, an nvl menu and the change in screens.rpy and commenting the code part shows the choices - but maybe I misread something or didn't do something that should have been obvious?
midgethetree wrote: Sun Jul 04, 2021 11:55 am

Code: Select all

init python:

    def nontransient_nvl(mode, old_modes):

        if mode == 'say' or mode == 'menu':
            widget_properties, dialogue, show_args = _m1_00nvl_mode__nvl_screen_dialogue()
            if dialogue:
                renpy.show_screen('nvl', _layer=config.nvl_layer, _widget_properties=widget_properties, dialogue=dialogue, **show_args)

        elif mode == 'nvl':
            nvl_hide(None)

    config.mode_callbacks.append(nontransient_nvl)

Post Reply

Who is online

Users browsing this forum: Google [Bot], Sugar_and_rice