Dual NVL-AVD Mode?

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
SeaOtter
Newbie
Posts: 12
Joined: Sun Oct 26, 2014 12:30 am
Contact:

Dual NVL-AVD Mode?

#1 Post by SeaOtter »

Ello all!

I've been tinkering with renpy for some time and am really struggling with design. It's terribly difficult. I've been aiming for a specific dialogue layout so that there can be two textboxes on the screen at the same time. Both have different styles and either one or both of them need to be NVL.

So... well... I tried making two NVL textboxes but I didn't quite understand the documentation of that so I went off to make one NVL and the other ADV. But that didn't go smoothly. The problem I ran into was that when I switched modes through characters, the old mode would not stay on screen. I guess this is supposed to be an automatic helper so that there ISNT two windows on the screen at the same time. Idk. I suppose it involves some sort of internal coding or callback or such--probably easily changeable--but I'm just plain incapable of changing it.

Is there a way to use both modes at the same time? Or maybe there's a different way to present dialogue and narration?
(Oh, and this is my first forum post, yay! :D)

User avatar
Alex
Lemma-Class Veteran
Posts: 3093
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Dual NVL-AVD Mode?

#2 Post by Alex »

Try this - change the nvl screen in screens.rpy

Code: Select all

##############################################################################
# Nvl
#
# Screen used for nvl-mode dialogue and menus.
# http://www.renpy.org/doc/html/screen_special.html#nvl

screen nvl:
    
  if my_var:

        frame:
            xpos 32 ypos 36
            top_padding 10 bottom_padding 10 left_padding 10 right_padding 10
            has side "c r":
                area (0, 0, 512, 200)
                viewport id "vp_1":
                    draggable True
                    yinitial 1.0
                    
                    has vbox:
                          style "nvl_vbox"
                          for who, what, who_id, what_id, window_id in dialogue:
                              if who == sp_1:
                                  window:
                                        id window_id

                                        hbox:
                                            spacing 10
                                            text who id who_id
                                            text what id what_id
                                            
                vbar value YScrollValue("vp_1") bar_invert True
                
                        
            
        frame:
            xpos 32 ypos 336
            top_padding 10 bottom_padding 10 left_padding 10 right_padding 10
            has side "c r":
                area (0, 0, 512, 200)
                viewport id "vp_2":
                    draggable True
                    yinitial 1.0
                    
                    has vbox:
                          style "nvl_vbox"
                          for who, what, who_id, what_id, window_id in dialogue:
                              if who == sp_2:
                                  window:
                                        id window_id
                                    
                                        hbox:
                                            spacing 10
                                            text who id who_id
                                            text what id what_id
                                            
                vbar value YScrollValue("vp_2") bar_invert True
        
        
  else:      

    window:
        style "nvl_window"

        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:

                    if action:

                        button:
                            style "nvl_menu_choice_button"
                            action action

                            text caption style "nvl_menu_choice"

                    else:

                        text caption style "nvl_dialogue"

    add SideImage() xalign 0.0 yalign 1.0

    use quick_menu
Then use it like

Code: Select all

# Declare characters used by this game.
define e = Character('Eileen', color="#c8ffc8", image="eileen", show_side_xalign=1.0, kind=nvl)
define a = Character('Aileen', color="#c8ffc8", image="eileen", show_side_xalign=1.0, kind=nvl)

# The game starts here.
label start:

    $ sp_1 = "Eileen"
    $ sp_2 = "Aileen"
    $ my_var = True
    
    e "Hi!"
    e "..."
    e "Helo-o-o-o..."
    a "Hi, I'm here"
    e "Why didn't you answer?"
    a "Sorry, was at the kitchen - made another cup of coffee..."
    e "lol"

    nvl clear
    
    $ my_var = False
    "?"

User avatar
SeaOtter
Newbie
Posts: 12
Joined: Sun Oct 26, 2014 12:30 am
Contact:

Re: Dual NVL-AVD Mode?

#3 Post by SeaOtter »

Woo, it worked! You're brilliant :33

Post Reply

Who is online

Users browsing this forum: No registered users