Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] Text Starting Postion

You're going to have to explain what you want a little better.
You want the text centered?
You want a larger margin on the left of the message window?
You want to be able to set the margin for each window?

Help us out a bit.

Be Well
 
If you aren't using any custom scripts, you can use this:

Add this above Main anywhere.
Code:
class Game_System
  attr_accessor :message_indention
  alias_method :seph_messageindent_gmsys_init, :initialize
  def initialize
    seph_messageindent_gmsys_init
    @message_indention = 0
  end
end

Now, in Window_Message, make the following changes:
Code:
    x = y = 0
    @cursor_width = 0
    # Indent if choice
    if $game_temp.choice_start == 0
      x = 8
    end
To
Code:
    x = $game_system.message_indention
    y = 0
    @cursor_width = 0
    # Indent if choice
    if $game_temp.choice_start == 0
      x += 8
    end
And
Code:
          # Add 1 to y
          y += 1
          x = 0
          # Indent if choice
          if y >= $game_temp.choice_start
            x = 8
          end
To
Code:
          # Add 1 to y
          y += 1
          x = $game_system.message_indention
          # Indent if choice
          if y >= $game_temp.choice_start
            x += 8
          end

Now, to change your indention, just use:
Code:
$game_system.message_indention = n
 
Code:
$game_system.message_indention = n
Is this a Call script? if it is here is the results

NameError occrred while running script

undefined local variable or method 'n' for #<Interpreter:0x3c14d48>
 

khmp

Sponsor

How did you apply those script edits SephirothSpawn gave you? Insert an empty section above Main in the script listing and paste the following code:
Code:
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles data surrounding the system. Backround music, etc.
#  is managed here as well. Refer to "$game_system" for the instance of 
#  this class.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :message_indention
  #--------------------------------------------------------------------------
  # * Aliasing Methods
  #--------------------------------------------------------------------------
  alias_method :seph_messageindent_gmsys_init, :initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    seph_messageindent_gmsys_init
    @message_indention = 0
  end
end

#==============================================================================
# ** Window_Message
#------------------------------------------------------------------------------
#  This message window is used to display text.
#==============================================================================

class Window_Message < Window_Selectable
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    x = $game_system.message_indention
    y = 0
    @cursor_width = 0
    # Indent if choice
    if $game_temp.choice_start == 0
      x += 8
    end
    # If waiting for a message to be displayed
    if $game_temp.message_text != nil
      text = $game_temp.message_text
      # Control text processing
      begin
        last_text = text.clone
        text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
      end until text == last_text
      text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
        $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
      end
      # Change "\\\\" to "\000" for convenience
      text.gsub!(/\\\\/) { "\000" }
      # Change "\\C" to "\001" and "\\G" to "\002"
      text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
      text.gsub!(/\\[Gg]/) { "\002" }
      # Get 1 text character in c (loop until unable to get text)
      while ((c = text.slice!(/./m)) != nil)
        # If \\
        if c == "\000"
          # Return to original text
          c = "\\"
        end
        # If \C[n]
        if c == "\001"
          # Change text color
          text.sub!(/\[([0-9]+)\]/, "")
          color = $1.to_i
          if color >= 0 and color <= 7
            self.contents.font.color = text_color(color)
          end
          # go to next text
          next
        end
        # If \G
        if c == "\002"
          # Make gold window
          if @gold_window == nil
            @gold_window = Window_Gold.new
            @gold_window.x = 560 - @gold_window.width
            if $game_temp.in_battle
              @gold_window.y = 192
            else
              @gold_window.y = self.y >= 128 ? 32 : 384
            end
            @gold_window.opacity = self.opacity
            @gold_window.back_opacity = self.back_opacity
          end
          # go to next text
          next
        end
        # If new line text
        if c == "\n"
          # Update cursor width if choice
          if y >= $game_temp.choice_start
            @cursor_width = [@cursor_width, x].max
          end
          # Add 1 to y
          y += 1
          x = $game_system.message_indention
          # Indent if choice
          if y >= $game_temp.choice_start
            x += 8
          end
          # go to next text
          next
        end
        # Draw text
        self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
        # Add x to drawn text width
        x += self.contents.text_size(c).width
      end
    end
    # If choice
    if $game_temp.choice_max > 0
      @item_max = $game_temp.choice_max
      self.active = true
      self.index = 0
    end
    # If number input
    if $game_temp.num_input_variable_id > 0
      digits_max = $game_temp.num_input_digits_max
      number = $game_variables[$game_temp.num_input_variable_id]
      @input_number_window = Window_InputNumber.new(digits_max)
      @input_number_window.number = number
      @input_number_window.x = self.x + 8
      @input_number_window.y = self.y + $game_temp.num_input_start * 32
    end
  end
end

Good luck with it jimmyly! :afro:
 
@khmp: That script totally disable the Hide Text Box system so I cant use that.

@Sept:Ok after a few Tried i found out that i have to put the call script on the Event for it to work anyways it working 100% fine Close this topic.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top