查看: 3743|回复: 7

[已经解决] 让一句台词之间出现两种字体可实现吗?

[复制链接]
梦石
0
星屑
208
在线时间
420 小时
注册时间
2020-1-11
回帖
175
发表于 2020-10-15 18:14:01 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
两种字体,指的是两种不同的字模。如 宋体 和 黑体。而不是大小斜体的差别。

不考虑引入图片冒充的情况。
梦石
0
星屑
29901
在线时间
5734 小时
注册时间
2016-3-8
回帖
1653
发表于 2020-10-15 18:39:15 | 显示全部楼层
本帖最后由 alexncf125 于 2020-10-15 18:56 编辑

二擇其一
特殊文字代码# \fn[fontname] - Change the font to fontname. If you put multiple fontnames
#     separated by commas, then it will take the first one the user has installed
[pre lang="ruby"]#==============================================================================
#    ATS: Special Message Codes [VXA]
#    Version: 1.0.6
#    Author: modern algebra (rmrk.net)
#    Date: 18 October 2012
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This script allows you to use a number of additional special codes in the
#   message system, which will function similar to the default codes like
#   \v[n], \c[n], etc. Please see the list of special message codes starting at
#   line 54 for a full idea of what is added. Basically, it gives you greater
#   control over the delivery of a message, allows you to make use of font
#   effects like bolding and italicizing, and allows you to retrieve and
#   display useful data like the names of weapons and armors.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  ATS Series:
#
#    This script is part of the Advanced Text System series of scripts. These
#   scripts are based off the Advanced Text System for RMVX, but since RMVX Ace
#   has a much more sensibly designed message system, it is no longer necessary
#   that it be one large script. For that reason, and responding to feedback on
#   the ATS, I have split the ATS into multiple different scripts so that you
#   only need to pick up the components for the features that you want. It is
#   therefore easier to customize and configure.
#
#    To find more scripts in the ATS Series, please visit:
#      http://rmrk.net/index.php/topic,44525.0.html
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    This script is not difficult to use or configure. There are only ten
#   configuration options for this script. These are:
#
#      :message_speed               :font_italic
#      :show_fast_speed             :font_outline
#      :font_name                   :font_shadow
#      :font_size                   :font_underline
#      :font_bold                   :font_highlight
#
#   :message_speed allows you to set the default number of frames to wait
#   between drawing each letter in the message window. :show_fast_speed allows
#   you to control the amount it speeds up when the player presses enter. You
#   can gain instructions on setting the default value for both at line 180.
#
#   All of the :font_ settings simply let you set the initial values for the
#   font when used.
#
#    As with other ATS scripts, you can change the value of these options in
#   game with the following codes in a script call:
#
#      ats_next(:message_option, x)
#      ats_all(:message_option, x)
#
#   Where :message_option is the symbol you want (:message_speed or
#   :show_fast_speed) and x is the value you want to change it to. ats_next
#   will only change it for the very next message, while ats_all will change it
#   for every message to follow.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  List of Special Message Codes:
#
#    The default message codes are retained, and this script adds a number of
#   other desirable features. The following is a complete list of the message
#   codes at your disposal. Simply insert them into a Display Message command,
#   Choice Branches, or any other message related system.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Font Effects:
#
# \fn[fontname] - Change the font to fontname. If you put multiple fontnames
#     separated by commas, then it will take the first one the user has installed
# \fs[n] - Change the font size to n.
# \{ - Increase the font size by 8.
# \} - Decrease the font size by 8.
# \c[n] - Set the colour of the text being drawn to the nth colour of the
#     Windowskin palette. 0 is the normal color and 16 is the system color.
# \hc[RRGGBB] or \c[#RRGGBB] - Set the colour of the text being drawn to any
#     colour, using hexadecimal values. You can set each colour (red, green,
#     blue) to anything from 0-255 (00-FF). You must use hexadecimal values. If
#     so desired, you can add an additional hex value from 00-FF to change the
#     alpha.
# \bn     - Turn bold on. Text drawn after this code will be bolded.
# /bf     - Turn bold off.
# \i     - Turn italic on. Text drawn after this code will be italicized.
# /i     - Turn italic off.
# \o     - Turn outline on.
# /o     - Turn outline off.
# \s     - Turn shadow on. Text drawn after this code will have a shadow.
# /s     - Turn shadow off.
# \u     - Turn underline on. Text drawn after this code will be underlined.
# /u     - Turn underline off.
# \hl[n] - Turn highlight on. Text drawn after this code will be highlighted
#     with colour n + 1 from the windowskin palette
# /hl OR \hl[0] - Turn highlight off.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Message Control:
#
# \s[n] - Sets the message speed to wait n frames between drawing every letter.
#     0 is instant.
# \s[+n] - Sets the message speed to wait an additional n frames between drawing
#     every letter.
# \s[-n] - Sets the message speed to wait n less frames between drawing every
#     letter.
# \. - Wait 15 frames before drawing the next character
# \| - Wait 60 frames before drawing the next character
# \w[n] - Wait n frames before drawing the next character
# \! - Pause text and wait for player to press Enter
# \^ - Skip Pause; allows you to close a message window without requiring player
#     input.
# \> - Show line fast.
# \< - Stop showing line fast.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Replacement Codes:
#
# \p[n] - Draw the name of the actor in the xth position in the party. 1 is
#     the party leader, 2 is the second member, etc.
# \n[n] - Draw the name of the actor with ID n
# \nn[n] - Draw the nickname of the actor with ID n.
# \pid[n] - Draw the ID of the actor in the nth position in the party.
# \ac[n] - Draw the class name of the actor with ID n.
# \al[n] - Draw the level of the actor with ID n.
# \ni[n] - Draw the name of the item with ID n.
# \nw[n] - Draw the name of the weapon with ID n.
# \na[n] - Draw the name of the armor with ID n.
# \ns[n] - Draw the name of the skill with ID n.
# \nt[n] - Draw the name of the state with ID n.
# \nc[n] - Draw the name of the class with ID n.
# \ne[n] - Draw the name of the event with ID n on the current map.
# \nm[n] - Draw the name of the enemy with ID n.
# \nv[n] - Draw the name of the variable with ID n.
# \nsw[n] - Draw the name of the switch with ID n.
# \nl[n] - Draw the name of the element with ID n.
# \nwt[n] - Draw the name of the weapon type with ID n.
# \nat[n] - Draw the name of the armor type with ID n.
# \nst[n] - Draw the name of the skill type with ID n.
# \np[n] - Draw the name of the actor in the nth position in the party.
# \map   - Draw the name of the map the player is currently on.
# \map[n] - Draw the name of the map with ID n.
# \pg - Draws the amount of money the party has.
# \g - Draws the unit of currency.
# \vocab[method] - Will draw whatever Vocab.method returns, if it is a valid
#     method call. Suitable values for method are: level, level_a, hp, hp_a,
#     mp, mp_a, tp, tp_a, fight, escape, attack, guard, item, skill, equip,
#     status, formation, save, game_end, weapon, armor, key_item, equip2,
#     optimize, clear, new_game, continue, shutdown, to_title, cancel,
#     currency_unit
# \vocab[param, n] - Will draw the label for parameter with ID n. 0 => Max HP;
#     1 => Max MP; 2 => Attack; 3 => Defence; 4 => Magic; 5 => Magic Defence;
#     6 => Agility; 7 => Luck
# \vocab[etype, n] - Will draw the label for equipment type with ID n.
#     0 => Weapon; 1 => Shield; 2 => Head; 3 => Body; 4 => Accessory
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Other Effects:
#
# \$ - Opens a window which shows the party's gold.
# \lb - line break
# \i[n] - Draw icon with index n.
# \ii[n] - Draw icon of the item with ID n.
# \iw[n] - Draw icon of the weapon with ID n.
# \ia[n] - Draw icon of the armor with ID n.
# \is[n] - Draw icon of the skill with ID n.
# \it[n] - Draw icon of the state with ID n.
# \x[n] - Draw next character at pixel n of the window contents.
# \s{n,text} - Will only draw text if the switch with ID n is ON.
# \s!{n,text} - Will only draw text if the switch with ID n is OFF.
# \#{code} - This will evaluate code. So, if you know scipting, you can place
#     any code there and it will draw whatever is returned by it. For instance:
#     \#{$game_system.save_count} would draw the number of times the player has
#     saved the current game.
#==============================================================================

$imported = {} unless $imported
$imported[:ATS_SpecialMessageCodes] = true

#==============================================================================
# ** Game_ATS
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new public instance variables - message_speed; special_message_codes
#==============================================================================

class Game_ATS
  CONFIG = {} unless $imported[:AdvancedTextSystem]
  CONFIG[:special_message_codes] = {
    special_message_codes: true,
    #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    #  EDITABLE REGION
    #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
    #   :message_speed => x,
    #      Changing the value of x determines the default number of frames to
    #     wait between drawing letters in a message window. 0 is instant.
    :message_speed =>   1,
    #   :show_fast_speed => x
    #      Changing the value of x determines the number of frames to wait
    #     between drawing letters when the player is holding enter. 0 is
    #     instant
      :show_fast_speed => 0,
    # Font Settings - Set the default settings for the font you are using here.
    :font_name => Font.default_name,       # String or Array of Strings
    :font_size => Font.default_size,       # Integer
    :font_bold => Font.default_bold,       # true or false
    :font_italic => Font.default_italic,   # true or false
    :font_outline => Font.default_outline, # true or false
    :font_shadow => Font.default_shadow,   # true or false
    :font_underline => false,              # true or false
    :font_highlight => -1,                 # Integer for colour of highlight
    #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
    #  END EDITABLE REGION
    #////////////////////////////////////////////////////////////////////////
  }
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  CONFIG[:special_message_codes].keys.each { |key| attr_accessor key }
end

#==============================================================================
#  Initialize Common ATS Data if no other ATS script interpreted first
#==============================================================================

if !$imported[:AdvancedTextSystem]
  #============================================================================
  # *** DataManager
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  Summary of Changes:
  #    aliased method - create_game_objects; make_save_contents;
  #      extract_save_contents
  #============================================================================
  module DataManager
    class << self
      #--------------------------------------------------------------------------
      # * Create Game Objects
      #--------------------------------------------------------------------------
      alias modb_ats_crtgmobj_6yh7 create_game_objects
      def create_game_objects(*args, &block)
        modb_ats_crtgmobj_6yh7(*args, &block)
        $game_ats = Game_ATS.new
        $game_ats.init_new_installs
      end
      #--------------------------------------------------------------------------
      # * Make Save Contents
      #--------------------------------------------------------------------------
      alias mlba_ats_mksave_5tg9 make_save_contents
      def make_save_contents(*args, &block)
        contents = mlba_ats_mksave_5tg9(*args, &block)
        contents[:ats] = $game_ats
        contents
      end
      #--------------------------------------------------------------------------
      # * Extract Save Contents
      #--------------------------------------------------------------------------
      alias ma_ats_extrcsvcon_8uj2 extract_save_contents
      def extract_save_contents(contents, *args, &block)
        ma_ats_extrcsvcon_8uj2(contents, *args, &block)
        $game_ats = contents[:ats] ? contents[:ats] : Game_ATS.new
        $game_ats.init_new_installs
      end
    end
  end

  #============================================================================
  # ** Game_ATS
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  This class holds the default data for all scripts in the ATS series
  #============================================================================

  class Game_ATS
    def initialize; reset; end
    #--------------------------------------------------------------------------
    # * Reset any or all installed ATS scripts
    #--------------------------------------------------------------------------
    def reset(script_name = nil)
      if script_name.is_a? (Symbol) # If script to reset specified
        CONFIG[script_name].each_pair { |key, value|
          self.send("#{key}=".to_sym, value)
          $game_message.send("#{key}=".to_sym, value)
        }
      else                          # Reset all ATS scripts
        CONFIG.keys.each { |script| reset(script) }
      end
    end
    #--------------------------------------------------------------------------
    # * Initialize any newly installed ATS scripts
    #--------------------------------------------------------------------------
    def init_new_installs
      CONFIG.keys.each { |script| reset(script) unless self.send(script) }
    end
  end

  #============================================================================
  # ** Game_Message
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  Summary of Changes:
  #    aliased method - clear
  #============================================================================

  class Game_Message
    #--------------------------------------------------------------------------
    # * Clear
    #--------------------------------------------------------------------------
    alias mlb_ats_clrats_5tv1 clear
    def clear(*args, &block)
      mlb_ats_clrats_5tv1(*args, &block) # Run Original Method
      return if !$game_ats
      Game_ATS::CONFIG.values.each { |installed|
        installed.keys.each { |key| self.send("#{key}=".to_sym, $game_ats.send(key)) }
      }
    end
  end

  #============================================================================
  # ** Game_Interpreter
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  Summary of Changes:
  #    new methods - ats_all; ats_next
  #============================================================================

  class Game_Interpreter
    #--------------------------------------------------------------------------
    # * ATS All
    #--------------------------------------------------------------------------
    def ats_all(sym, *args, &block)
      $game_ats.send("#{sym}=".to_sym, *args, &block)
      ats_next(sym, *args, &block)
    end
    #--------------------------------------------------------------------------
    # * ATS Next
    #--------------------------------------------------------------------------
    def ats_next(sym, *args, &block)
      $game_message.send("#{sym}=".to_sym, *args, &block)
    end
  end
end

$imported[:AdvancedTextSystem] = true

class Game_Message
  Game_ATS::CONFIG[:special_message_codes].keys.each { |key| attr_accessor key }
end

#==============================================================================
# ** Game_Event
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - name
#==============================================================================

class Game_Event
  def name
    return @event ? @event.name : ""
  end
end

#==============================================================================
# ** Window_Base
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - initialize; convert_escape_characters; calc_line_height;
#      process_escape_character; process_normal_character
#==============================================================================

class Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias mlgb_atssmc_init_3do9 initialize
  def initialize(*args, &block)
    mlgb_atssmc_init_3do9(*args, &block) # Run Original Method
    @underline = false
    @highlight = -1
  end
  #--------------------------------------------------------------------------
  # * Convert Escape Characters
  #--------------------------------------------------------------------------
  alias ma_atssmc_convesc_4rc1 convert_escape_characters
  def convert_escape_characters(text, *args, &block)
    result = ma_atssmc_convesc_4rc1(text, *args, &block) # Run Original Method
    # Party
    result.gsub!(/\ePID\[(\d+)\]/i) { $1.to_i >= 1 ? $game_party.members[$1.to_i - 1].id.to_s : "1" }
    result.gsub!(/\ePG/i) { $game_party.gold }
    # Message Speed
    result.gsub!(/\eS\[([\+-]?\d+)\]/i) { "\eMS\[#{$1}\]" }
    result.gsub!(/\e%/)             { "\eDS%"}
    # Hex Colour
    result.gsub!(/\eC\[#/i)         { "\eHC[" }
    # Icons
    result.gsub!(/\eII\[(\d+)\]/i)  { "\eI\[#{$data_items[$1.to_i].icon_index}\]" rescue "" }
    result.gsub!(/\eIW\[(\d+)\]/i)  { "\eI\[#{$data_weapons[$1.to_i].icon_index}\]" rescue "" }
    result.gsub!(/\eIA\[(\d+)\]/i)  { "\eI\[#{$data_armors[$1.to_i].icon_index}\]" rescue "" }
    result.gsub!(/\eIS\[(\d+)\]/i)  { "\eI\[#{$data_skills[$1.to_i].icon_index}\]" rescue "" }
    result.gsub!(/\eIT\[(\d+)\]/i)  { "\eI\[#{$data_states[$1.to_i].icon_index}\]" rescue "" }
    # Actor Stats
    result.gsub!(/\eAC\[(\d+)\]/i)  { $data_classes[$game_actors[$1.to_i].class_id].name }
    result.gsub!(/\eAL\[(\d+)\]/i)  { $game_actors[$1.to_i].level.to_s }
    # Names
    result.gsub!(/\eMAP\[(\d+)\]/i) { load_data(sprintf("Data/Map%03d.rvdata2", $1.to_i)).display_name rescue "" }
    result.gsub!(/\eMAP/i)          { $game_map.display_name rescue "" }
    result.gsub!(/\eNP\[(\d+)\]/i)  { $game_party.members[$1.to_i].name rescue "" }
    result.gsub!(/\eNE\[(\d+)\]/i)  { $game_map.events[$1.to_i].name rescue "" }
    result.gsub!(/\eNN\[(\d+)\]/i)  { $game_actors[$1.to_i].nickname rescue "" }
    result.gsub!(/\eNI\[(\d+)\]/i)  { $data_items[$1.to_i].name rescue "" }
    result.gsub!(/\eNW\[(\d+)\]/i)  { $data_weapons[$1.to_i].name rescue "" }
    result.gsub!(/\eNA\[(\d+)\]/i)  { $data_armors[$1.to_i].name rescue "" }
    result.gsub!(/\eNS\[(\d+)\]/i)  { $data_skills[$1.to_i].name rescue "" }
    result.gsub!(/\eNT\[(\d+)\]/i)  { $data_states[$1.to_i].name rescue "" }
    result.gsub!(/\eNM\[(\d+)\]/i)  { $data_enemies[$1.to_i].name rescue "" }
    result.gsub!(/\eNC\[(\d+)\]/i)  { $data_classes[$1.to_i].name rescue "" }
    result.gsub!(/\eNV\[(\d+)\]/i)  { $data_system.variables[$1.to_i] }
    result.gsub!(/\eNSW\[(\d+)\]/i) { $data_system.switches[$1.to_i] }
    result.gsub!(/\eNWT\[(\d+)\]/i) { $data_system.weapon_types[$1.to_i] }
    result.gsub!(/\eNAT\[(\d+)\]/i) { $data_system.armor_types[$1.to_i] }
    result.gsub!(/\eNST\[(\d+)\]/i) { $data_system.skill_types[$1.to_i] }
    result.gsub!(/\eNL\[(\d+)\]/i)  { $data_system.elements[$1.to_i] }
    # Vocab
    result.gsub!(/\eVOCAB\[(\w+),\s*(\d+)\s*\]/i) { Vocab.send($1.downcase, $2.to_i) rescue "" }
    result.gsub!(/\eVOCAB\[(\w+)\]/i) { Vocab.send($1.downcase) rescue "" }
    # Font Settings
    result.gsub!(/\eBN/i)            { "\eFE[0]" } # Bold On
    result.gsub!(/\/BF/i)            { "\eFE[1]" } # Bold Off
    result.gsub!(/\eI([^\[])/i)     { "\eFE[2]#{$1}" } # Italics On
    result.gsub!(/\/I/i)            { "\eFE[3]" } # Italics Off
    result.gsub!(/\eO/i)            { "\eFE[4]" } # Outline On
    result.gsub!(/\/O/i)            { "\eFE[5]" } # Outline Off
    result.gsub!(/\eS([^\[!])/i)    { "\eFE[6]#{$1}" } # Shadow On
    result.gsub!(/\/S/i)            { "\eFE[7]" } # Shadow Off
    result.gsub!(/\eU/i)            { "\eFE[8]" } # Underline On
    result.gsub!(/\/U/i)            { "\e\FE[9]" } # Underline Off
    result.gsub!(/\eHL\[(\d+)\]/i)  { "\eHL[#{$1.to_i}]" } # Highlight On: custom colour
    result.gsub!(/\eHL([^\[])/i)    { "\eHL[17]#{$1}" }# Highlight On: system colour
    result.gsub!(/\/HL/i)           { "\eHL[0]" } # Hightlight Off
    result.gsub!(/\/FN/i)           { "\eFN[]" }  # Default Font
    result.gsub!(/\/FS/i)           { "\eFS[#{Font.default_size}]" } # Default Font
    # Conditional Text
    result.gsub!(/\eS\[(\d+)[,;:](.+?)\]/mi) { $game_switches[$1.to_i] ? $2 : "" }
    result.gsub!(/\eS!\[(\d+)[,;:](.+?)\]/mi) { $game_switches[$1.to_i] ? "" : $2 }
    result.gsub!(/\eS\{(\d+)[,;:](.+?)\}/mi) { $game_switches[$1.to_i] ? $2 : "" }
    result.gsub!(/\eS!\{(\d+)[,;:](.+?)\}/mi) { $game_switches[$1.to_i] ? "" : $2 }
    # Evaluation
    result.gsub!(/\e#\{(.+?)\}/im)  { (eval($1)).to_s rescue "" }
    # Do resubstitutions if requested
    if result.sub!(/\eRESUB/i, "") != nil
      result = convert_escape_characters(result, *args, &block)
    end
    result.gsub!(/\eLB/i, "\n") # Line Break
    result # Return result
  end
  #--------------------------------------------------------------------------
  # * Calculate Line Height
  #--------------------------------------------------------------------------
  alias ma_atssmc_clclnhght_3ek9 calc_line_height
  def calc_line_height(text, *args, &block)
    res = ma_atssmc_clclnhght_3ek9(text, *args, &block) # Run Original Method
    text.slice(/^.*$/).scan(/\eFS\[(\d+)\]/i) { |num| res = [res, num[0].to_i].max }
    res
  end
  #--------------------------------------------------------------------------
  # * Process Normal Character
  #--------------------------------------------------------------------------
  alias mlra_atssmc_procnorm_5fg2 process_normal_character
  def process_normal_character(c, pos, *args, &block)
    draw_highlight_underline(c, pos) if @underline || @highlight
    mlra_atssmc_procnorm_5fg2(c, pos, *args, &block) # Run Original Method
  end
  #--------------------------------------------------------------------------
  # * Process Escape Character
  #--------------------------------------------------------------------------
  alias ma_atssmc_procesc_7gv1 process_escape_character
  def process_escape_character(code, text, pos, *args, &block)
    case code.upcase
    when 'X' then pos[:x] = obtain_escape_param(text)
    when 'HC' # Hex Colour
      hex = text.slice!(/^\[([ABCDEF\d]+)\]/i)
      rgb = $1.scan(/../).map { |hex| hex.to_i(16) }
      change_color(Color.new(*rgb)) if rgb.size.between?(3,4)
    when 'FE' # Font Settings
      param = obtain_escape_param(text)
      case param / 2
      when 0 then contents.font.bold = ((param % 2) == 0)     # Bold
      when 1 then contents.font.italic = ((param % 2) == 0)   # Italic
      when 2 then contents.font.outline = ((param % 2) == 0)  # Outline
      when 3 then contents.font.shadow = ((param % 2) == 0)   # Shadow
      when 4 then @underline = ((param % 2) == 0)             # Underline
      end
    when 'HL' then @highlight = obtain_escape_param(text) - 1 # Highlight
    when 'FN' # Font Name
      text.slice!(/^\[(.*?\])/)
      param = $1
      if param.nil? || param == ']'
        contents.font.name = Font.default_name
      else
        ary = []
        while param.slice!(/\s*(.+?)\s*[,;:\]]/) != nil do ary.push($1) end
        contents.font.name = ary
      end
    when 'FS' # Font Size
      text.slice!(/^\[(\d+)\]/)
      contents.font.size = [[$1.to_i, 16].max, 64].min
    else
      ma_atssmc_procesc_7gv1(code, text, pos, *args, &block) # Run Original Method
    end
  end
  #--------------------------------------------------------------------------~
  # * Draw Highlighting and Underlining
  #--------------------------------------------------------------------------~
  def draw_highlight_underline(c, pos)
    text_width = text_size(c).width
    y_space = (pos[:height] - contents.font.size) / 2
    if @underline      # Underlining
      y = pos[:y] + pos[:height]
      y -= [2, y_space].max
      contents.fill_rect(pos[:x], y, text_width, 2, contents.font.color)
    end
    if @highlight >= 0 # Highlighting
      y = pos[:y]
      y += y_space - 1 if y_space > 0
      text_height = [contents.font.size + 2, pos[:height]].min
      colour = text_color(@highlight)
      colour.alpha = 128 if colour.alpha > 128
      contents.fill_rect(pos[:x], y, text_width, text_height, colour)
    end
  end
end

#===============================================================================
# ** Window_Message
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - clear_instance_variables; process_escape_character;
#      update_show_fast; wait_for_one_character
#    overwritten super method - reset_font_settings
#===============================================================================

class Window_Message
  #--------------------------------------------------------------------------~
  # * Clear Instance Variables
  #--------------------------------------------------------------------------~
  alias ma_atssmc_clrinsvar_3dq9 clear_instance_variables
  def clear_instance_variables(*args, &block)
    ma_atssmc_clrinsvar_3dq9(*args, &block) # Run Original Method
    @skip_disabled = false
  end
  #--------------------------------------------------------------------------~
  # * Reset Font Settings
  #--------------------------------------------------------------------------~
  def reset_font_settings(*args, &block)
    change_color(normal_color)
    contents.font.name = $game_message.font_name
    contents.font.size = $game_message.font_size
    contents.font.bold = $game_message.font_bold
    contents.font.italic = $game_message.font_italic
    contents.font.outline = $game_message.font_outline
    contents.font.shadow = $game_message.font_shadow
    @underline = $game_message.font_underline
    @highlight = $game_message.font_highlight
  end
  #--------------------------------------------------------------------------~
  # * Process Escape Character
  #--------------------------------------------------------------------------~
  alias mnaa_atssmc_escchar_3dr9 process_escape_character
  def process_escape_character(code, text, pos, *args, &block)
    case code.upcase
    when 'MS' # Set Message Speed
      if !text[/^\[([+-])/].nil?
        text.sub!(/^\[([\+-])/, '[' )
        sign = $1
      else
        sign = ""
      end
      param = obtain_escape_param(text)
      sign.empty? ? $game_message.message_speed = param : $game_message.message_speed += "#{sign}#{param}".to_i
      when 'DS'
        text.slice!(/^%/) # Delete buffer to ensure code isn't overextended
        @skip_disabled = !@skip_disabled
      when 'W' then wait(obtain_escape_param(text))
    else
      mnaa_atssmc_escchar_3dr9(code, text, pos, *args, &block) # Run Original Method
    end
  end
  #--------------------------------------------------------------------------~
  # * Update Show Fast
  #--------------------------------------------------------------------------~
  alias mlg_atssmc_updshwfast_7yb1 update_show_fast
  def update_show_fast(*args, &block)
    mlg_atssmc_updshwfast_7yb1(*args, &block)
    if $game_message.message_speed < 1
      @show_fast = true
    elsif @skip_disabled
      @show_fast = false
    elsif $game_message.show_fast_speed > 0
      @show_fast = Input.press?(:C)
    end
  end
  #--------------------------------------------------------------------------~
  # * Wait for One Character
  #--------------------------------------------------------------------------~
  alias mdrnl_smcats_waitonechar_5rf1 wait_for_one_character
  def wait_for_one_character(*args, &block)
    mdrnl_smcats_waitonechar_5rf1(*args, &block) # Run Original Method
    if (@show_fast || @line_show_fast) && $game_message.show_fast_speed > 0
      wait($game_message.show_fast_speed)
    elsif $game_message.message_speed > 1
      wait($game_message.message_speed - 1)
    end
  end
end[/pre]


YEA对话系统\fn[x]    - Changes font name to x.
[pre lang="ruby"]#==============================================================================
#
# ▼ Yanfly Engine Ace - Ace Message System v1.05
# -- Last Updated: 2012.01.13
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-MessageSystem"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.07.21 - Fixed REGEXP error at line 824
# 2012.01.13 - Bug Fixed: Negative tags didn't display other party members.
# 2012.01.12 - Compatibility Update: Message Actor Codes
# 2012.01.10 - Added Feature: \pic[x] text code.
# 2012.01.04 - Bug Fixed: \ic tag was \ii. No longer the case.
#            - Added: Scroll Text window now uses message window font.
# 2011.12.31 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# While RPG Maker VX Ace certainly improved the message system a whole lot, it
# wouldn't hurt to add in a few more features, such as name windows, converting
# textcodes to write out the icons and/or names of items, weapons, armours, and
# more in quicker fashion. This script also gives the developer the ability to
# adjust the size of the message window during the game, give it a separate
# font, and to give the player a text fast-forward feature.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Message Window text Codes - These go inside of your message window.
# -----------------------------------------------------------------------------
#  Default:    Effect:
#    \v[x]     - Writes variable x's value.
#    \n[x]     - Writes actor x's name.
#    \p[x]     - Writes party member x's name.
#    \g        - Writes gold currency name.
#    \c[x]     - Changes the colour of the text to x.
#    \i[x]     - Draws icon x at position of the text.
#    \{        - Makes text bigger by 8 points.
#    \}        - Makes text smaller by 8 points.
#    \$        - Opens gold window.
#    \.        - Waits 15 frames (quarter second).
#    \|        - Waits 60 frames (a full second).
#    \!        - Waits until key is pressed.
#    \>        - Following text is instant.
#    \<        - Following text is no longer instant.
#    \^        - Skips to the next message.
#    \\        - Writes a "\" in the window.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
#  Wait:       Effect:
#    \w[x]     - Waits x frames (60 frames = 1 second). Message window only.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
#  NameWindow: Effect:
#    \n<x>     - Creates a name box with x string. Left side. *Note
#    \nc<x>    - Creates a name box with x string. Centered. *Note
#    \nr<x>    - Creates a name box with x string. Right side. *Note
#
#              *Note: Works for message window only.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
#  Position:   Effect:
#    \px[x]    - Sets x position of text to x.
#    \py[x]    - Sets y position of text to y.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
#  Picture:    Effect:
#    \pic[x]   - Draws picture x from the Graphics\Pictures folder.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
#  Outline:    Effect:
#    \oc[x]    - Sets outline colour to x.
#    \oo[x]    - Sets outline opacity to x.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
#  Font:       Effect:
#    \fr       - Resets all font changes.
#    \fz[x]    - Changes font size to x.
#    \fn[x]    - Changes font name to x.
#    \fb       - Toggles font boldness.
#    \fi       - Toggles font italic.
#    \fo       - Toggles font outline.
#    \fs       - Toggles font shadow.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
#  Actor:      Effect:
#    \af[x]    - Shows face of actor x. *Note
#    \ac[x]    - Writes out actor's class name. *Note
#    \as[x]    - Writes out actor's subclass name. Req: Class System. *Note
#    \an[x]    - Writes out actor's nickname. *Note
#
#              *Note: If x is 0 or negative, it will show the respective
#               party member's face instead.
#                   0 - Party Leader
#                  -1 - 1st non-leader member.
#                  -2 - 2nd non-leader member. So on.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
#  Names:      Effect:
#    \nc[x]    - Writes out class x's name.
#    \ni[x]    - Writes out item x's name.
#    \nw[x]    - Writes out weapon x's name.
#    \na[x]    - Writes out armour x's name.
#    \ns[x]    - Writes out skill x's name.
#    \nt[x]    - Writes out state x's name.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
#  Icon Names: Effect:
#    \ic[x]    - Writes out class x's name including icon. *
#    \ii[x]    - Writes out item x's name including icon.
#    \iw[x]    - Writes out weapon x's name including icon.
#    \ia[x]    - Writes out armour x's name including icon.
#    \is[x]    - Writes out skill x's name including icon.
#    \it[x]    - Writes out state x's name including icon.
#
#              *Note: Requires YEA - Class System
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# And those are the text codes added with this script. Keep in mind that some
# of these text codes only work for the Message Window. Otherwise, they'll work
# for help descriptions, actor biographies, and others.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================

module YEA
  module MESSAGE
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - General Message Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # The following below will adjust the basic settings and that will affect
    # the majority of the script. Adjust them as you see fit.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # This button is the button used to make message windows instantly skip
    # forward. Hold down for the effect. Note that when held down, this will
    # speed up the messages, but still wait for the pauses. However, it will
    # automatically go to the next page when prompted.
    TEXT_SKIP = :A     # Input::A is the shift button on keyboard.
   
    # This variable adjusts the number of visible rows shown in the message
    # window. If you do not wish to use this feature, set this constant to 0.
    # If the row value is 0 or below, it will automatically default to 4 rows.
    VARIABLE_ROWS  = 0
   
    # This variable adjusts the width of the message window shown. If you do
    # not wish to use this feature, set this constant to 0. If the width value
    # is 0 or below, it will automatically default to the screen width.
    VARIABLE_WIDTH = 0
   
    # This is the amount of space that the message window will indent whenever
    # a face is used. Default: 112
    FACE_INDENT_X = 112
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Name Window Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # The name window is a window that appears outside of the main message
    # window box to display whatever text is placed inside of it like a name.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    NAME_WINDOW_X_BUFFER = -20     # Buffer x position of the name window.
    NAME_WINDOW_Y_BUFFER = 0       # Buffer y position of the name window.
    NAME_WINDOW_PADDING  = 20      # Padding added to the horizontal position.
    NAME_WINDOW_OPACITY  = 255     # Opacity of the name window.
    NAME_WINDOW_COLOUR   = 6       # Text colour used by default for names.
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Message Font Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # Ace Message System separates the in-game system font form the message
    # font. Adjust the settings here for your fonts.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # This array constant determines the fonts used. If the first font does not
    # exist on the player's computer, the next font in question will be used
    # in place instead and so on.
    MESSAGE_WINDOW_FONT_NAME = ["Microsoft YaHei"]
   
    # These adjust the other settings regarding the way the game font appears
    # including the font size, whether or not the font is bolded by default,
    # italic by default, etc.
    MESSAGE_WINDOW_FONT_SIZE    = 24       # Font size.
    MESSAGE_WINDOW_FONT_BOLD    = false    # Default bold?
    MESSAGE_WINDOW_FONT_ITALIC  = false    # Default italic?
    MESSAGE_WINDOW_FONT_OUTLINE = true     # Default outline?
    MESSAGE_WINDOW_FONT_SHADOW  = false    # Default shadow?
   
  end # MESSAGE
end # YEA

#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================

#==============================================================================
# ■ Variable
#==============================================================================

module Variable
  
  #--------------------------------------------------------------------------
  # self.message_rows
  #--------------------------------------------------------------------------
  def self.message_rows
    return 4 if YEA::MESSAGE::VARIABLE_ROWS <= 0
    return 4 if $game_variables[YEA::MESSAGE::VARIABLE_ROWS] <= 0
    return $game_variables[YEA::MESSAGE::VARIABLE_ROWS]
  end
  
  #--------------------------------------------------------------------------
  # self.message_width
  #--------------------------------------------------------------------------
  def self.message_width
    return Graphics.width if YEA::MESSAGE::VARIABLE_WIDTH <= 0
    return Graphics.width if $game_variables[YEA::MESSAGE::VARIABLE_WIDTH] <= 0
    return $game_variables[YEA::MESSAGE::VARIABLE_WIDTH]
  end
  
end # Variable

#==============================================================================
# ■ Game_Interpreter
#==============================================================================

class Game_Interpreter
  
  #--------------------------------------------------------------------------
  # overwrite method: command_101
  #--------------------------------------------------------------------------
  def command_101
    wait_for_message
    $game_message.face_name = @params[0]
    $game_message.face_index = @params[1]
    $game_message.background = @params[2]
    $game_message.position = @params[3]
    while continue_message_string?
      @index += 1
      if @list[@index].code == 401
        $game_message.add(@list[@index].parameters[0])
      end
      break if $game_message.texts.size >= Variable.message_rows
    end
    case next_event_code
    when 102
      @index += 1
      setup_choices(@list[@index].parameters)
    when 103
      @index += 1
      setup_num_input(@list[@index].parameters)
    when 104
      @index += 1
      setup_item_choice(@list[@index].parameters)
    end
    wait_for_message
  end
  
  #--------------------------------------------------------------------------
  # new method: continue_message_string?
  #--------------------------------------------------------------------------
  def continue_message_string?
    return true if next_event_code == 101 && Variable.message_rows > 4
    return next_event_code == 401
  end
  
end # Game_Interpreter

#==============================================================================
# ■ Window_Base
#==============================================================================

class Window_Base < Window
  
  #--------------------------------------------------------------------------
  # new method: setup_message_font
  #--------------------------------------------------------------------------
  def setup_message_font
    @message_font = true
    change_color(normal_color)
    contents.font.out_color = Font.default_out_color
    contents.font.name = YEA::MESSAGE::MESSAGE_WINDOW_FONT_NAME
    contents.font.size = YEA::MESSAGE::MESSAGE_WINDOW_FONT_SIZE
    contents.font.bold = YEA::MESSAGE::MESSAGE_WINDOW_FONT_BOLD
    contents.font.italic = YEA::MESSAGE::MESSAGE_WINDOW_FONT_ITALIC
    contents.font.outline = YEA::MESSAGE::MESSAGE_WINDOW_FONT_OUTLINE
    contents.font.shadow = YEA::MESSAGE::MESSAGE_WINDOW_FONT_SHADOW
  end
  
  #--------------------------------------------------------------------------
  # alias method: reset_font_settings
  #--------------------------------------------------------------------------
  alias window_base_reset_font_settings_ams reset_font_settings
  def reset_font_settings
    if @message_font
      setup_message_font
    else
      window_base_reset_font_settings_ams
      contents.font.out_color = Font.default_out_color
      contents.font.outline = Font.default_outline
      contents.font.shadow = Font.default_shadow
    end
  end
  
  #--------------------------------------------------------------------------
  # alias method: convert_escape_characters
  #--------------------------------------------------------------------------
  alias window_base_convert_escape_characters_ams convert_escape_characters
  def convert_escape_characters(text)
    result = window_base_convert_escape_characters_ams(text)
    result = convert_ace_message_system_new_escape_characters(result)
    return result
  end
  
  #--------------------------------------------------------------------------
  # new method: convert_ace_message_system_new_escape_characters
  #--------------------------------------------------------------------------
  def convert_ace_message_system_new_escape_characters(result)
    #---
    result.gsub!(/\eFR/i) { "\eAMSF[0]" }
    result.gsub!(/\eFB/i) { "\eAMSF[1]" }
    result.gsub!(/\eFI/i) { "\eAMSF[2]" }
    result.gsub!(/\eFO/i) { "\eAMSF[3]" }
    result.gsub!(/\eFS/i) { "\eAMSF[4]" }
    #---
    result.gsub!(/\eAC\[([-+]?\d+)\]/i) { escape_actor_class_name($1.to_i) }
    result.gsub!(/\eAS\[([-+]?\d+)\]/i) { escape_actor_subclass_name($1.to_i) }
    result.gsub!(/\eAN\[([-+]?\d+)\]/i) { escape_actor_nickname($1.to_i) }
    #---
    result.gsub!(/\eNC\[(\d+)\]/i) { $data_classes[$1.to_i].name }
    result.gsub!(/\eNI\[(\d+)\]/i) { $data_items[$1.to_i].name }
    result.gsub!(/\eNW\[(\d+)\]/i) { $data_weapons[$1.to_i].name }
    result.gsub!(/\eNA\[(\d+)\]/i) { $data_armors[$1.to_i].name }
    result.gsub!(/\eNS\[(\d+)\]/i) { $data_skills[$1.to_i].name }
    result.gsub!(/\eNT\[(\d+)\]/i) { $data_states[$1.to_i].name }
    #---
    result.gsub!(/\eIC\[(\d+)\]/i) { escape_icon_item($1.to_i, :class) }
    result.gsub!(/\eII\[(\d+)\]/i) { escape_icon_item($1.to_i, :item) }
    result.gsub!(/\eIW\[(\d+)\]/i) { escape_icon_item($1.to_i, :weapon) }
    result.gsub!(/\eIA\[(\d+)\]/i) { escape_icon_item($1.to_i, :armour) }
    result.gsub!(/\eIS\[(\d+)\]/i) { escape_icon_item($1.to_i, :skill) }
    result.gsub!(/\eIT\[(\d+)\]/i) { escape_icon_item($1.to_i, :state) }
    #---
    return result
  end
  
  #--------------------------------------------------------------------------
  # new method: escape_actor_class_name
  #--------------------------------------------------------------------------
  def escape_actor_class_name(actor_id)
    actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
    actor = $game_actors[actor_id]
    return "" if actor.nil?
    return actor.class.name
  end
  
  #--------------------------------------------------------------------------
  # new method: actor_subclass_name
  #--------------------------------------------------------------------------
  def escape_actor_subclass_name(actor_id)
    return "" unless $imported["YEA-ClassSystem"]
    actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
    actor = $game_actors[actor_id]
    return "" if actor.nil?
    return "" if actor.subclass.nil?
    return actor.subclass.name
  end
  
  #--------------------------------------------------------------------------
  # new method: escape_actor_nickname
  #--------------------------------------------------------------------------
  def escape_actor_nickname(actor_id)
    actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
    actor = $game_actors[actor_id]
    return "" if actor.nil?
    return actor.nickname
  end
  
  #--------------------------------------------------------------------------
  # new method: escape_icon_item
  #--------------------------------------------------------------------------
  def escape_icon_item(data_id, type)
    case type
    when :class
      return "" unless $imported["YEA-ClassSystem"]
      icon = $data_classes[data_id].icon_index
      name = $data_items[data_id].name
    when :item
      icon = $data_items[data_id].icon_index
      name = $data_items[data_id].name
    when :weapon
      icon = $data_weapons[data_id].icon_index
      name = $data_weapons[data_id].name
    when :armour
      icon = $data_armors[data_id].icon_index
      name = $data_armors[data_id].name
    when :skill
      icon = $data_skills[data_id].icon_index
      name = $data_skills[data_id].name
    when :state
      icon = $data_states[data_id].icon_index
      name = $data_states[data_id].name
    else; return ""
    end
    text = "\eI[#{icon}]" + name
    return text
  end
  
  #--------------------------------------------------------------------------
  # alias method: process_escape_character
  #--------------------------------------------------------------------------
  alias window_base_process_escape_character_ams process_escape_character
  def process_escape_character(code, text, pos)
    case code.upcase
    #---
    when 'FZ'
      contents.font.size = obtain_escape_param(text)
    when 'FN'
      text.sub!(/\[(.*?)\]/, "")
      font_name = $1.to_s
      font_name = Font.default_name if font_name.nil?
      contents.font.name = font_name.to_s
    #---
    when 'OC'
      colour = text_color(obtain_escape_param(text))
      contents.font.out_color = colour
    when 'OO'
      contents.font.out_color.alpha = obtain_escape_param(text)
    #---
    when 'AMSF'
      case obtain_escape_param(text)
      when 0; reset_font_settings
      when 1; contents.font.bold = !contents.font.bold
      when 2; contents.font.italic = !contents.font.italic
      when 3; contents.font.outline = !contents.font.outline
      when 4; contents.font.shadow = !contents.font.shadow
      end
    #---
    when 'PX'
      pos[:x] = obtain_escape_param(text)
    when 'PY'
      pos[:y] = obtain_escape_param(text)
    #---
    when 'PIC'
      text.sub!(/\[(.*?)\]/, "")
      bmp = Cache.picture($1.to_s)
      rect = Rect.new(0, 0, bmp.width, bmp.height)
      contents.blt(pos[:x], pos[:y], bmp, rect)
    #---
    else
      window_base_process_escape_character_ams(code, text, pos)
    end
  end
  
end # Window_Base

#==============================================================================
# ■ Window_ChoiceList
#==============================================================================

class Window_ChoiceList < Window_Command
  
  #--------------------------------------------------------------------------
  # alias method: initialize
  #--------------------------------------------------------------------------
  alias window_choicelist_initialize_ams initialize
  def initialize(message_window)
    window_choicelist_initialize_ams(message_window)
    setup_message_font
  end
  
end # Window_ChoiceList

#==============================================================================
# ■ Window_ScrollText
#==============================================================================

class Window_ScrollText < Window_Base
  
  #--------------------------------------------------------------------------
  # alias method: initialize
  #--------------------------------------------------------------------------
  alias window_scrolltext_initialize_ams initialize
  def initialize
    window_scrolltext_initialize_ams
    setup_message_font
  end
  
end # Window_ScrollText

#==============================================================================
# ■ Window_NameMessage
#==============================================================================

class Window_NameMessage < Window_Base
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(message_window)
    @message_window = message_window
    super(0, 0, Graphics.width, fitting_height(1))
    self.opacity = YEA::MESSAGE::NAME_WINDOW_OPACITY
    self.z = @message_window.z + 1
    self.openness = 0
    setup_message_font
    @close_counter = 0
    deactivate
  end
  
  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    return if self.active
    return if self.openness == 0
    return if @closing
    @close_counter -= 1
    return if @close_counter > 0
    close
  end
  
  #--------------------------------------------------------------------------
  # start_close
  #--------------------------------------------------------------------------
  def start_close
    @close_counter = 4
    deactivate
  end
  
  #--------------------------------------------------------------------------
  # force_close
  #--------------------------------------------------------------------------
  def force_close
    @close_counter = 0
    deactivate
    close
  end
  
  #--------------------------------------------------------------------------
  # start
  #--------------------------------------------------------------------------
  def start(text, x_position)
    @text = text.clone
    set_width
    create_contents
    set_x_position(x_position)
    set_y_position
    refresh
    activate
    open
  end
  
  #--------------------------------------------------------------------------
  # set_width
  #--------------------------------------------------------------------------
  def set_width
    text = @text.clone
    dw = standard_padding * 2 + text_size(text).width
    dw += YEA::MESSAGE::NAME_WINDOW_PADDING * 2
    dw += calculate_size(text.slice!(0, 1), text) until text.empty?
    self.width = dw
  end
  
  #--------------------------------------------------------------------------
  # calculate_size
  #--------------------------------------------------------------------------
  def calculate_size(code, text)
    case code
    when "\e"
      return calculate_escape_code_width(obtain_escape_code(text), text)
    else
      return 0
    end
  end
  
  #--------------------------------------------------------------------------
  # calculate_escape_code_width
  #--------------------------------------------------------------------------
  def calculate_escape_code_width(code, text)
    dw = -text_size("\e").width - text_size(code).width
    case code.upcase
    when 'C', 'OC', 'OO'
      dw += -text_size("[" + obtain_escape_param(text).to_s + "]").width
      return dw
    when 'I'
      dw += -text_size("[" + obtain_escape_param(text).to_s + "]").width
      dw += 24
      return dw
    when '{'
      make_font_bigger
    when '}'
      make_font_smaller
    when 'FZ'
      contents.font.size = obtain_escape_param(text)
    when 'FN'
      text.sub!(/\[(.*?)\]/, "")
      font_name = $1.to_s
      font_name = Font.default_name if font_name.nil?
      contents.font.name = font_name.to_s
    when 'AMSF'
      case obtain_escape_param(text)
      when 0; reset_font_settings
      when 1; contents.font.bold = !contents.font.bold
      when 2; contents.font.italic = !contents.font.italic
      when 3; contents.font.outline = !contents.font.outline
      when 4; contents.font.shadow = !contents.font.shadow
      end
    else
      return dw
    end
  end
  
  #--------------------------------------------------------------------------
  # set_y_position
  #--------------------------------------------------------------------------
  def set_x_position(x_position)
    case x_position
    when 1 # Left
      self.x = @message_window.x
      self.x += YEA::MESSAGE::NAME_WINDOW_X_BUFFER
    when 2 # 3/10
      self.x = @message_window.x
      self.x += @message_window.width * 3 / 10
      self.x -= self.width / 2
    when 3 # Center
      self.x = @message_window.x
      self.x += @message_window.width / 2
      self.x -= self.width / 2
    when 4 # 7/10
      self.x = @message_window.x
      self.x += @message_window.width * 7 / 10
      self.x -= self.width / 2
    when 5 # Right
      self.x = @message_window.x + @message_window.width
      self.x -= self.width
      self.x -= YEA::MESSAGE::NAME_WINDOW_X_BUFFER
    end
    self.x = [[self.x, Graphics.width - self.width].min, 0].max
  end
  
  #--------------------------------------------------------------------------
  # set_y_position
  #--------------------------------------------------------------------------
  def set_y_position
    case $game_message.position
    when 0
      self.y = @message_window.height
      self.y -= YEA::MESSAGE::NAME_WINDOW_Y_BUFFER
    else
      self.y = @message_window.y - self.height
      self.y += YEA::MESSAGE::NAME_WINDOW_Y_BUFFER
    end
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    reset_font_settings
    @text = sprintf("\eC[%d]%s", YEA::MESSAGE::NAME_WINDOW_COLOUR, @text)
    draw_text_ex(YEA::MESSAGE::NAME_WINDOW_PADDING, 0, @text)
  end
  
end # Window_NameMessage

#==============================================================================
# ■ Window_Message
#==============================================================================

class Window_Message < Window_Base
  
  #--------------------------------------------------------------------------
  # alias method: initialize
  #--------------------------------------------------------------------------
  alias window_message_initialize_ams initialize
  def initialize
    window_message_initialize_ams
    setup_message_font
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: window_width
  #--------------------------------------------------------------------------
  def window_width
    return Variable.message_width
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: window_height
  #--------------------------------------------------------------------------
  def window_height
    return fitting_height(Variable.message_rows)
  end
  
  #--------------------------------------------------------------------------
  # alias method: create_all_windows
  #--------------------------------------------------------------------------
  alias window_message_create_all_windows_ams create_all_windows
  def create_all_windows
    window_message_create_all_windows_ams
    @name_window = Window_NameMessage.new(self)
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: create_back_bitmap
  #--------------------------------------------------------------------------
  def create_back_bitmap
    @back_bitmap = Bitmap.new(width, height)
    rect1 = Rect.new(0, 0, Graphics.width, 12)
    rect2 = Rect.new(0, 12, Graphics.width, fitting_height(4) - 24)
    rect3 = Rect.new(0, fitting_height(4) - 12, Graphics.width, 12)
    @back_bitmap.gradient_fill_rect(rect1, back_color2, back_color1, true)
    @back_bitmap.fill_rect(rect2, back_color1)
    @back_bitmap.gradient_fill_rect(rect3, back_color1, back_color2, true)
  end
  
  #--------------------------------------------------------------------------
  # alias method: dispose_all_windows
  #--------------------------------------------------------------------------
  alias window_message_dispose_all_windows_ams dispose_all_windows
  def dispose_all_windows
    window_message_dispose_all_windows_ams
    @name_window.dispose
  end
  
  #--------------------------------------------------------------------------
  # alias method: update_all_windows
  #--------------------------------------------------------------------------
  alias window_message_update_all_windows_ams update_all_windows
  def update_all_windows
    window_message_update_all_windows_ams
    @name_window.update
    @name_window.back_opacity = self.back_opacity
    @name_window.opacity = self.opacity
  end
  
  #--------------------------------------------------------------------------
  # alias method: update_show_fast
  #--------------------------------------------------------------------------
  alias window_message_update_show_fast_ams update_show_fast
  def update_show_fast
    @show_fast = true if Input.press?(YEA::MESSAGE::TEXT_SKIP)
    window_message_update_show_fast_ams
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: input_pause
  #--------------------------------------------------------------------------
  def input_pause
    self.pause = true
    wait(10)
    Fiber.yield until Input.trigger?(:B) || Input.trigger?(:C) ||
      Input.press?(YEA::MESSAGE::TEXT_SKIP)
    Input.update
    self.pause = false
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: convert_escape_characters
  #--------------------------------------------------------------------------
  def convert_escape_characters(text)
    result = super(text.to_s.clone)
    result = namebox_escape_characters(result)
    result = message_escape_characters(result)
    return result
  end
  
  #--------------------------------------------------------------------------
  # new method: namebox_escape_characters
  #--------------------------------------------------------------------------
  def namebox_escape_characters(result)
    result.gsub!(/\eN\<(.+?)\>/i)  { namewindow($1, 1) }
    result.gsub!(/\eN1\<(.+?)\>/i) { namewindow($1, 1) }
    result.gsub!(/\eN2\<(.+?)\>/i) { namewindow($1, 2) }
    result.gsub!(/\eNC\<(.+?)\>/i) { namewindow($1, 3) }
    result.gsub!(/\eN3\<(.+?)\>/i) { namewindow($1, 3) }
    result.gsub!(/\eN4\<(.+?)\>/i) { namewindow($1, 4) }
    result.gsub!(/\eN5\<(.+?)\>/i) { namewindow($1, 5) }
    result.gsub!(/\eNR\<(.+?)\>/i) { namewindow($1, 5) }
    return result
  end
  
  #--------------------------------------------------------------------------
  # new method: namebox
  #--------------------------------------------------------------------------
  def namewindow(text, position)
    @name_text = text
    @name_position = position
    return ""
  end
  
  #--------------------------------------------------------------------------
  # new method: message_escape_characters
  #--------------------------------------------------------------------------
  def message_escape_characters(result)
    result.gsub!(/\eAF\[(-?\d+)]/i) { change_face($1.to_i) }
    return result
  end
  
  #--------------------------------------------------------------------------
  # new method: change_face
  #--------------------------------------------------------------------------
  def change_face(actor_id)
    actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
    actor = $game_actors[actor_id]
    return "" if actor.nil?
    $game_message.face_name = actor.face_name
    $game_message.face_index = actor.face_index
    return ""
  end
  
  #--------------------------------------------------------------------------
  # alias method: new_page
  #--------------------------------------------------------------------------
  alias window_message_new_page_ams new_page
  def new_page(text, pos)
    adjust_message_window_size
    window_message_new_page_ams(text, pos)
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: new_line_x
  #--------------------------------------------------------------------------
  def new_line_x
    return $game_message.face_name.empty? ? 0 : YEA::MESSAGE::FACE_INDENT_X
  end
  
  #--------------------------------------------------------------------------
  # new method: adjust_message_window_size
  #--------------------------------------------------------------------------
  def adjust_message_window_size
    self.height = window_height
    self.width = window_width
    create_contents
    update_placement
    self.x = (Graphics.width - self.width) / 2
    start_name_window
  end
  
  #--------------------------------------------------------------------------
  # new method: clear_name_window
  #--------------------------------------------------------------------------
  def clear_name_window
    @name_text = ""
    @name_position = 0
  end
  
  #--------------------------------------------------------------------------
  # new method: start_name_window
  #--------------------------------------------------------------------------
  def start_name_window
    @name_text ||= ""
    return if @name_text == ""
    @name_window.start(@name_text, @name_position)
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: fiber_main
  #--------------------------------------------------------------------------
  def fiber_main
    $game_message.visible = true
    update_background
    update_placement
    loop do
      process_all_text if $game_message.has_text?
      process_input
      $game_message.clear
      @gold_window.close
      @name_window.start_close
      Fiber.yield
      break unless text_continue?
    end
    close_and_wait
    $game_message.visible = false
    @fiber = nil
  end
  
  #--------------------------------------------------------------------------
  # alias method: open_and_wait
  #--------------------------------------------------------------------------
  alias window_message_open_and_wait_ams open_and_wait
  def open_and_wait
    clear_name_window
    adjust_message_window_size
    window_message_open_and_wait_ams
  end
  
  #--------------------------------------------------------------------------
  # alias method: close_and_wait
  #--------------------------------------------------------------------------
  alias window_message_close_and_wait_ams close_and_wait
  def close_and_wait
    @name_window.force_close
    window_message_close_and_wait_ams
  end
  
  #--------------------------------------------------------------------------
  # alias method: all_close?
  #--------------------------------------------------------------------------
  alias window_message_all_close_ams all_close?
  def all_close?
    return window_message_all_close_ams && @name_window.close?
  end
  
  #--------------------------------------------------------------------------
  # alias method: process_escape_character
  #--------------------------------------------------------------------------
  alias window_message_process_escape_character_ams process_escape_character
  def process_escape_character(code, text, pos)
    case code.upcase
    when 'W' # Wait
      wait(obtain_escape_param(text))
    else
      window_message_process_escape_character_ams(code, text, pos)
    end
  end
  
end # Window_Message

#==============================================================================
#
# ▼ End of File
#
#==============================================================================[/pre]
回复 1 0

使用道具 举报

梦石
0
星屑
208
在线时间
420 小时
注册时间
2020-1-11
回帖
175
 楼主| 发表于 2020-10-15 20:59:51 | 显示全部楼层
本帖最后由 alianlord 于 2020-10-15 21:01 编辑
alexncf125 发表于 2020-10-15 18:39
二擇其一
[fold=特殊文字代码]# \fn - Change the font to fontname. If you put multiple fontnames
#     ...


唉唷!!!千行大咒!!!
                                      :    :
                                      :    :
                                      :    :
                                      :    :
                                      :    :
                                      :    :
                                      :    :
                                      :    :
实在没有想到实现这个功能要动用这么大的脚本啊~~~~~~
不给个100悬赏实在说不过去,不过来不及了。
这样吧,我就把这脚本的外文百度翻译翻译。,好让后来者行个便利。
回复

使用道具 举报

梦石
0
星屑
29901
在线时间
5734 小时
注册时间
2016-3-8
回帖
1653
发表于 2020-10-15 21:32:09 | 显示全部楼层
本帖最后由 alexncf125 于 2020-10-15 21:36 编辑
alianlord 发表于 2020-10-15 20:59
唉唷!!!千行大咒!!!
                                      :    :
                  ...


把相关代码抠出来很难么??
这十多行就是了
[pre lang="ruby"]
class Window_Base < Window
  alias window_base_process_escape_character_sam process_escape_character
  def process_escape_character(code, text, pos)
    case code.upcase
    when 'FN'
      text.sub!(/\[(.*?)\]/, "")
      font_name = $1.to_s
      font_name = Font.default_name if font_name.nil?
      contents.font.name = font_name.to_s
    else
      window_base_process_escape_character_sam(code, text, pos)
    end
  end
end[/pre]
回复

使用道具 举报

梦石
0
星屑
208
在线时间
420 小时
注册时间
2020-1-11
回帖
175
 楼主| 发表于 2020-10-15 21:43:58 | 显示全部楼层
alexncf125 发表于 2020-10-15 21:32
把相关代码抠出来很难么??
这十多行就是了

可能可以……不过我不确定。还是多谢了。
回复

使用道具 举报

梦石
0
星屑
208
在线时间
420 小时
注册时间
2020-1-11
回帖
175
 楼主| 发表于 2020-10-16 22:37:06 | 显示全部楼层
alexncf125 发表于 2020-10-15 21:32
把相关代码抠出来很难么??
这十多行就是了

承蒙你给的脚本,在一句话中显示两种的字体的功能实现了。
但效果差强人意。尤其在我想用不同的字体来描绘hp、mp等数值时。
虽然我已经装载了“液晶数字式的阿拉伯数字”的字体,并放入了Fonts的文件夹。
但是使用时的数字并不会变成 液晶数字。而是变成了一种好像比宋体还要纤细的一种字体。
我确定字体改变起了作用,因为我比较了用了新数字字体的数字,和默认为黑体所显示的数字的确是不同的。
于是我猜想……这并不是脚本的问题,而是可能VxAce中支援的识别库有问题,它认不出……我试验过十种不同的中文字形,数字都会诡异的,变成那种纤细形的……可能是系统自带的 "nsimsun"
你有相关的线索能告诉我吗?
回复

使用道具 举报

梦石
0
星屑
6295
在线时间
799 小时
注册时间
2019-1-20
回帖
223
发表于 2020-10-17 23:57:49 | 显示全部楼层
alianlord 发表于 2020-10-16 22:37
承蒙你给的脚本,在一句话中显示两种的字体的功能实现了。
但效果差强人意。尤其在我想用不同的字体来描 ...

这应该是 draw_text 那里的问题吧?
字体的 size 太大就会有部分不显示
字符过长就会挤在一起变形

你可以试试把人物能力值设定为1或者10看看
如果显示正常了,那么恭喜你
你需要把描绘hp什么的那些地方都修改一遍O(∩_∩)O哈哈哈~

例如下面 ## 都是加了 *2 ,使描绘的范围宽度变成2倍,
具体该加减乘除多少,慢慢调吧 ^ - ^

class Window_Base < Window
  def draw_actor_param(actor, x, y, param_id)
    change_color(system_color)
    draw_text(x, y, 120*2, line_height, Vocab::param(param_id)) ##
    change_color(normal_color)
    draw_text(x + 120, y, 36*2, line_height, actor.param(param_id), 2) ##
  end
end #class

PS:
1.真的太长/太大的话,连x,y那里也得调... ...
2.目前只能想到这样直接改,如果用alias别名,会把那些不对的也显示出来

提高解决问题的方法:
查看对应版本的帮助文件或者默认脚本中可能相似的部分 看有没有思路能照搬(不是)
改变问题为更有可能的,常见的,系统性的 如:天气自动变化成下雨→天气系统 要多想几种可能
使用论坛的搜索功能查找相关问题 咦?这跟我想的不一样啊!讨厌啦~\(≧□≦)/~啦啦啦
清楚说明实际上你想解决的问题  想看坛友的女装,想看!  
脚本自己有改过的地方要尽量标明  提高除BUG效率 ... ...
脚本有问题但不是默认脚本的要全部贴出来 大胆点,尽情发,我说的是女装照!
三包原则:包有BUG,包甩锅,包咕咕 长期下线,急事换人!难事换人!啥事都换人!换人换人换人!!!
回复 1 0

使用道具 举报

梦石
0
星屑
208
在线时间
420 小时
注册时间
2020-1-11
回帖
175
 楼主| 发表于 2020-10-18 08:23:17 | 显示全部楼层
srwjrevenger 发表于 2020-10-17 23:57
这应该是 draw_text 那里的问题吧?
字体的 size 太大就会有部分不显示
字符过长就会挤在一起变形

我试著把字体大小设为60,但数字的显现还是一样。还是很感谢大大提供思路。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部