Advertisement
neutale

Variable Display Window

Oct 20th, 2019
860
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.85 KB | None | 0 0
  1. #==============================================================================
  2. # RGSS3 Variable display window (for menu screen) Ver1.00
  3. #==============================================================================
  4. =begin
  5.   Author:ぷり娘 (prico)
  6. web site:Sister's Eternal 4th(Ancient)
  7.      URL:http://pricono.whitesnow.jp/
  8. Permission to use: Not required, but please mention in the game, Readme, etc.
  9.  
  10. Adds a window that can display variables.
  11. All you need to do is to add this script.
  12.  
  13. Make various settings according to the module.
  14.  
  15. 2012.12.06  Ver1.00 Initial release
  16. =end
  17.  
  18. module Prico
  19.  
  20.   # Display switch number (Displayed when specified switch is ON)
  21.   # If 0 is specified, it is displayed.
  22.   Disp_SW = 0
  23.  
  24.   # Number of variable for display. 0 is prohibited
  25.   Var_Num = 1
  26.  
  27.   # Window title string (less than 15 characters)
  28.   Var_Prefix = "Variable #"
  29.  
  30.   # Unit (less than 13 characters). Nil if not needed
  31.   Var_Suffix = ".Pt"
  32.  
  33.   # Numerical display position (X: coordinate)
  34.   # (Calculate with the string specified by Var_Suffix)
  35.   # Half-width characters: 10 (9),
  36.   # Full-width characters: 20 (18) * Number of characters
  37.   # Example: 50 (45) for "Point", 60 (54) for "Medal", etc.
  38.   Num_Adj = 24
  39.  
  40.   # Window position correction (Y: coordinate)
  41.   # 305 to display right above the gold window.
  42.   WindowY = 305
  43.  
  44. end
  45.  
  46.  
  47. class Window_Var < Window_Base
  48.   #--------------------------------------------------------------------------
  49.   # ● Initialization
  50.   #--------------------------------------------------------------------------
  51.   def initialize
  52.     if Prico::Disp_SW == 0 || $game_switches[Prico::Disp_SW] == true
  53.       super(0, 0, 160,fitting_height(2) - 8)
  54.       self.contents = Bitmap.new(width - 24, height - 24)# - 32)
  55.       refresh
  56.     end
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ● Refresh
  60.   #--------------------------------------------------------------------------
  61.   def refresh
  62.     self.contents.clear
  63.     text = $game_variables[Prico::Var_Num]
  64.     self.contents.font.color = system_color
  65.     self.contents.draw_text(0, -2, width + 28,line_height,Prico::Var_Prefix,0)
  66.     self.contents.draw_text(0,line_height - 4, 138,line_height,Prico::Var_Suffix,2)
  67.     self.contents.font.color = normal_color
  68.     self.contents.draw_text(0,line_height - 4, 128 - Prico::Num_Adj, line_height, text, 2)
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● Update
  72.   #--------------------------------------------------------------------------
  73.   def update
  74.     super
  75.     refresh
  76.   end
  77. end
  78.  
  79. class Scene_Menu
  80.   alias var_start start
  81.   def start
  82.     var_start
  83.     if Prico::Disp_SW == 0 || $game_switches[Prico::Disp_SW] == true
  84.       @Var_window = Window_Var.new
  85.       @Var_window.x = 0
  86.       @Var_window.y = Prico::WindowY
  87.     end
  88.   end
  89. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement