Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ########## IN SCREENS.RPY ######################################################
- ## NVL screen ##################################################################
- ##
- ## This screen is used for NVL-mode dialogue and menus.
- ##
- ## https://www.renpy.org/doc/html/screen_special.html#nvl
- ## Thank you to BunSE for the code
- default nvl_type = "normal"
- screen nvl(dialogue, items=None):
- ## DEFAULT NVL MODE
- if nvl_type == "normal":
- window:
- style "nvl_window"
- background Transform(style.nvl_window.background, alpha=persistent.say_window_alpha)
- 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
- elif nvl_type == "compchat":
- fixed:
- # Position in the screen
- align (0.5, 0.2)
- # Size of the window for the messages to appear. Second argument MUST be 0.
- maximum (800, 0)
- # Dialogue list to display
- vbox:
- # Spacing between the elements
- spacing 3
- # Dialogue screen
- use nvl_dialogue(dialogue)
- screen nvl_dialogue(dialogue):
- if nvl_type == "normal":
- 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 kerning persistent.say_dialogue_kerning font persistent.pref_text_font size persistent.pref_text_size
- text d.what:
- id d.what_id kerning persistent.say_dialogue_kerning font persistent.pref_text_font size persistent.pref_text_size
- elif nvl_type == "compchat":
- # For each dialogue option
- for d in dialogue:
- # Is the speaker the MC? For right or left alignment
- $ var = (d.who == mc)
- # Each dialogue
- window:
- id d.window_id
- xfill False
- ysize None
- # Padding to add between the background and text
- padding (10, 5)
- # If speaker is MC, align message to the right
- if var:
- xalign 1.0
- background rcolor
- # If speaker is someone else, align message to the left
- else:
- xalign 0.0
- xoffset -300
- background lcolor
- # Dialogue text
- text d.what:
- id d.what_id
- pos (0,0)
- # 'Fixed' Needed for the window to stick to either the right or left. Not sure why.
- fixed:
- pass
- ########## IN SCRIPT.RPY ######################################################
- define e_nvl = Character("[mc]", color="#f88787", kind=nvl)
- define nar_nvl = nvl_narrator
- define mc = "Eileen"
- define rcolor = Color("#926") # Right speaker color = MC
- define lcolor = Color("#713") # Left speaker color = Other people
- label start:
- nar_nvl "NVL Mode is a different way of displaying text on the screen."
- e_nvl "Unlike ADV, past lines of dialogue are still displayed until it is cleared off."
- nar_nvl "Usually NVL will cover the entire screen, but you can adjust the size of the window to only cover a certain part if need be."
- nvl clear
- $ nvl_type = "compchat"
- e_nvl "Not all games may need to use both ADV and NVL, but it's nice to have options as a developer."
- e_nvl "With that said, let's go somewhere else."
- nar_nvl "Eileen wonders where she should travel to."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement