#============================================================================== # ** ExCommand_MessageAdjust (MACKIE) #------------------------------------------------------------------------------ # This script allows you to adjust the message window's display area when # running [Show Text] without specifying a face graphic. #============================================================================== # The ID of the switch used to adjust the message window. # When set to ON, the message window's display area will be squeezed down from # the space normally dedicated to the face graphic. # [Show Choices] and [Input Numbers] will also be adjusted appropriately. EXCMD_MSGADJUST_SID = 25 # Window width adjustment flag. # Specifies whether to adjust the width to the normal window display area. # (0: no adjustment; 1: adjust) EXCMD_MSGADJUST_WINDOW = 1 #------------------------------------------------------------------------------ class Window_NumberInput #-------------------------------------------------------------------------- # * Determine whether to adjust the display area #-------------------------------------------------------------------------- def need_adjust? return false if $game_temp.in_battle if $game_message.face_name.empty? and $game_switches[EXCMD_MSGADJUST_SID] return true end return false end #-------------------------------------------------------------------------- # * Refresh (Redefined) #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.color = normal_color @contents_x = 0 if need_adjust? @contents_x = EXCMD_MSGADJUST_WINDOW == 1 ? 0 : 56 end s = sprintf("%0*d", @digits_max, @number) for i in 0...@digits_max self.contents.draw_text(@contents_x + 24 + i * 16, 0, 16, WLH, s[i,1], 1) end end #-------------------------------------------------------------------------- # * Update cursor (Redefined) #-------------------------------------------------------------------------- def update_cursor self.cursor_rect.set(@contents_x + 24 + @index * 16, 0, 16, WLH) end end class Window_Message alias _excmsga_initialize initialize unless $@ alias _excmsga_new_page new_page unless $@ alias _excmsga_new_line new_line unless $@ alias _excmsga_reset_window reset_window unless $@ #-------------------------------------------------------------------------- # * Object Initialization (Definition added) #-------------------------------------------------------------------------- def initialize _excmsga_initialize @face_name = "" # Face Graphic Name end #-------------------------------------------------------------------------- # * Determine whether to adjust the display area #-------------------------------------------------------------------------- def need_adjust? return false if $game_temp.in_battle if $game_message.face_name.empty? and $game_switches[EXCMD_MSGADJUST_SID] return true end return false end #-------------------------------------------------------------------------- # * Determine Whether to Display the Next Message Continuously (Redefined) #-------------------------------------------------------------------------- def continue? return true if $game_message.num_input_variable_id > 0 return false if $game_message.texts.empty? if self.openness > 0 and not $game_temp.in_battle return false if @background != $game_message.background return false if @position != $game_message.position if EXCMD_MSGADJUST_WINDOW == 1 and $game_switches[EXCMD_MSGADJUST_SID] return false if $game_message.face_name.empty? != @face_name.empty? end end return true end #-------------------------------------------------------------------------- # * New Page (Definition added) #-------------------------------------------------------------------------- def new_page _excmsga_new_page if need_adjust? @contents_x = EXCMD_MSGADJUST_WINDOW == 1 ? 0 : 56 end end #-------------------------------------------------------------------------- # * New Line (Definition added) #-------------------------------------------------------------------------- def new_line _excmsga_new_line if need_adjust? @contents_x = EXCMD_MSGADJUST_WINDOW == 1 ? 0 : 56 end end #-------------------------------------------------------------------------- # * Set Window Background and Position (Definition added) #-------------------------------------------------------------------------- def reset_window _excmsga_reset_window @face_name = $game_message.face_name if EXCMD_MSGADJUST_WINDOW == 1 and $game_switches[EXCMD_MSGADJUST_SID] self.x = $game_message.face_name.empty? ? 56 : 0 self.width = $game_message.face_name.empty? ? 544 - 112 : 544 @number_input_window.width = self.width @number_input_window.create_contents create_contents end end #-------------------------------------------------------------------------- # * Update cursor (Redefined) #-------------------------------------------------------------------------- def update_cursor if @index >= 0 x = $game_message.face_name.empty? ? @contents_x : 112 y = ($game_message.choice_start + @index) * WLH w = $game_message.face_name.empty? ? x * 2 : x self.cursor_rect.set(x, y, contents.width - w, WLH) else self.cursor_rect.empty end end end