Hi! I'm just wondering what should be edited in the scripts so that the choices in a Show Choices box will always be centered? Or maybe there is a script that does this?
Thank you! 🙂
Thank you! 🙂
#==============================================================================# ** Window_ChoiceList#------------------------------------------------------------------------------# This window is used for the event command [Show Choices].#============================================================================== class Window_ChoiceList < Window_Command #-------------------------------------------------------------------------- # * Update Window Position #-------------------------------------------------------------------------- def update_placement self.width = [max_choice_width + 12, 96].max + padding * 2 self.width = [width, Graphics.width].min self.height = fitting_height($game_message.choices.size) self.x = Graphics.width / 2 - width / 2 if @message_window.y >= Graphics.height / 2 self.y = @message_window.y - height else self.y = @message_window.y + @message_window.height end end end
#==============================================================================# ** Window_ChoiceList#------------------------------------------------------------------------------# This window is used for the event command [Show Choices].#==============================================================================class Window_ChoiceList < Window_Command #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(message_window) @message_window = message_window super(0, 0) self.openness = 0 deactivate end def alignment 1 end #-------------------------------------------------------------------------- # * Start Input Processing #-------------------------------------------------------------------------- def start update_placement refresh select(0) open activate end #-------------------------------------------------------------------------- # * Update Window Position #-------------------------------------------------------------------------- def update_placement self.width = 344#[max_choice_width + 12, 96].max + padding * 2 self.width = 344#[width, Graphics.width].min self.height = fitting_height($game_message.choices.size) self.x = (Graphics.width - width) / 2 self.y = 125 #self.x = Graphics.width - width #self.x = 225 - Graphics.width #if @message_window.y >= Graphics.height / 2 # self.y = @message_window.y - height #else # self.y = @message_window.y + @message_window.height #end end #-------------------------------------------------------------------------- # * Get Maximum Width of Choices #-------------------------------------------------------------------------- def max_choice_width $game_message.choices.collect {|s| text_size(s).width }.max end #-------------------------------------------------------------------------- # * Calculate Height of Window Contents #-------------------------------------------------------------------------- def contents_height item_max * item_height end #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- def make_command_list $game_message.choices.each do |choice| add_command(choice, :choice) end end #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect_for_text(index) # rect.x =(max_choice_width) rect.x = (344 - $game_message.choices.collect {|s| text_size(s) .width }[index] - (padding * 2)) / 2 draw_text_ex(rect.x, rect.y, command_name(index)) end #-------------------------------------------------------------------------- # * Get Activation State of Cancel Processing #-------------------------------------------------------------------------- def cancel_enabled? $game_message.choice_cancel_type > 0 end #-------------------------------------------------------------------------- # * Call OK Handler #-------------------------------------------------------------------------- def call_ok_handler $game_message.choice_proc.call(index) close end #-------------------------------------------------------------------------- # * Call Cancel Handler #-------------------------------------------------------------------------- def call_cancel_handler $game_message.choice_proc.call($game_message.choice_cancel_type - 1) close endend
Original thread: https://forums.rpgmakerweb.com/threads/centering-show-choices-text.28855/