Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.33 KB | None | 0 0
  1. ########## IN SCREENS.RPY ######################################################
  2.  
  3. ## NVL screen ##################################################################
  4. ##
  5. ## This screen is used for NVL-mode dialogue and menus.
  6. ##
  7. ## https://www.renpy.org/doc/html/screen_special.html#nvl
  8.  
  9. ## Thank you to BunSE for the code
  10. default nvl_type = "normal"
  11.  
  12. screen nvl(dialogue, items=None):
  13.  
  14. ## DEFAULT NVL MODE
  15. if nvl_type == "normal":
  16.  
  17. window:
  18. style "nvl_window"
  19.  
  20. background Transform(style.nvl_window.background, alpha=persistent.say_window_alpha)
  21.  
  22. has vbox:
  23. spacing gui.nvl_spacing
  24.  
  25. ## Displays dialogue in either a vpgrid or the vbox.
  26. if gui.nvl_height:
  27.  
  28. vpgrid:
  29. cols 1
  30. yinitial 1.0
  31.  
  32. use nvl_dialogue(dialogue)
  33.  
  34. else:
  35.  
  36. use nvl_dialogue(dialogue)
  37.  
  38. ## Displays the menu, if given. The menu may be displayed incorrectly if
  39. ## config.narrator_menu is set to True, as it is above.
  40. for i in items:
  41.  
  42. textbutton i.caption:
  43. action i.action
  44. style "nvl_button"
  45.  
  46. add SideImage() xalign 0.0 yalign 1.0
  47.  
  48. elif nvl_type == "compchat":
  49.  
  50. fixed:
  51.  
  52. # Position in the screen
  53. align (0.5, 0.2)
  54.  
  55. # Size of the window for the messages to appear. Second argument MUST be 0.
  56. maximum (800, 0)
  57.  
  58. # Dialogue list to display
  59.  
  60. vbox:
  61.  
  62. # Spacing between the elements
  63. spacing 3
  64. # Dialogue screen
  65. use nvl_dialogue(dialogue)
  66.  
  67. screen nvl_dialogue(dialogue):
  68.  
  69. if nvl_type == "normal":
  70. for d in dialogue:
  71.  
  72. window:
  73. id d.window_id
  74.  
  75. fixed:
  76. yfit gui.nvl_height is None
  77.  
  78. if d.who is not None:
  79.  
  80. text d.who:
  81. id d.who_id kerning persistent.say_dialogue_kerning font persistent.pref_text_font size persistent.pref_text_size
  82.  
  83. text d.what:
  84. id d.what_id kerning persistent.say_dialogue_kerning font persistent.pref_text_font size persistent.pref_text_size
  85.  
  86. elif nvl_type == "compchat":
  87.  
  88. # For each dialogue option
  89. for d in dialogue:
  90.  
  91. # Is the speaker the MC? For right or left alignment
  92. $ var = (d.who == mc)
  93.  
  94. # Each dialogue
  95. window:
  96.  
  97. id d.window_id
  98. xfill False
  99. ysize None
  100.  
  101. # Padding to add between the background and text
  102. padding (10, 5)
  103.  
  104. # If speaker is MC, align message to the right
  105. if var:
  106. xalign 1.0
  107. background rcolor
  108.  
  109. # If speaker is someone else, align message to the left
  110. else:
  111. xalign 0.0
  112. xoffset -300
  113. background lcolor
  114.  
  115. # Dialogue text
  116. text d.what:
  117. id d.what_id
  118. pos (0,0)
  119.  
  120. # 'Fixed' Needed for the window to stick to either the right or left. Not sure why.
  121. fixed:
  122. pass
  123.  
  124. ########## IN SCRIPT.RPY ######################################################
  125.  
  126. define e_nvl = Character("[mc]", color="#f88787", kind=nvl)
  127. define nar_nvl = nvl_narrator
  128. define mc = "Eileen"
  129.  
  130. define rcolor = Color("#926") # Right speaker color = MC
  131. define lcolor = Color("#713") # Left speaker color = Other people
  132.  
  133. label start:
  134.  
  135. nar_nvl "NVL Mode is a different way of displaying text on the screen."
  136.  
  137. e_nvl "Unlike ADV, past lines of dialogue are still displayed until it is cleared off."
  138.  
  139. 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."
  140.  
  141. nvl clear
  142.  
  143. $ nvl_type = "compchat"
  144.  
  145. e_nvl "Not all games may need to use both ADV and NVL, but it's nice to have options as a developer."
  146.  
  147. e_nvl "With that said, let's go somewhere else."
  148.  
  149. nar_nvl "Eileen wonders where she should travel to."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement