Guest User

Extra Menu Window 1.3 by Rikifive

a guest
Jul 10th, 2015
663
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #==============================================================================#
  2. # ■■■■■■■■■■■■■■■■■■■■■■■■■■■■ EXTRA MENU WINDOW ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ #
  3. #                          ---=== Version: 1.3 ===---                          #
  4. #==============================================================================#
  5. #                         Script written by: Rikifive                          #
  6. #==============================================================================#
  7. #                              ▼ INTRODUCTION ▼                                #
  8. #==============================================================================#
  9. # This script creates a simple window with custom information in main menu.    #
  10. # Variations, playtime, location etc. can now be displayed in menu.            #
  11. #==============================================================================#
  12. #                              ▼ COMPATIBILITY ▼                               #
  13. #==============================================================================#
  14. # this script is written in the most simplest possible way, but it may         #
  15. # be incompatible with scripts that changes your menu.                         #
  16. #==============================================================================#
  17. #                              ▼ TERMS OF USE ▼                                #
  18. #==============================================================================#
  19. #       ---=== For both COMMERCIAL and NON-COMMERCIAL projects. ===---         #
  20. #         Crediting me (Rikifive) in your game would be appreciated.           #
  21. #==============================================================================#
  22. #                             ▼ VERSION HISTORY ▼                              #
  23. #==============================================================================#
  24. # Version 1.0: Initial Release                                                 #
  25. # Version 1.1: - Changed refresh rate of playtime. (thanks to DigiDeity)       #
  26. # Version 1.2: - Added option that disables the default Gold Window in Menu.   #
  27. #              - Fixed the resolution of the window lines.                     #
  28. # Version 1.3: - Added option to center text/value when not using icons.       #
  29. #              - Moved "Font settings" to "Main Settings".                     #
  30. #==============================================================================#
  31. #                              ▼ INSTRUCTIONS ▼                                #
  32. #==============================================================================#
  33. # I know this script is kinda messy, but it's pretty easy to configure.        #
  34. #                                                                              #
  35. # Configuring things (*items*) displayed in window starts in line #100.        #
  36. # Each item starts with "[ ● Item Setup ]" and ends with second wall of "###". #
  37. # To configure *items* simply follow the examples.                             #
  38. # Do not edit anything between walls of "##############", unless you know what #
  39. # you're doing.                                                                #
  40. # You can add as many lines as you want. (the display resolution is the limit) #
  41. # To add a new line (item), copy everything from "[ ● Item Setup ]" to         #
  42. # second wall of "###" and paste that below/above the other things (items).    #
  43. # You can put text into value or a value into text or you can even put two     #
  44. # texts in the one thing (item), that doesn't matter.                          #
  45. # You can use things like "$game_party.gold" or use a variable.                #
  46. # To add variable into the window put $game_variables[ID] in the text/value.   #
  47. #==============================================================================#
  48.  
  49. #-------------------------------------------------------------------------------
  50. # ► Main Settings (Setup your window and stuff)
  51. #-------------------------------------------------------------------------------
  52. # ● Set amount of items displayed in the window.
  53. WINDOW_LINES = 4
  54.  
  55. # ● Set the window position.
  56. WINDOW_POSITION_X = 0
  57. WINDOW_POSITION_Y = 360
  58.  
  59. # ● Font settings
  60. BOLD = false # enable / disable font BOLD.
  61. SIZE = 20 # Set the font SIZE.
  62. OUTLINE = false # enable / disable font OUTLINE.
  63. SHADOW = true # enable / disable font SHADOW.
  64.  
  65. # ● Enable / Disable default Gold Window.
  66. DEFAULT_GOLD_WINDOW = false
  67.  
  68. # ● In case of incompatibilities (disappearing other custom windows), try
  69. #   moving that script up. If that will not work, you can always disable
  70. #   overwriting of the Scene_Menu < Scene_MenuBase.
  71. #   NOTE: This will disable the "Default Gold Window" option.
  72. OVERWRITE_SCENE_MENU = true
  73.  
  74. #===========================[ END OF MAIN SETTINGS ]===========================#
  75. #-------------------------------------------------------------------------------
  76. # ► Initialize (Do not touch anything here)
  77. #-------------------------------------------------------------------------------
  78. class Window_ExtraMenuWindow < Window_Base
  79.   def initialize(x, y)
  80.   super(x, y, 160, 24 + 24 * WINDOW_LINES)
  81.   self.contents.font.bold = BOLD
  82.   self.contents.font.size = SIZE
  83.   self.contents.font.outline = OUTLINE
  84.   self.contents.font.shadow = SHADOW
  85.   self.contents.font.color = normal_color
  86.   @playtime = 0
  87.   refresh
  88. end
  89.  
  90.   #-----------------------------------------------------------------------------
  91.   # ► Setup (Do not touch anything here)
  92.   #-----------------------------------------------------------------------------
  93.   def refresh
  94.   self.contents.clear
  95.   # ● Width & Height
  96.   wid = contents.width - 24
  97.   hei = 72
  98.  
  99.   #-----------------------------------------------------------------------------
  100.   # ► Draw Stuff (Here you can setup displayed stuff)
  101.   #-----------------------------------------------------------------------------
  102.  
  103.   #===========================[ ● Item 1 Setup ]===============================#
  104.   enable = true # Enable this item? (Playtime by default)
  105.   if enable # DO NOT TOUCH
  106.   position = 4 # Sets the position of this item
  107.   text = "Time" # Sets the displayed text, leave "" to disable text
  108.   t_align = 0 # Sets the text alignment (0 - left; 1 - center; 2 - right)
  109.   t_red = 150 # Set the color of text displayed
  110.   t_grn = 175 # ~
  111.   t_blu = 255 # ~
  112.   value = $game_system.playtime_s # Sets the value displayed
  113.   v_align = 2 # Sets the value alignment (0 - left; 1 - center; 2 - right)
  114.   v_red = 255 # Set the color of value displayed
  115.   v_grn = 255 # ~
  116.   v_blu = 255 # ~
  117.   icon = 280 # ID of the displayed icon. (put 0 to disable [blank icon])
  118.   iconpos = 0 # Sets the position of icon. (0 - left; 1 - right)
  119.   center = false # Center text/value? (use when icon is not used)
  120.  
  121.   ##############################################################################
  122.   self.contents.font.color = Color.new(t_red,t_grn,t_blu)
  123.   if center
  124.   self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, text, t_align)
  125.   else # normal
  126.   self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, text, t_align)
  127.   end # if CENTER_TEXT
  128.   self.contents.font.color = Color.new(v_red,v_grn,v_blu)
  129.   if center
  130.   self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, "#{value}", v_align)
  131.   else # normal
  132.   self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, "#{value}", v_align)
  133.   end #if CENTER_TEXT
  134.   self.contents.font.color = normal_color
  135.   draw_icon(icon, 0 + 112 * iconpos, -24 + 24 * position)
  136.   else # disabled text
  137.   end # if enable
  138.   ##############################################################################
  139.  
  140.   #===========================[ ● Item 2 Setup ]===============================#
  141.   enable = true # Enable this item? (Location by default)
  142.   if enable # DO NOT TOUCH
  143.   position = 3 # Sets the position of this item
  144.   text = "" # Sets the displayed text, leave "" to disable text
  145.   t_align = 0 # Sets the text alignment (0 - left; 1 - center; 2 - right)
  146.   t_red = 35 # Set the color of text displayed
  147.   t_grn = 160 # ~
  148.   t_blu = 220 # ~
  149.   value = $data_mapinfos[$game_map.map_id].name # Sets the value displayed
  150.   v_align = 1 # Sets the value alignment (0 - left; 1 - center; 2 - right)
  151.   v_red = 255 # Set the color of value displayed
  152.   v_grn = 210 # ~
  153.   v_blu = 170 # ~
  154.   icon = 231 # ID of the displayed icon.
  155.   iconpos = 0 # Sets the position of icon (0 - left; 1 - right)
  156.   center = false # Center text/value? (use when icon is not used)
  157.  
  158.   ##############################################################################
  159.   self.contents.font.color = Color.new(t_red,t_grn,t_blu)
  160.   if center
  161.   self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, text, t_align)
  162.   else # normal
  163.   self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, text, t_align)
  164.   end # if CENTER_TEXT
  165.   self.contents.font.color = Color.new(v_red,v_grn,v_blu)
  166.   if center
  167.   self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, "#{value}", v_align)
  168.   else # normal
  169.   self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, "#{value}", v_align)
  170.   end #if CENTER_TEXT
  171.   self.contents.font.color = normal_color
  172.   draw_icon(icon, 0 + 112 * iconpos, -24 + 24 * position)
  173.   else # disabled text
  174.   end # if enable
  175.   ##############################################################################
  176.  
  177.   #===========================[ ● Item 3 Setup ]===============================#
  178.   enable = true # Enable this item? (Gold by default)
  179.   if enable # DO NOT TOUCH
  180.   position = 1 # Sets the position of this item
  181.   text = "Gold" # Sets the displayed text, leave "" to disable text
  182.   t_align = 0 # Sets the text alignment (0 - left; 1 - center; 2 - right)
  183.   t_red = 150 # Set the color of text displayed
  184.   t_grn = 175 # ~
  185.   t_blu = 255 # ~
  186.   value = $game_party.gold # Sets the value displayed
  187.   v_align = 2 # Sets the value alignment (0 - left; 1 - center; 2 - right)
  188.   v_red = 255 # Set the color of value displayed
  189.   v_grn = 255 # ~
  190.   v_blu = 150 # ~
  191.   icon = 361 # ID of the displayed icon.
  192.   iconpos = 1 # Sets the position of icon (0 - left; 1 - right)
  193.   center = false # Center text/value? (use when icon is not used)
  194.  
  195.   ##############################################################################
  196.   self.contents.font.color = Color.new(t_red,t_grn,t_blu)
  197.   if center
  198.   self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, text, t_align)
  199.   else # normal
  200.   self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, text, t_align)
  201.   end # if CENTER_TEXT
  202.   self.contents.font.color = Color.new(v_red,v_grn,v_blu)
  203.   if center
  204.   self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, "#{value}", v_align)
  205.   else # normal
  206.   self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, "#{value}", v_align)
  207.   end #if CENTER_TEXT
  208.   self.contents.font.color = normal_color
  209.   draw_icon(icon, 0 + 112 * iconpos, -24 + 24 * position)
  210.   else # disabled text
  211.   end # if enable
  212.   ##############################################################################
  213.    
  214.   #===========================[ ● Item 4 Setup ]===============================#
  215.   enable = true # Enable this item? (Variable 18 by default)
  216.   if enable # DO NOT TOUCH
  217.   position = 2 # Sets the position of this item
  218.   text = "Var 18" # Sets the displayed text, leave "" to disable text
  219.   t_align = 0 # Sets the text alignment (0 - left; 1 - center; 2 - right)
  220.   t_red = 150 # Set the color of text displayed
  221.   t_grn = 175 # ~
  222.   t_blu = 255 # ~
  223.   value = $game_variables[18] # Sets the value displayed
  224.   v_align = 2 # Sets the value alignment (0 - left; 1 - center; 2 - right)
  225.   v_red = 50 # Set the color of value displayed
  226.   v_grn = 255 # ~
  227.   v_blu = 255 # ~
  228.   icon = 347 # ID of the displayed icon.
  229.   iconpos = 1 # Sets the position of icon (0 - left; 1 - right)
  230.   center = false # Center text/value? (use when icon is not used)
  231.  
  232.   ##############################################################################
  233.   self.contents.font.color = Color.new(t_red,t_grn,t_blu)
  234.   if center
  235.   self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, text, t_align)
  236.   else # normal
  237.   self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, text, t_align)
  238.   end # if CENTER_TEXT
  239.   self.contents.font.color = Color.new(v_red,v_grn,v_blu)
  240.   if center
  241.   self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, "#{value}", v_align)
  242.   else # normal
  243.   self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, "#{value}", v_align)
  244.   end #if CENTER_TEXT
  245.   self.contents.font.color = normal_color
  246.   draw_icon(icon, 0 + 112 * iconpos, -24 + 24 * position)
  247.   else # disabled text
  248.   end # if enable
  249.   ##############################################################################
  250.  
  251. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■#
  252. #■ END OF CUSTOMIZATION, Do not edit anything below, unless you know          ■#
  253. #■ what you're doing!                                                         ■#
  254. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■#
  255.  
  256.     @playtime = $game_system.playtime
  257.   end # Refresh
  258.  
  259.   #-----------------------------------------------------------------------------
  260.   # ► Update
  261.   #-----------------------------------------------------------------------------
  262.   def update
  263.     super
  264.     refresh if $game_system.playtime - @playtime >= 1
  265.   end
  266. end
  267.  
  268. #-------------------------------------------------------------------------------
  269. # ► Disable Window
  270. #-------------------------------------------------------------------------------
  271. if OVERWRITE_SCENE_MENU
  272. class Scene_Menu < Scene_MenuBase
  273.   def start
  274.     super
  275.     create_command_window
  276.     if DEFAULT_GOLD_WINDOW
  277.     create_gold_window
  278.     else
  279.     end # if
  280.     create_status_window
  281.   end # def
  282. end # class
  283. else
  284. end # if
  285.  
  286. #-------------------------------------------------------------------------------
  287. # ► Create Window
  288. #-------------------------------------------------------------------------------
  289. class Scene_Menu < Scene_MenuBase
  290.  
  291.   #-----------------------------------------------------------------------------
  292.   # ► Start
  293.   #-----------------------------------------------------------------------------
  294.   alias extramenuwindow_start start
  295.   def start
  296.   extramenuwindow_start
  297.   create_extramenuwindow_window
  298.   end
  299.  
  300.   #-----------------------------------------------------------------------------
  301.   # ► create Extra Menu Window
  302.   #-----------------------------------------------------------------------------
  303.   def create_extramenuwindow_window
  304.     @extramenuwindow_window = Window_ExtraMenuWindow.new(WINDOW_POSITION_X, WINDOW_POSITION_Y)
  305.   end
  306. end
RAW Paste Data