查看: 3881|回复: 7

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

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

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

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

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

不考虑引入图片冒充的情况。
梦石
0
星屑
30103
在线时间
5741 小时
注册时间
2016-3-8
回帖
1662
发表于 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
  1. #==============================================================================
  2. #    ATS: Special Message Codes [VXA]
  3. #    Version: 1.0.6
  4. #    Author: modern algebra (rmrk.net)
  5. #    Date: 18 October 2012
  6. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7. #  Description:
  8. #
  9. #    This script allows you to use a number of additional special codes in the
  10. #   message system, which will function similar to the default codes like
  11. #   \v[n], \c[n], etc. Please see the list of special message codes starting at
  12. #   line 54 for a full idea of what is added. Basically, it gives you greater
  13. #   control over the delivery of a message, allows you to make use of font
  14. #   effects like bolding and italicizing, and allows you to retrieve and
  15. #   display useful data like the names of weapons and armors.
  16. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  17. #  ATS Series:
  18. #
  19. #    This script is part of the Advanced Text System series of scripts. These
  20. #   scripts are based off the Advanced Text System for RMVX, but since RMVX Ace
  21. #   has a much more sensibly designed message system, it is no longer necessary
  22. #   that it be one large script. For that reason, and responding to feedback on
  23. #   the ATS, I have split the ATS into multiple different scripts so that you
  24. #   only need to pick up the components for the features that you want. It is
  25. #   therefore easier to customize and configure.
  26. #
  27. #    To find more scripts in the ATS Series, please visit:
  28. #      [url]http://rmrk.net/index.php/topic[/url],44525.0.html
  29. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  30. #  Instructions:
  31. #
  32. #    This script is not difficult to use or configure. There are only ten
  33. #   configuration options for this script. These are:
  34. #
  35. #      :message_speed               :font_italic
  36. #      :show_fast_speed             :font_outline
  37. #      :font_name                   :font_shadow
  38. #      :font_size                   :font_underline
  39. #      :font_bold                   :font_highlight
  40. #
  41. #   :message_speed allows you to set the default number of frames to wait
  42. #   between drawing each letter in the message window. :show_fast_speed allows
  43. #   you to control the amount it speeds up when the player presses enter. You
  44. #   can gain instructions on setting the default value for both at line 180.
  45. #
  46. #   All of the :font_ settings simply let you set the initial values for the
  47. #   font when used.
  48. #
  49. #    As with other ATS scripts, you can change the value of these options in
  50. #   game with the following codes in a script call:
  51. #
  52. #      ats_next(:message_option, x)
  53. #      ats_all(:message_option, x)
  54. #
  55. #   Where :message_option is the symbol you want (:message_speed or
  56. #   :show_fast_speed) and x is the value you want to change it to. ats_next
  57. #   will only change it for the very next message, while ats_all will change it
  58. #   for every message to follow.
  59. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  60. #  List of Special Message Codes:
  61. #
  62. #    The default message codes are retained, and this script adds a number of
  63. #   other desirable features. The following is a complete list of the message
  64. #   codes at your disposal. Simply insert them into a Display Message command,
  65. #   Choice Branches, or any other message related system.
  66. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  67. #  Font Effects:
  68. #
  69. # \fn[fontname] - Change the font to fontname. If you put multiple fontnames
  70. #     separated by commas, then it will take the first one the user has installed
  71. # \fs[n] - Change the font size to n.
  72. # \{ - Increase the font size by 8.
  73. # \} - Decrease the font size by 8.
  74. # \c[n] - Set the colour of the text being drawn to the nth colour of the
  75. #     Windowskin palette. 0 is the normal color and 16 is the system color.
  76. # \hc[RRGGBB] or \c[#RRGGBB] - Set the colour of the text being drawn to any
  77. #     colour, using hexadecimal values. You can set each colour (red, green,
  78. #     blue) to anything from 0-255 (00-FF). You must use hexadecimal values. If
  79. #     so desired, you can add an additional hex value from 00-FF to change the
  80. #     alpha.
  81. # \bn     - Turn bold on. Text drawn after this code will be bolded.
  82. # /bf     - Turn bold off.
  83. # \i     - Turn italic on. Text drawn after this code will be italicized.
  84. # /i     - Turn italic off.
  85. # \o     - Turn outline on.
  86. # /o     - Turn outline off.
  87. # \s     - Turn shadow on. Text drawn after this code will have a shadow.
  88. # /s     - Turn shadow off.
  89. # \u     - Turn underline on. Text drawn after this code will be underlined.
  90. # /u     - Turn underline off.
  91. # \hl[n] - Turn highlight on. Text drawn after this code will be highlighted
  92. #     with colour n + 1 from the windowskin palette
  93. # /hl OR \hl[0] - Turn highlight off.
  94. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  95. #  Message Control:
  96. #
  97. # \s[n] - Sets the message speed to wait n frames between drawing every letter.
  98. #     0 is instant.
  99. # \s[+n] - Sets the message speed to wait an additional n frames between drawing
  100. #     every letter.
  101. # \s[-n] - Sets the message speed to wait n less frames between drawing every
  102. #     letter.
  103. # \. - Wait 15 frames before drawing the next character
  104. # \| - Wait 60 frames before drawing the next character
  105. # \w[n] - Wait n frames before drawing the next character
  106. # \! - Pause text and wait for player to press Enter
  107. # \^ - Skip Pause; allows you to close a message window without requiring player
  108. #     input.
  109. # \> - Show line fast.
  110. # \< - Stop showing line fast.
  111. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  112. #  Replacement Codes:
  113. #
  114. # \p[n] - Draw the name of the actor in the xth position in the party. 1 is
  115. #     the party leader, 2 is the second member, etc.
  116. # \n[n] - Draw the name of the actor with ID n
  117. # \nn[n] - Draw the nickname of the actor with ID n.
  118. # \pid[n] - Draw the ID of the actor in the nth position in the party.
  119. # \ac[n] - Draw the class name of the actor with ID n.
  120. # \al[n] - Draw the level of the actor with ID n.
  121. # \ni[n] - Draw the name of the item with ID n.
  122. # \nw[n] - Draw the name of the weapon with ID n.
  123. # \na[n] - Draw the name of the armor with ID n.
  124. # \ns[n] - Draw the name of the skill with ID n.
  125. # \nt[n] - Draw the name of the state with ID n.
  126. # \nc[n] - Draw the name of the class with ID n.
  127. # \ne[n] - Draw the name of the event with ID n on the current map.
  128. # \nm[n] - Draw the name of the enemy with ID n.
  129. # \nv[n] - Draw the name of the variable with ID n.
  130. # \nsw[n] - Draw the name of the switch with ID n.
  131. # \nl[n] - Draw the name of the element with ID n.
  132. # \nwt[n] - Draw the name of the weapon type with ID n.
  133. # \nat[n] - Draw the name of the armor type with ID n.
  134. # \nst[n] - Draw the name of the skill type with ID n.
  135. # \np[n] - Draw the name of the actor in the nth position in the party.
  136. # \map   - Draw the name of the map the player is currently on.
  137. # \map[n] - Draw the name of the map with ID n.
  138. # \pg - Draws the amount of money the party has.
  139. # \g - Draws the unit of currency.
  140. # \vocab[method] - Will draw whatever Vocab.method returns, if it is a valid
  141. #     method call. Suitable values for method are: level, level_a, hp, hp_a,
  142. #     mp, mp_a, tp, tp_a, fight, escape, attack, guard, item, skill, equip,
  143. #     status, formation, save, game_end, weapon, armor, key_item, equip2,
  144. #     optimize, clear, new_game, continue, shutdown, to_title, cancel,
  145. #     currency_unit
  146. # \vocab[param, n] - Will draw the label for parameter with ID n. 0 => Max HP;
  147. #     1 => Max MP; 2 => Attack; 3 => Defence; 4 => Magic; 5 => Magic Defence;
  148. #     6 => Agility; 7 => Luck
  149. # \vocab[etype, n] - Will draw the label for equipment type with ID n.
  150. #     0 => Weapon; 1 => Shield; 2 => Head; 3 => Body; 4 => Accessory
  151. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  152. #  Other Effects:
  153. #
  154. # \$ - Opens a window which shows the party's gold.
  155. # \lb - line break
  156. # \i[n] - Draw icon with index n.
  157. # \ii[n] - Draw icon of the item with ID n.
  158. # \iw[n] - Draw icon of the weapon with ID n.
  159. # \ia[n] - Draw icon of the armor with ID n.
  160. # \is[n] - Draw icon of the skill with ID n.
  161. # \it[n] - Draw icon of the state with ID n.
  162. # \x[n] - Draw next character at pixel n of the window contents.
  163. # \s{n,text} - Will only draw text if the switch with ID n is ON.
  164. # \s!{n,text} - Will only draw text if the switch with ID n is OFF.
  165. # \#{code} - This will evaluate code. So, if you know scipting, you can place
  166. #     any code there and it will draw whatever is returned by it. For instance:
  167. #     \#{$game_system.save_count} would draw the number of times the player has
  168. #     saved the current game.
  169. #==============================================================================

  170. $imported = {} unless $imported
  171. $imported[:ATS_SpecialMessageCodes] = true

  172. #==============================================================================
  173. # ** Game_ATS
  174. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  175. #  Summary of Changes:
  176. #    new public instance variables - message_speed; special_message_codes
  177. #==============================================================================

  178. class Game_ATS
  179.   CONFIG = {} unless $imported[:AdvancedTextSystem]
  180.   CONFIG[:special_message_codes] = {
  181.     special_message_codes: true,
  182.     #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  183.     #  EDITABLE REGION
  184.     #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  185.     #   :message_speed => x,
  186.     #      Changing the value of x determines the default number of frames to
  187.     #     wait between drawing letters in a message window. 0 is instant.
  188.     :message_speed =>   1,
  189.     #   :show_fast_speed => x
  190.     #      Changing the value of x determines the number of frames to wait
  191.     #     between drawing letters when the player is holding enter. 0 is
  192.     #     instant
  193.       :show_fast_speed => 0,
  194.     # Font Settings - Set the default settings for the font you are using here.
  195.     :font_name => Font.default_name,       # String or Array of Strings
  196.     :font_size => Font.default_size,       # Integer
  197.     :font_bold => Font.default_bold,       # true or false
  198.     :font_italic => Font.default_italic,   # true or false
  199.     :font_outline => Font.default_outline, # true or false
  200.     :font_shadow => Font.default_shadow,   # true or false
  201.     :font_underline => false,              # true or false
  202.     :font_highlight => -1,                 # Integer for colour of highlight
  203.     #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  204.     #  END EDITABLE REGION
  205.     #////////////////////////////////////////////////////////////////////////
  206.   }
  207.   #--------------------------------------------------------------------------
  208.   # * Public Instance Variables
  209.   #--------------------------------------------------------------------------
  210.   CONFIG[:special_message_codes].keys.each { |key| attr_accessor key }
  211. end

  212. #==============================================================================
  213. #  Initialize Common ATS Data if no other ATS script interpreted first
  214. #==============================================================================

  215. if !$imported[:AdvancedTextSystem]
  216.   #============================================================================
  217.   # *** DataManager
  218.   #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  219.   #  Summary of Changes:
  220.   #    aliased method - create_game_objects; make_save_contents;
  221.   #      extract_save_contents
  222.   #============================================================================
  223.   module DataManager
  224.     class << self
  225.       #--------------------------------------------------------------------------
  226.       # * Create Game Objects
  227.       #--------------------------------------------------------------------------
  228.       alias modb_ats_crtgmobj_6yh7 create_game_objects
  229.       def create_game_objects(*args, &block)
  230.         modb_ats_crtgmobj_6yh7(*args, &block)
  231.         $game_ats = Game_ATS.new
  232.         $game_ats.init_new_installs
  233.       end
  234.       #--------------------------------------------------------------------------
  235.       # * Make Save Contents
  236.       #--------------------------------------------------------------------------
  237.       alias mlba_ats_mksave_5tg9 make_save_contents
  238.       def make_save_contents(*args, &block)
  239.         contents = mlba_ats_mksave_5tg9(*args, &block)
  240.         contents[:ats] = $game_ats
  241.         contents
  242.       end
  243.       #--------------------------------------------------------------------------
  244.       # * Extract Save Contents
  245.       #--------------------------------------------------------------------------
  246.       alias ma_ats_extrcsvcon_8uj2 extract_save_contents
  247.       def extract_save_contents(contents, *args, &block)
  248.         ma_ats_extrcsvcon_8uj2(contents, *args, &block)
  249.         $game_ats = contents[:ats] ? contents[:ats] : Game_ATS.new
  250.         $game_ats.init_new_installs
  251.       end
  252.     end
  253.   end

  254.   #============================================================================
  255.   # ** Game_ATS
  256.   #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  257.   #  This class holds the default data for all scripts in the ATS series
  258.   #============================================================================

  259.   class Game_ATS
  260.     def initialize; reset; end
  261.     #--------------------------------------------------------------------------
  262.     # * Reset any or all installed ATS scripts
  263.     #--------------------------------------------------------------------------
  264.     def reset(script_name = nil)
  265.       if script_name.is_a? (Symbol) # If script to reset specified
  266.         CONFIG[script_name].each_pair { |key, value|
  267.           self.send("#{key}=".to_sym, value)
  268.           $game_message.send("#{key}=".to_sym, value)
  269.         }
  270.       else                          # Reset all ATS scripts
  271.         CONFIG.keys.each { |script| reset(script) }
  272.       end
  273.     end
  274.     #--------------------------------------------------------------------------
  275.     # * Initialize any newly installed ATS scripts
  276.     #--------------------------------------------------------------------------
  277.     def init_new_installs
  278.       CONFIG.keys.each { |script| reset(script) unless self.send(script) }
  279.     end
  280.   end

  281.   #============================================================================
  282.   # ** Game_Message
  283.   #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  284.   #  Summary of Changes:
  285.   #    aliased method - clear
  286.   #============================================================================

  287.   class Game_Message
  288.     #--------------------------------------------------------------------------
  289.     # * Clear
  290.     #--------------------------------------------------------------------------
  291.     alias mlb_ats_clrats_5tv1 clear
  292.     def clear(*args, &block)
  293.       mlb_ats_clrats_5tv1(*args, &block) # Run Original Method
  294.       return if !$game_ats
  295.       Game_ATS::CONFIG.values.each { |installed|
  296.         installed.keys.each { |key| self.send("#{key}=".to_sym, $game_ats.send(key)) }
  297.       }
  298.     end
  299.   end

  300.   #============================================================================
  301.   # ** Game_Interpreter
  302.   #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  303.   #  Summary of Changes:
  304.   #    new methods - ats_all; ats_next
  305.   #============================================================================

  306.   class Game_Interpreter
  307.     #--------------------------------------------------------------------------
  308.     # * ATS All
  309.     #--------------------------------------------------------------------------
  310.     def ats_all(sym, *args, &block)
  311.       $game_ats.send("#{sym}=".to_sym, *args, &block)
  312.       ats_next(sym, *args, &block)
  313.     end
  314.     #--------------------------------------------------------------------------
  315.     # * ATS Next
  316.     #--------------------------------------------------------------------------
  317.     def ats_next(sym, *args, &block)
  318.       $game_message.send("#{sym}=".to_sym, *args, &block)
  319.     end
  320.   end
  321. end

  322. $imported[:AdvancedTextSystem] = true

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

  326. #==============================================================================
  327. # ** Game_Event
  328. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  329. #  Summary of Changes:
  330. #    new method - name
  331. #==============================================================================

  332. class Game_Event
  333.   def name
  334.     return @event ? @event.name : ""
  335.   end
  336. end

  337. #==============================================================================
  338. # ** Window_Base
  339. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  340. #  Summary of Changes:
  341. #    aliased methods - initialize; convert_escape_characters; calc_line_height;
  342. #      process_escape_character; process_normal_character
  343. #==============================================================================

  344. class Window_Base
  345.   #--------------------------------------------------------------------------
  346.   # * Object Initialization
  347.   #--------------------------------------------------------------------------
  348.   alias mlgb_atssmc_init_3do9 initialize
  349.   def initialize(*args, &block)
  350.     mlgb_atssmc_init_3do9(*args, &block) # Run Original Method
  351.     @underline = false
  352.     @highlight = -1
  353.   end
  354.   #--------------------------------------------------------------------------
  355.   # * Convert Escape Characters
  356.   #--------------------------------------------------------------------------
  357.   alias ma_atssmc_convesc_4rc1 convert_escape_characters
  358.   def convert_escape_characters(text, *args, &block)
  359.     result = ma_atssmc_convesc_4rc1(text, *args, &block) # Run Original Method
  360.     # Party
  361.     result.gsub!(/\ePID\[(\d+)\]/i) { $1.to_i >= 1 ? $game_party.members[$1.to_i - 1].id.to_s : "1" }
  362.     result.gsub!(/\ePG/i) { $game_party.gold }
  363.     # Message Speed
  364.     result.gsub!(/\eS\[([\+-]?\d+)\]/i) { "\eMS\[#{$1}\]" }
  365.     result.gsub!(/\e%/)             { "\eDS%"}
  366.     # Hex Colour
  367.     result.gsub!(/\eC\[#/i)         { "\eHC[" }
  368.     # Icons
  369.     result.gsub!(/\eII\[(\d+)\]/i)  { "\eI\[#{$data_items[$1.to_i].icon_index}\]" rescue "" }
  370.     result.gsub!(/\eIW\[(\d+)\]/i)  { "\eI\[#{$data_weapons[$1.to_i].icon_index}\]" rescue "" }
  371.     result.gsub!(/\eIA\[(\d+)\]/i)  { "\eI\[#{$data_armors[$1.to_i].icon_index}\]" rescue "" }
  372.     result.gsub!(/\eIS\[(\d+)\]/i)  { "\eI\[#{$data_skills[$1.to_i].icon_index}\]" rescue "" }
  373.     result.gsub!(/\eIT\[(\d+)\]/i)  { "\eI\[#{$data_states[$1.to_i].icon_index}\]" rescue "" }
  374.     # Actor Stats
  375.     result.gsub!(/\eAC\[(\d+)\]/i)  { $data_classes[$game_actors[$1.to_i].class_id].name }
  376.     result.gsub!(/\eAL\[(\d+)\]/i)  { $game_actors[$1.to_i].level.to_s }
  377.     # Names
  378.     result.gsub!(/\eMAP\[(\d+)\]/i) { load_data(sprintf("Data/Map%03d.rvdata2", $1.to_i)).display_name rescue "" }
  379.     result.gsub!(/\eMAP/i)          { $game_map.display_name rescue "" }
  380.     result.gsub!(/\eNP\[(\d+)\]/i)  { $game_party.members[$1.to_i].name rescue "" }
  381.     result.gsub!(/\eNE\[(\d+)\]/i)  { $game_map.events[$1.to_i].name rescue "" }
  382.     result.gsub!(/\eNN\[(\d+)\]/i)  { $game_actors[$1.to_i].nickname rescue "" }
  383.     result.gsub!(/\eNI\[(\d+)\]/i)  { $data_items[$1.to_i].name rescue "" }
  384.     result.gsub!(/\eNW\[(\d+)\]/i)  { $data_weapons[$1.to_i].name rescue "" }
  385.     result.gsub!(/\eNA\[(\d+)\]/i)  { $data_armors[$1.to_i].name rescue "" }
  386.     result.gsub!(/\eNS\[(\d+)\]/i)  { $data_skills[$1.to_i].name rescue "" }
  387.     result.gsub!(/\eNT\[(\d+)\]/i)  { $data_states[$1.to_i].name rescue "" }
  388.     result.gsub!(/\eNM\[(\d+)\]/i)  { $data_enemies[$1.to_i].name rescue "" }
  389.     result.gsub!(/\eNC\[(\d+)\]/i)  { $data_classes[$1.to_i].name rescue "" }
  390.     result.gsub!(/\eNV\[(\d+)\]/i)  { $data_system.variables[$1.to_i] }
  391.     result.gsub!(/\eNSW\[(\d+)\]/i) { $data_system.switches[$1.to_i] }
  392.     result.gsub!(/\eNWT\[(\d+)\]/i) { $data_system.weapon_types[$1.to_i] }
  393.     result.gsub!(/\eNAT\[(\d+)\]/i) { $data_system.armor_types[$1.to_i] }
  394.     result.gsub!(/\eNST\[(\d+)\]/i) { $data_system.skill_types[$1.to_i] }
  395.     result.gsub!(/\eNL\[(\d+)\]/i)  { $data_system.elements[$1.to_i] }
  396.     # Vocab
  397.     result.gsub!(/\eVOCAB\[(\w+),\s*(\d+)\s*\]/i) { Vocab.send($1.downcase, $2.to_i) rescue "" }
  398.     result.gsub!(/\eVOCAB\[(\w+)\]/i) { Vocab.send($1.downcase) rescue "" }
  399.     # Font Settings
  400.     result.gsub!(/\eBN/i)            { "\eFE[0]" } # Bold On
  401.     result.gsub!(/\/BF/i)            { "\eFE[1]" } # Bold Off
  402.     result.gsub!(/\eI([^\[])/i)     { "\eFE[2]#{$1}" } # Italics On
  403.     result.gsub!(/\/I/i)            { "\eFE[3]" } # Italics Off
  404.     result.gsub!(/\eO/i)            { "\eFE[4]" } # Outline On
  405.     result.gsub!(/\/O/i)            { "\eFE[5]" } # Outline Off
  406.     result.gsub!(/\eS([^\[!])/i)    { "\eFE[6]#{$1}" } # Shadow On
  407.     result.gsub!(/\/S/i)            { "\eFE[7]" } # Shadow Off
  408.     result.gsub!(/\eU/i)            { "\eFE[8]" } # Underline On
  409.     result.gsub!(/\/U/i)            { "\e\FE[9]" } # Underline Off
  410.     result.gsub!(/\eHL\[(\d+)\]/i)  { "\eHL[#{$1.to_i}]" } # Highlight On: custom colour
  411.     result.gsub!(/\eHL([^\[])/i)    { "\eHL[17]#{$1}" }# Highlight On: system colour
  412.     result.gsub!(/\/HL/i)           { "\eHL[0]" } # Hightlight Off
  413.     result.gsub!(/\/FN/i)           { "\eFN[]" }  # Default Font
  414.     result.gsub!(/\/FS/i)           { "\eFS[#{Font.default_size}]" } # Default Font
  415.     # Conditional Text
  416.     result.gsub!(/\eS\[(\d+)[,;:](.+?)\]/mi) { $game_switches[$1.to_i] ? $2 : "" }
  417.     result.gsub!(/\eS!\[(\d+)[,;:](.+?)\]/mi) { $game_switches[$1.to_i] ? "" : $2 }
  418.     result.gsub!(/\eS\{(\d+)[,;:](.+?)\}/mi) { $game_switches[$1.to_i] ? $2 : "" }
  419.     result.gsub!(/\eS!\{(\d+)[,;:](.+?)\}/mi) { $game_switches[$1.to_i] ? "" : $2 }
  420.     # Evaluation
  421.     result.gsub!(/\e#\{(.+?)\}/im)  { (eval($1)).to_s rescue "" }
  422.     # Do resubstitutions if requested
  423.     if result.sub!(/\eRESUB/i, "") != nil
  424.       result = convert_escape_characters(result, *args, &block)
  425.     end
  426.     result.gsub!(/\eLB/i, "\n") # Line Break
  427.     result # Return result
  428.   end
  429.   #--------------------------------------------------------------------------
  430.   # * Calculate Line Height
  431.   #--------------------------------------------------------------------------
  432.   alias ma_atssmc_clclnhght_3ek9 calc_line_height
  433.   def calc_line_height(text, *args, &block)
  434.     res = ma_atssmc_clclnhght_3ek9(text, *args, &block) # Run Original Method
  435.     text.slice(/^.*$/).scan(/\eFS\[(\d+)\]/i) { |num| res = [res, num[0].to_i].max }
  436.     res
  437.   end
  438.   #--------------------------------------------------------------------------
  439.   # * Process Normal Character
  440.   #--------------------------------------------------------------------------
  441.   alias mlra_atssmc_procnorm_5fg2 process_normal_character
  442.   def process_normal_character(c, pos, *args, &block)
  443.     draw_highlight_underline(c, pos) if @underline || @highlight
  444.     mlra_atssmc_procnorm_5fg2(c, pos, *args, &block) # Run Original Method
  445.   end
  446.   #--------------------------------------------------------------------------
  447.   # * Process Escape Character
  448.   #--------------------------------------------------------------------------
  449.   alias ma_atssmc_procesc_7gv1 process_escape_character
  450.   def process_escape_character(code, text, pos, *args, &block)
  451.     case code.upcase
  452.     when 'X' then pos[:x] = obtain_escape_param(text)
  453.     when 'HC' # Hex Colour
  454.       hex = text.slice!(/^\[([ABCDEF\d]+)\]/i)
  455.       rgb = $1.scan(/../).map { |hex| hex.to_i(16) }
  456.       change_color(Color.new(*rgb)) if rgb.size.between?(3,4)
  457.     when 'FE' # Font Settings
  458.       param = obtain_escape_param(text)
  459.       case param / 2
  460.       when 0 then contents.font.bold = ((param % 2) == 0)     # Bold
  461.       when 1 then contents.font.italic = ((param % 2) == 0)   # Italic
  462.       when 2 then contents.font.outline = ((param % 2) == 0)  # Outline
  463.       when 3 then contents.font.shadow = ((param % 2) == 0)   # Shadow
  464.       when 4 then @underline = ((param % 2) == 0)             # Underline
  465.       end
  466.     when 'HL' then @highlight = obtain_escape_param(text) - 1 # Highlight
  467.     when 'FN' # Font Name
  468.       text.slice!(/^\[(.*?\])/)
  469.       param = $1
  470.       if param.nil? || param == ']'
  471.         contents.font.name = Font.default_name
  472.       else
  473.         ary = []
  474.         while param.slice!(/\s*(.+?)\s*[,;:\]]/) != nil do ary.push($1) end
  475.         contents.font.name = ary
  476.       end
  477.     when 'FS' # Font Size
  478.       text.slice!(/^\[(\d+)\]/)
  479.       contents.font.size = [[$1.to_i, 16].max, 64].min
  480.     else
  481.       ma_atssmc_procesc_7gv1(code, text, pos, *args, &block) # Run Original Method
  482.     end
  483.   end
  484.   #--------------------------------------------------------------------------~
  485.   # * Draw Highlighting and Underlining
  486.   #--------------------------------------------------------------------------~
  487.   def draw_highlight_underline(c, pos)
  488.     text_width = text_size(c).width
  489.     y_space = (pos[:height] - contents.font.size) / 2
  490.     if @underline      # Underlining
  491.       y = pos[:y] + pos[:height]
  492.       y -= [2, y_space].max
  493.       contents.fill_rect(pos[:x], y, text_width, 2, contents.font.color)
  494.     end
  495.     if @highlight >= 0 # Highlighting
  496.       y = pos[:y]
  497.       y += y_space - 1 if y_space > 0
  498.       text_height = [contents.font.size + 2, pos[:height]].min
  499.       colour = text_color(@highlight)
  500.       colour.alpha = 128 if colour.alpha > 128
  501.       contents.fill_rect(pos[:x], y, text_width, text_height, colour)
  502.     end
  503.   end
  504. end

  505. #===============================================================================
  506. # ** Window_Message
  507. #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  508. #  Summary of Changes:
  509. #    aliased method - clear_instance_variables; process_escape_character;
  510. #      update_show_fast; wait_for_one_character
  511. #    overwritten super method - reset_font_settings
  512. #===============================================================================

  513. class Window_Message
  514.   #--------------------------------------------------------------------------~
  515.   # * Clear Instance Variables
  516.   #--------------------------------------------------------------------------~
  517.   alias ma_atssmc_clrinsvar_3dq9 clear_instance_variables
  518.   def clear_instance_variables(*args, &block)
  519.     ma_atssmc_clrinsvar_3dq9(*args, &block) # Run Original Method
  520.     @skip_disabled = false
  521.   end
  522.   #--------------------------------------------------------------------------~
  523.   # * Reset Font Settings
  524.   #--------------------------------------------------------------------------~
  525.   def reset_font_settings(*args, &block)
  526.     change_color(normal_color)
  527.     contents.font.name = $game_message.font_name
  528.     contents.font.size = $game_message.font_size
  529.     contents.font.bold = $game_message.font_bold
  530.     contents.font.italic = $game_message.font_italic
  531.     contents.font.outline = $game_message.font_outline
  532.     contents.font.shadow = $game_message.font_shadow
  533.     @underline = $game_message.font_underline
  534.     @highlight = $game_message.font_highlight
  535.   end
  536.   #--------------------------------------------------------------------------~
  537.   # * Process Escape Character
  538.   #--------------------------------------------------------------------------~
  539.   alias mnaa_atssmc_escchar_3dr9 process_escape_character
  540.   def process_escape_character(code, text, pos, *args, &block)
  541.     case code.upcase
  542.     when 'MS' # Set Message Speed
  543.       if !text[/^\[([+-])/].nil?
  544.         text.sub!(/^\[([\+-])/, '[' )
  545.         sign = $1
  546.       else
  547.         sign = ""
  548.       end
  549.       param = obtain_escape_param(text)
  550.       sign.empty? ? $game_message.message_speed = param : $game_message.message_speed += "#{sign}#{param}".to_i
  551.       when 'DS'
  552.         text.slice!(/^%/) # Delete buffer to ensure code isn't overextended
  553.         @skip_disabled = !@skip_disabled
  554.       when 'W' then wait(obtain_escape_param(text))
  555.     else
  556.       mnaa_atssmc_escchar_3dr9(code, text, pos, *args, &block) # Run Original Method
  557.     end
  558.   end
  559.   #--------------------------------------------------------------------------~
  560.   # * Update Show Fast
  561.   #--------------------------------------------------------------------------~
  562.   alias mlg_atssmc_updshwfast_7yb1 update_show_fast
  563.   def update_show_fast(*args, &block)
  564.     mlg_atssmc_updshwfast_7yb1(*args, &block)
  565.     if $game_message.message_speed < 1
  566.       @show_fast = true
  567.     elsif @skip_disabled
  568.       @show_fast = false
  569.     elsif $game_message.show_fast_speed > 0
  570.       @show_fast = Input.press?(:C)
  571.     end
  572.   end
  573.   #--------------------------------------------------------------------------~
  574.   # * Wait for One Character
  575.   #--------------------------------------------------------------------------~
  576.   alias mdrnl_smcats_waitonechar_5rf1 wait_for_one_character
  577.   def wait_for_one_character(*args, &block)
  578.     mdrnl_smcats_waitonechar_5rf1(*args, &block) # Run Original Method
  579.     if (@show_fast || @line_show_fast) && $game_message.show_fast_speed > 0
  580.       wait($game_message.show_fast_speed)
  581.     elsif $game_message.message_speed > 1
  582.       wait($game_message.message_speed - 1)
  583.     end
  584.   end
  585. end
复制代码


YEA对话系统\fn[x]    - Changes font name to x.
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Ace Message System v1.05
  4. # -- Last Updated: 2012.01.13
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

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

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.07.21 - Fixed REGEXP error at line 824
  15. # 2012.01.13 - Bug Fixed: Negative tags didn't display other party members.
  16. # 2012.01.12 - Compatibility Update: Message Actor Codes
  17. # 2012.01.10 - Added Feature: \pic[x] text code.
  18. # 2012.01.04 - Bug Fixed: \ic tag was \ii. No longer the case.
  19. #            - Added: Scroll Text window now uses message window font.
  20. # 2011.12.31 - Started Script and Finished.
  21. #
  22. #==============================================================================
  23. # ▼ Introduction
  24. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  25. # While RPG Maker VX Ace certainly improved the message system a whole lot, it
  26. # wouldn't hurt to add in a few more features, such as name windows, converting
  27. # textcodes to write out the icons and/or names of items, weapons, armours, and
  28. # more in quicker fashion. This script also gives the developer the ability to
  29. # adjust the size of the message window during the game, give it a separate
  30. # font, and to give the player a text fast-forward feature.
  31. #
  32. #==============================================================================
  33. # ▼ Instructions
  34. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  35. # To install this script, open up your script editor and copy/paste this script
  36. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  37. #
  38. # -----------------------------------------------------------------------------
  39. # Message Window text Codes - These go inside of your message window.
  40. # -----------------------------------------------------------------------------
  41. #  Default:    Effect:
  42. #    \v[x]     - Writes variable x's value.
  43. #    \n[x]     - Writes actor x's name.
  44. #    \p[x]     - Writes party member x's name.
  45. #    \g        - Writes gold currency name.
  46. #    \c[x]     - Changes the colour of the text to x.
  47. #    \i[x]     - Draws icon x at position of the text.
  48. #    \{        - Makes text bigger by 8 points.
  49. #    \}        - Makes text smaller by 8 points.
  50. #    \$        - Opens gold window.
  51. #    \.        - Waits 15 frames (quarter second).
  52. #    \|        - Waits 60 frames (a full second).
  53. #    \!        - Waits until key is pressed.
  54. #    \>        - Following text is instant.
  55. #    \<        - Following text is no longer instant.
  56. #    \^        - Skips to the next message.
  57. #    \\        - Writes a "" in the window.
  58. #
  59. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  60. #
  61. #  Wait:       Effect:
  62. #    \w[x]     - Waits x frames (60 frames = 1 second). Message window only.
  63. #
  64. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  65. #
  66. #  NameWindow: Effect:
  67. #    \n<x>     - Creates a name box with x string. Left side. *Note
  68. #    \nc<x>    - Creates a name box with x string. Centered. *Note
  69. #    \nr<x>    - Creates a name box with x string. Right side. *Note
  70. #
  71. #              *Note: Works for message window only.
  72. #
  73. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  74. #
  75. #  Position:   Effect:
  76. #    \px[x]    - Sets x position of text to x.
  77. #    \py[x]    - Sets y position of text to y.
  78. #
  79. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  80. #
  81. #  Picture:    Effect:
  82. #    \pic[x]   - Draws picture x from the Graphics\Pictures folder.
  83. #
  84. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  85. #
  86. #  Outline:    Effect:
  87. #    \oc[x]    - Sets outline colour to x.
  88. #    \oo[x]    - Sets outline opacity to x.
  89. #
  90. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  91. #
  92. #  Font:       Effect:
  93. #    \fr       - Resets all font changes.
  94. #    \fz[x]    - Changes font size to x.
  95. #    \fn[x]    - Changes font name to x.
  96. #    \fb       - Toggles font boldness.
  97. #    \fi       - Toggles font italic.
  98. #    \fo       - Toggles font outline.
  99. #    \fs       - Toggles font shadow.
  100. #
  101. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  102. #
  103. #  Actor:      Effect:
  104. #    \af[x]    - Shows face of actor x. *Note
  105. #    \ac[x]    - Writes out actor's class name. *Note
  106. #    \as[x]    - Writes out actor's subclass name. Req: Class System. *Note
  107. #    \an[x]    - Writes out actor's nickname. *Note
  108. #
  109. #              *Note: If x is 0 or negative, it will show the respective
  110. #               party member's face instead.
  111. #                   0 - Party Leader
  112. #                  -1 - 1st non-leader member.
  113. #                  -2 - 2nd non-leader member. So on.
  114. #
  115. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  116. #
  117. #  Names:      Effect:
  118. #    \nc[x]    - Writes out class x's name.
  119. #    \ni[x]    - Writes out item x's name.
  120. #    \nw[x]    - Writes out weapon x's name.
  121. #    \na[x]    - Writes out armour x's name.
  122. #    \ns[x]    - Writes out skill x's name.
  123. #    \nt[x]    - Writes out state x's name.
  124. #
  125. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  126. #
  127. #  Icon Names: Effect:
  128. #    \ic[x]    - Writes out class x's name including icon. *
  129. #    \ii[x]    - Writes out item x's name including icon.
  130. #    \iw[x]    - Writes out weapon x's name including icon.
  131. #    \ia[x]    - Writes out armour x's name including icon.
  132. #    \is[x]    - Writes out skill x's name including icon.
  133. #    \it[x]    - Writes out state x's name including icon.
  134. #
  135. #              *Note: Requires YEA - Class System
  136. #
  137. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  138. #
  139. # And those are the text codes added with this script. Keep in mind that some
  140. # of these text codes only work for the Message Window. Otherwise, they'll work
  141. # for help descriptions, actor biographies, and others.
  142. #
  143. #==============================================================================
  144. # ▼ Compatibility
  145. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  146. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  147. # it will run with RPG Maker VX without adjusting.
  148. #
  149. #==============================================================================

  150. module YEA
  151.   module MESSAGE
  152.    
  153.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  154.     # - General Message Settings -
  155.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  156.     # The following below will adjust the basic settings and that will affect
  157.     # the majority of the script. Adjust them as you see fit.
  158.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  159.     # This button is the button used to make message windows instantly skip
  160.     # forward. Hold down for the effect. Note that when held down, this will
  161.     # speed up the messages, but still wait for the pauses. However, it will
  162.     # automatically go to the next page when prompted.
  163.     TEXT_SKIP = :A     # Input::A is the shift button on keyboard.
  164.    
  165.     # This variable adjusts the number of visible rows shown in the message
  166.     # window. If you do not wish to use this feature, set this constant to 0.
  167.     # If the row value is 0 or below, it will automatically default to 4 rows.
  168.     VARIABLE_ROWS  = 0
  169.    
  170.     # This variable adjusts the width of the message window shown. If you do
  171.     # not wish to use this feature, set this constant to 0. If the width value
  172.     # is 0 or below, it will automatically default to the screen width.
  173.     VARIABLE_WIDTH = 0
  174.    
  175.     # This is the amount of space that the message window will indent whenever
  176.     # a face is used. Default: 112
  177.     FACE_INDENT_X = 112
  178.    
  179.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  180.     # - Name Window Settings -
  181.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  182.     # The name window is a window that appears outside of the main message
  183.     # window box to display whatever text is placed inside of it like a name.
  184.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  185.     NAME_WINDOW_X_BUFFER = -20     # Buffer x position of the name window.
  186.     NAME_WINDOW_Y_BUFFER = 0       # Buffer y position of the name window.
  187.     NAME_WINDOW_PADDING  = 20      # Padding added to the horizontal position.
  188.     NAME_WINDOW_OPACITY  = 255     # Opacity of the name window.
  189.     NAME_WINDOW_COLOUR   = 6       # Text colour used by default for names.
  190.    
  191.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  192.     # - Message Font Settings -
  193.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  194.     # Ace Message System separates the in-game system font form the message
  195.     # font. Adjust the settings here for your fonts.
  196.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  197.     # This array constant determines the fonts used. If the first font does not
  198.     # exist on the player's computer, the next font in question will be used
  199.     # in place instead and so on.
  200.     MESSAGE_WINDOW_FONT_NAME = ["Microsoft YaHei"]
  201.    
  202.     # These adjust the other settings regarding the way the game font appears
  203.     # including the font size, whether or not the font is bolded by default,
  204.     # italic by default, etc.
  205.     MESSAGE_WINDOW_FONT_SIZE    = 24       # Font size.
  206.     MESSAGE_WINDOW_FONT_BOLD    = false    # Default bold?
  207.     MESSAGE_WINDOW_FONT_ITALIC  = false    # Default italic?
  208.     MESSAGE_WINDOW_FONT_OUTLINE = true     # Default outline?
  209.     MESSAGE_WINDOW_FONT_SHADOW  = false    # Default shadow?
  210.    
  211.   end # MESSAGE
  212. end # YEA

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

  218. #==============================================================================
  219. # ■ Variable
  220. #==============================================================================

  221. module Variable
  222.   
  223.   #--------------------------------------------------------------------------
  224.   # self.message_rows
  225.   #--------------------------------------------------------------------------
  226.   def self.message_rows
  227.     return 4 if YEA::MESSAGE::VARIABLE_ROWS <= 0
  228.     return 4 if $game_variables[YEA::MESSAGE::VARIABLE_ROWS] <= 0
  229.     return $game_variables[YEA::MESSAGE::VARIABLE_ROWS]
  230.   end
  231.   
  232.   #--------------------------------------------------------------------------
  233.   # self.message_width
  234.   #--------------------------------------------------------------------------
  235.   def self.message_width
  236.     return Graphics.width if YEA::MESSAGE::VARIABLE_WIDTH <= 0
  237.     return Graphics.width if $game_variables[YEA::MESSAGE::VARIABLE_WIDTH] <= 0
  238.     return $game_variables[YEA::MESSAGE::VARIABLE_WIDTH]
  239.   end
  240.   
  241. end # Variable

  242. #==============================================================================
  243. # ■ Game_Interpreter
  244. #==============================================================================

  245. class Game_Interpreter
  246.   
  247.   #--------------------------------------------------------------------------
  248.   # overwrite method: command_101
  249.   #--------------------------------------------------------------------------
  250.   def command_101
  251.     wait_for_message
  252.     $game_message.face_name = @params[0]
  253.     $game_message.face_index = @params[1]
  254.     $game_message.background = @params[2]
  255.     $game_message.position = @params[3]
  256.     while continue_message_string?
  257.       @index += 1
  258.       if @list[@index].code == 401
  259.         $game_message.add(@list[@index].parameters[0])
  260.       end
  261.       break if $game_message.texts.size >= Variable.message_rows
  262.     end
  263.     case next_event_code
  264.     when 102
  265.       @index += 1
  266.       setup_choices(@list[@index].parameters)
  267.     when 103
  268.       @index += 1
  269.       setup_num_input(@list[@index].parameters)
  270.     when 104
  271.       @index += 1
  272.       setup_item_choice(@list[@index].parameters)
  273.     end
  274.     wait_for_message
  275.   end
  276.   
  277.   #--------------------------------------------------------------------------
  278.   # new method: continue_message_string?
  279.   #--------------------------------------------------------------------------
  280.   def continue_message_string?
  281.     return true if next_event_code == 101 && Variable.message_rows > 4
  282.     return next_event_code == 401
  283.   end
  284.   
  285. end # Game_Interpreter

  286. #==============================================================================
  287. # ■ Window_Base
  288. #==============================================================================

  289. class Window_Base < Window
  290.   
  291.   #--------------------------------------------------------------------------
  292.   # new method: setup_message_font
  293.   #--------------------------------------------------------------------------
  294.   def setup_message_font
  295.     @message_font = true
  296.     change_color(normal_color)
  297.     contents.font.out_color = Font.default_out_color
  298.     contents.font.name = YEA::MESSAGE::MESSAGE_WINDOW_FONT_NAME
  299.     contents.font.size = YEA::MESSAGE::MESSAGE_WINDOW_FONT_SIZE
  300.     contents.font.bold = YEA::MESSAGE::MESSAGE_WINDOW_FONT_BOLD
  301.     contents.font.italic = YEA::MESSAGE::MESSAGE_WINDOW_FONT_ITALIC
  302.     contents.font.outline = YEA::MESSAGE::MESSAGE_WINDOW_FONT_OUTLINE
  303.     contents.font.shadow = YEA::MESSAGE::MESSAGE_WINDOW_FONT_SHADOW
  304.   end
  305.   
  306.   #--------------------------------------------------------------------------
  307.   # alias method: reset_font_settings
  308.   #--------------------------------------------------------------------------
  309.   alias window_base_reset_font_settings_ams reset_font_settings
  310.   def reset_font_settings
  311.     if @message_font
  312.       setup_message_font
  313.     else
  314.       window_base_reset_font_settings_ams
  315.       contents.font.out_color = Font.default_out_color
  316.       contents.font.outline = Font.default_outline
  317.       contents.font.shadow = Font.default_shadow
  318.     end
  319.   end
  320.   
  321.   #--------------------------------------------------------------------------
  322.   # alias method: convert_escape_characters
  323.   #--------------------------------------------------------------------------
  324.   alias window_base_convert_escape_characters_ams convert_escape_characters
  325.   def convert_escape_characters(text)
  326.     result = window_base_convert_escape_characters_ams(text)
  327.     result = convert_ace_message_system_new_escape_characters(result)
  328.     return result
  329.   end
  330.   
  331.   #--------------------------------------------------------------------------
  332.   # new method: convert_ace_message_system_new_escape_characters
  333.   #--------------------------------------------------------------------------
  334.   def convert_ace_message_system_new_escape_characters(result)
  335.     #---
  336.     result.gsub!(/\eFR/i) { "\eAMSF[0]" }
  337.     result.gsub!(/\eFB/i) { "\eAMSF[1]" }
  338.     result.gsub!(/\eFI/i) { "\eAMSF[2]" }
  339.     result.gsub!(/\eFO/i) { "\eAMSF[3]" }
  340.     result.gsub!(/\eFS/i) { "\eAMSF[4]" }
  341.     #---
  342.     result.gsub!(/\eAC\[([-+]?\d+)\]/i) { escape_actor_class_name($1.to_i) }
  343.     result.gsub!(/\eAS\[([-+]?\d+)\]/i) { escape_actor_subclass_name($1.to_i) }
  344.     result.gsub!(/\eAN\[([-+]?\d+)\]/i) { escape_actor_nickname($1.to_i) }
  345.     #---
  346.     result.gsub!(/\eNC\[(\d+)\]/i) { $data_classes[$1.to_i].name }
  347.     result.gsub!(/\eNI\[(\d+)\]/i) { $data_items[$1.to_i].name }
  348.     result.gsub!(/\eNW\[(\d+)\]/i) { $data_weapons[$1.to_i].name }
  349.     result.gsub!(/\eNA\[(\d+)\]/i) { $data_armors[$1.to_i].name }
  350.     result.gsub!(/\eNS\[(\d+)\]/i) { $data_skills[$1.to_i].name }
  351.     result.gsub!(/\eNT\[(\d+)\]/i) { $data_states[$1.to_i].name }
  352.     #---
  353.     result.gsub!(/\eIC\[(\d+)\]/i) { escape_icon_item($1.to_i, :class) }
  354.     result.gsub!(/\eII\[(\d+)\]/i) { escape_icon_item($1.to_i, :item) }
  355.     result.gsub!(/\eIW\[(\d+)\]/i) { escape_icon_item($1.to_i, :weapon) }
  356.     result.gsub!(/\eIA\[(\d+)\]/i) { escape_icon_item($1.to_i, :armour) }
  357.     result.gsub!(/\eIS\[(\d+)\]/i) { escape_icon_item($1.to_i, :skill) }
  358.     result.gsub!(/\eIT\[(\d+)\]/i) { escape_icon_item($1.to_i, :state) }
  359.     #---
  360.     return result
  361.   end
  362.   
  363.   #--------------------------------------------------------------------------
  364.   # new method: escape_actor_class_name
  365.   #--------------------------------------------------------------------------
  366.   def escape_actor_class_name(actor_id)
  367.     actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
  368.     actor = $game_actors[actor_id]
  369.     return "" if actor.nil?
  370.     return actor.class.name
  371.   end
  372.   
  373.   #--------------------------------------------------------------------------
  374.   # new method: actor_subclass_name
  375.   #--------------------------------------------------------------------------
  376.   def escape_actor_subclass_name(actor_id)
  377.     return "" unless $imported["YEA-ClassSystem"]
  378.     actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
  379.     actor = $game_actors[actor_id]
  380.     return "" if actor.nil?
  381.     return "" if actor.subclass.nil?
  382.     return actor.subclass.name
  383.   end
  384.   
  385.   #--------------------------------------------------------------------------
  386.   # new method: escape_actor_nickname
  387.   #--------------------------------------------------------------------------
  388.   def escape_actor_nickname(actor_id)
  389.     actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
  390.     actor = $game_actors[actor_id]
  391.     return "" if actor.nil?
  392.     return actor.nickname
  393.   end
  394.   
  395.   #--------------------------------------------------------------------------
  396.   # new method: escape_icon_item
  397.   #--------------------------------------------------------------------------
  398.   def escape_icon_item(data_id, type)
  399.     case type
  400.     when :class
  401.       return "" unless $imported["YEA-ClassSystem"]
  402.       icon = $data_classes[data_id].icon_index
  403.       name = $data_items[data_id].name
  404.     when :item
  405.       icon = $data_items[data_id].icon_index
  406.       name = $data_items[data_id].name
  407.     when :weapon
  408.       icon = $data_weapons[data_id].icon_index
  409.       name = $data_weapons[data_id].name
  410.     when :armour
  411.       icon = $data_armors[data_id].icon_index
  412.       name = $data_armors[data_id].name
  413.     when :skill
  414.       icon = $data_skills[data_id].icon_index
  415.       name = $data_skills[data_id].name
  416.     when :state
  417.       icon = $data_states[data_id].icon_index
  418.       name = $data_states[data_id].name
  419.     else; return ""
  420.     end
  421.     text = "\eI[#{icon}]" + name
  422.     return text
  423.   end
  424.   
  425.   #--------------------------------------------------------------------------
  426.   # alias method: process_escape_character
  427.   #--------------------------------------------------------------------------
  428.   alias window_base_process_escape_character_ams process_escape_character
  429.   def process_escape_character(code, text, pos)
  430.     case code.upcase
  431.     #---
  432.     when 'FZ'
  433.       contents.font.size = obtain_escape_param(text)
  434.     when 'FN'
  435.       text.sub!(/\[(.*?)\]/, "")
  436.       font_name = $1.to_s
  437.       font_name = Font.default_name if font_name.nil?
  438.       contents.font.name = font_name.to_s
  439.     #---
  440.     when 'OC'
  441.       colour = text_color(obtain_escape_param(text))
  442.       contents.font.out_color = colour
  443.     when 'OO'
  444.       contents.font.out_color.alpha = obtain_escape_param(text)
  445.     #---
  446.     when 'AMSF'
  447.       case obtain_escape_param(text)
  448.       when 0; reset_font_settings
  449.       when 1; contents.font.bold = !contents.font.bold
  450.       when 2; contents.font.italic = !contents.font.italic
  451.       when 3; contents.font.outline = !contents.font.outline
  452.       when 4; contents.font.shadow = !contents.font.shadow
  453.       end
  454.     #---
  455.     when 'PX'
  456.       pos[:x] = obtain_escape_param(text)
  457.     when 'PY'
  458.       pos[:y] = obtain_escape_param(text)
  459.     #---
  460.     when 'PIC'
  461.       text.sub!(/\[(.*?)\]/, "")
  462.       bmp = Cache.picture($1.to_s)
  463.       rect = Rect.new(0, 0, bmp.width, bmp.height)
  464.       contents.blt(pos[:x], pos[:y], bmp, rect)
  465.     #---
  466.     else
  467.       window_base_process_escape_character_ams(code, text, pos)
  468.     end
  469.   end
  470.   
  471. end # Window_Base

  472. #==============================================================================
  473. # ■ Window_ChoiceList
  474. #==============================================================================

  475. class Window_ChoiceList < Window_Command
  476.   
  477.   #--------------------------------------------------------------------------
  478.   # alias method: initialize
  479.   #--------------------------------------------------------------------------
  480.   alias window_choicelist_initialize_ams initialize
  481.   def initialize(message_window)
  482.     window_choicelist_initialize_ams(message_window)
  483.     setup_message_font
  484.   end
  485.   
  486. end # Window_ChoiceList

  487. #==============================================================================
  488. # ■ Window_ScrollText
  489. #==============================================================================

  490. class Window_ScrollText < Window_Base
  491.   
  492.   #--------------------------------------------------------------------------
  493.   # alias method: initialize
  494.   #--------------------------------------------------------------------------
  495.   alias window_scrolltext_initialize_ams initialize
  496.   def initialize
  497.     window_scrolltext_initialize_ams
  498.     setup_message_font
  499.   end
  500.   
  501. end # Window_ScrollText

  502. #==============================================================================
  503. # ■ Window_NameMessage
  504. #==============================================================================

  505. class Window_NameMessage < Window_Base
  506.   
  507.   #--------------------------------------------------------------------------
  508.   # initialize
  509.   #--------------------------------------------------------------------------
  510.   def initialize(message_window)
  511.     @message_window = message_window
  512.     super(0, 0, Graphics.width, fitting_height(1))
  513.     self.opacity = YEA::MESSAGE::NAME_WINDOW_OPACITY
  514.     self.z = @message_window.z + 1
  515.     self.openness = 0
  516.     setup_message_font
  517.     @close_counter = 0
  518.     deactivate
  519.   end
  520.   
  521.   #--------------------------------------------------------------------------
  522.   # update
  523.   #--------------------------------------------------------------------------
  524.   def update
  525.     super
  526.     return if self.active
  527.     return if self.openness == 0
  528.     return if @closing
  529.     @close_counter -= 1
  530.     return if @close_counter > 0
  531.     close
  532.   end
  533.   
  534.   #--------------------------------------------------------------------------
  535.   # start_close
  536.   #--------------------------------------------------------------------------
  537.   def start_close
  538.     @close_counter = 4
  539.     deactivate
  540.   end
  541.   
  542.   #--------------------------------------------------------------------------
  543.   # force_close
  544.   #--------------------------------------------------------------------------
  545.   def force_close
  546.     @close_counter = 0
  547.     deactivate
  548.     close
  549.   end
  550.   
  551.   #--------------------------------------------------------------------------
  552.   # start
  553.   #--------------------------------------------------------------------------
  554.   def start(text, x_position)
  555.     @text = text.clone
  556.     set_width
  557.     create_contents
  558.     set_x_position(x_position)
  559.     set_y_position
  560.     refresh
  561.     activate
  562.     open
  563.   end
  564.   
  565.   #--------------------------------------------------------------------------
  566.   # set_width
  567.   #--------------------------------------------------------------------------
  568.   def set_width
  569.     text = @text.clone
  570.     dw = standard_padding * 2 + text_size(text).width
  571.     dw += YEA::MESSAGE::NAME_WINDOW_PADDING * 2
  572.     dw += calculate_size(text.slice!(0, 1), text) until text.empty?
  573.     self.width = dw
  574.   end
  575.   
  576.   #--------------------------------------------------------------------------
  577.   # calculate_size
  578.   #--------------------------------------------------------------------------
  579.   def calculate_size(code, text)
  580.     case code
  581.     when "\e"
  582.       return calculate_escape_code_width(obtain_escape_code(text), text)
  583.     else
  584.       return 0
  585.     end
  586.   end
  587.   
  588.   #--------------------------------------------------------------------------
  589.   # calculate_escape_code_width
  590.   #--------------------------------------------------------------------------
  591.   def calculate_escape_code_width(code, text)
  592.     dw = -text_size("\e").width - text_size(code).width
  593.     case code.upcase
  594.     when 'C', 'OC', 'OO'
  595.       dw += -text_size("[" + obtain_escape_param(text).to_s + "]").width
  596.       return dw
  597.     when 'I'
  598.       dw += -text_size("[" + obtain_escape_param(text).to_s + "]").width
  599.       dw += 24
  600.       return dw
  601.     when '{'
  602.       make_font_bigger
  603.     when '}'
  604.       make_font_smaller
  605.     when 'FZ'
  606.       contents.font.size = obtain_escape_param(text)
  607.     when 'FN'
  608.       text.sub!(/\[(.*?)\]/, "")
  609.       font_name = $1.to_s
  610.       font_name = Font.default_name if font_name.nil?
  611.       contents.font.name = font_name.to_s
  612.     when 'AMSF'
  613.       case obtain_escape_param(text)
  614.       when 0; reset_font_settings
  615.       when 1; contents.font.bold = !contents.font.bold
  616.       when 2; contents.font.italic = !contents.font.italic
  617.       when 3; contents.font.outline = !contents.font.outline
  618.       when 4; contents.font.shadow = !contents.font.shadow
  619.       end
  620.     else
  621.       return dw
  622.     end
  623.   end
  624.   
  625.   #--------------------------------------------------------------------------
  626.   # set_y_position
  627.   #--------------------------------------------------------------------------
  628.   def set_x_position(x_position)
  629.     case x_position
  630.     when 1 # Left
  631.       self.x = @message_window.x
  632.       self.x += YEA::MESSAGE::NAME_WINDOW_X_BUFFER
  633.     when 2 # 3/10
  634.       self.x = @message_window.x
  635.       self.x += @message_window.width * 3 / 10
  636.       self.x -= self.width / 2
  637.     when 3 # Center
  638.       self.x = @message_window.x
  639.       self.x += @message_window.width / 2
  640.       self.x -= self.width / 2
  641.     when 4 # 7/10
  642.       self.x = @message_window.x
  643.       self.x += @message_window.width * 7 / 10
  644.       self.x -= self.width / 2
  645.     when 5 # Right
  646.       self.x = @message_window.x + @message_window.width
  647.       self.x -= self.width
  648.       self.x -= YEA::MESSAGE::NAME_WINDOW_X_BUFFER
  649.     end
  650.     self.x = [[self.x, Graphics.width - self.width].min, 0].max
  651.   end
  652.   
  653.   #--------------------------------------------------------------------------
  654.   # set_y_position
  655.   #--------------------------------------------------------------------------
  656.   def set_y_position
  657.     case $game_message.position
  658.     when 0
  659.       self.y = @message_window.height
  660.       self.y -= YEA::MESSAGE::NAME_WINDOW_Y_BUFFER
  661.     else
  662.       self.y = @message_window.y - self.height
  663.       self.y += YEA::MESSAGE::NAME_WINDOW_Y_BUFFER
  664.     end
  665.   end
  666.   
  667.   #--------------------------------------------------------------------------
  668.   # refresh
  669.   #--------------------------------------------------------------------------
  670.   def refresh
  671.     contents.clear
  672.     reset_font_settings
  673.     @text = sprintf("\eC[%d]%s", YEA::MESSAGE::NAME_WINDOW_COLOUR, @text)
  674.     draw_text_ex(YEA::MESSAGE::NAME_WINDOW_PADDING, 0, @text)
  675.   end
  676.   
  677. end # Window_NameMessage

  678. #==============================================================================
  679. # ■ Window_Message
  680. #==============================================================================

  681. class Window_Message < Window_Base
  682.   
  683.   #--------------------------------------------------------------------------
  684.   # alias method: initialize
  685.   #--------------------------------------------------------------------------
  686.   alias window_message_initialize_ams initialize
  687.   def initialize
  688.     window_message_initialize_ams
  689.     setup_message_font
  690.   end
  691.   
  692.   #--------------------------------------------------------------------------
  693.   # overwrite method: window_width
  694.   #--------------------------------------------------------------------------
  695.   def window_width
  696.     return Variable.message_width
  697.   end
  698.   
  699.   #--------------------------------------------------------------------------
  700.   # overwrite method: window_height
  701.   #--------------------------------------------------------------------------
  702.   def window_height
  703.     return fitting_height(Variable.message_rows)
  704.   end
  705.   
  706.   #--------------------------------------------------------------------------
  707.   # alias method: create_all_windows
  708.   #--------------------------------------------------------------------------
  709.   alias window_message_create_all_windows_ams create_all_windows
  710.   def create_all_windows
  711.     window_message_create_all_windows_ams
  712.     @name_window = Window_NameMessage.new(self)
  713.   end
  714.   
  715.   #--------------------------------------------------------------------------
  716.   # overwrite method: create_back_bitmap
  717.   #--------------------------------------------------------------------------
  718.   def create_back_bitmap
  719.     @back_bitmap = Bitmap.new(width, height)
  720.     rect1 = Rect.new(0, 0, Graphics.width, 12)
  721.     rect2 = Rect.new(0, 12, Graphics.width, fitting_height(4) - 24)
  722.     rect3 = Rect.new(0, fitting_height(4) - 12, Graphics.width, 12)
  723.     @back_bitmap.gradient_fill_rect(rect1, back_color2, back_color1, true)
  724.     @back_bitmap.fill_rect(rect2, back_color1)
  725.     @back_bitmap.gradient_fill_rect(rect3, back_color1, back_color2, true)
  726.   end
  727.   
  728.   #--------------------------------------------------------------------------
  729.   # alias method: dispose_all_windows
  730.   #--------------------------------------------------------------------------
  731.   alias window_message_dispose_all_windows_ams dispose_all_windows
  732.   def dispose_all_windows
  733.     window_message_dispose_all_windows_ams
  734.     @name_window.dispose
  735.   end
  736.   
  737.   #--------------------------------------------------------------------------
  738.   # alias method: update_all_windows
  739.   #--------------------------------------------------------------------------
  740.   alias window_message_update_all_windows_ams update_all_windows
  741.   def update_all_windows
  742.     window_message_update_all_windows_ams
  743.     @name_window.update
  744.     @name_window.back_opacity = self.back_opacity
  745.     @name_window.opacity = self.opacity
  746.   end
  747.   
  748.   #--------------------------------------------------------------------------
  749.   # alias method: update_show_fast
  750.   #--------------------------------------------------------------------------
  751.   alias window_message_update_show_fast_ams update_show_fast
  752.   def update_show_fast
  753.     @show_fast = true if Input.press?(YEA::MESSAGE::TEXT_SKIP)
  754.     window_message_update_show_fast_ams
  755.   end
  756.   
  757.   #--------------------------------------------------------------------------
  758.   # overwrite method: input_pause
  759.   #--------------------------------------------------------------------------
  760.   def input_pause
  761.     self.pause = true
  762.     wait(10)
  763.     Fiber.yield until Input.trigger?(:B) || Input.trigger?(:C) ||
  764.       Input.press?(YEA::MESSAGE::TEXT_SKIP)
  765.     Input.update
  766.     self.pause = false
  767.   end
  768.   
  769.   #--------------------------------------------------------------------------
  770.   # overwrite method: convert_escape_characters
  771.   #--------------------------------------------------------------------------
  772.   def convert_escape_characters(text)
  773.     result = super(text.to_s.clone)
  774.     result = namebox_escape_characters(result)
  775.     result = message_escape_characters(result)
  776.     return result
  777.   end
  778.   
  779.   #--------------------------------------------------------------------------
  780.   # new method: namebox_escape_characters
  781.   #--------------------------------------------------------------------------
  782.   def namebox_escape_characters(result)
  783.     result.gsub!(/\eN\<(.+?)\>/i)  { namewindow($1, 1) }
  784.     result.gsub!(/\eN1\<(.+?)\>/i) { namewindow($1, 1) }
  785.     result.gsub!(/\eN2\<(.+?)\>/i) { namewindow($1, 2) }
  786.     result.gsub!(/\eNC\<(.+?)\>/i) { namewindow($1, 3) }
  787.     result.gsub!(/\eN3\<(.+?)\>/i) { namewindow($1, 3) }
  788.     result.gsub!(/\eN4\<(.+?)\>/i) { namewindow($1, 4) }
  789.     result.gsub!(/\eN5\<(.+?)\>/i) { namewindow($1, 5) }
  790.     result.gsub!(/\eNR\<(.+?)\>/i) { namewindow($1, 5) }
  791.     return result
  792.   end
  793.   
  794.   #--------------------------------------------------------------------------
  795.   # new method: namebox
  796.   #--------------------------------------------------------------------------
  797.   def namewindow(text, position)
  798.     @name_text = text
  799.     @name_position = position
  800.     return ""
  801.   end
  802.   
  803.   #--------------------------------------------------------------------------
  804.   # new method: message_escape_characters
  805.   #--------------------------------------------------------------------------
  806.   def message_escape_characters(result)
  807.     result.gsub!(/\eAF\[(-?\d+)]/i) { change_face($1.to_i) }
  808.     return result
  809.   end
  810.   
  811.   #--------------------------------------------------------------------------
  812.   # new method: change_face
  813.   #--------------------------------------------------------------------------
  814.   def change_face(actor_id)
  815.     actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
  816.     actor = $game_actors[actor_id]
  817.     return "" if actor.nil?
  818.     $game_message.face_name = actor.face_name
  819.     $game_message.face_index = actor.face_index
  820.     return ""
  821.   end
  822.   
  823.   #--------------------------------------------------------------------------
  824.   # alias method: new_page
  825.   #--------------------------------------------------------------------------
  826.   alias window_message_new_page_ams new_page
  827.   def new_page(text, pos)
  828.     adjust_message_window_size
  829.     window_message_new_page_ams(text, pos)
  830.   end
  831.   
  832.   #--------------------------------------------------------------------------
  833.   # overwrite method: new_line_x
  834.   #--------------------------------------------------------------------------
  835.   def new_line_x
  836.     return $game_message.face_name.empty? ? 0 : YEA::MESSAGE::FACE_INDENT_X
  837.   end
  838.   
  839.   #--------------------------------------------------------------------------
  840.   # new method: adjust_message_window_size
  841.   #--------------------------------------------------------------------------
  842.   def adjust_message_window_size
  843.     self.height = window_height
  844.     self.width = window_width
  845.     create_contents
  846.     update_placement
  847.     self.x = (Graphics.width - self.width) / 2
  848.     start_name_window
  849.   end
  850.   
  851.   #--------------------------------------------------------------------------
  852.   # new method: clear_name_window
  853.   #--------------------------------------------------------------------------
  854.   def clear_name_window
  855.     @name_text = ""
  856.     @name_position = 0
  857.   end
  858.   
  859.   #--------------------------------------------------------------------------
  860.   # new method: start_name_window
  861.   #--------------------------------------------------------------------------
  862.   def start_name_window
  863.     @name_text ||= ""
  864.     return if @name_text == ""
  865.     @name_window.start(@name_text, @name_position)
  866.   end
  867.   
  868.   #--------------------------------------------------------------------------
  869.   # overwrite method: fiber_main
  870.   #--------------------------------------------------------------------------
  871.   def fiber_main
  872.     $game_message.visible = true
  873.     update_background
  874.     update_placement
  875.     loop do
  876.       process_all_text if $game_message.has_text?
  877.       process_input
  878.       $game_message.clear
  879.       @gold_window.close
  880.       @name_window.start_close
  881.       Fiber.yield
  882.       break unless text_continue?
  883.     end
  884.     close_and_wait
  885.     $game_message.visible = false
  886.     @fiber = nil
  887.   end
  888.   
  889.   #--------------------------------------------------------------------------
  890.   # alias method: open_and_wait
  891.   #--------------------------------------------------------------------------
  892.   alias window_message_open_and_wait_ams open_and_wait
  893.   def open_and_wait
  894.     clear_name_window
  895.     adjust_message_window_size
  896.     window_message_open_and_wait_ams
  897.   end
  898.   
  899.   #--------------------------------------------------------------------------
  900.   # alias method: close_and_wait
  901.   #--------------------------------------------------------------------------
  902.   alias window_message_close_and_wait_ams close_and_wait
  903.   def close_and_wait
  904.     @name_window.force_close
  905.     window_message_close_and_wait_ams
  906.   end
  907.   
  908.   #--------------------------------------------------------------------------
  909.   # alias method: all_close?
  910.   #--------------------------------------------------------------------------
  911.   alias window_message_all_close_ams all_close?
  912.   def all_close?
  913.     return window_message_all_close_ams && @name_window.close?
  914.   end
  915.   
  916.   #--------------------------------------------------------------------------
  917.   # alias method: process_escape_character
  918.   #--------------------------------------------------------------------------
  919.   alias window_message_process_escape_character_ams process_escape_character
  920.   def process_escape_character(code, text, pos)
  921.     case code.upcase
  922.     when 'W' # Wait
  923.       wait(obtain_escape_param(text))
  924.     else
  925.       window_message_process_escape_character_ams(code, text, pos)
  926.     end
  927.   end
  928.   
  929. end # Window_Message

  930. #==============================================================================
  931. #
  932. # ▼ End of File
  933. #
  934. #==============================================================================
复制代码
回复 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
星屑
30103
在线时间
5741 小时
注册时间
2016-3-8
回帖
1662
发表于 2020-10-15 21:32:09 | 显示全部楼层
本帖最后由 alexncf125 于 2020-10-15 21:36 编辑
alianlord 发表于 2020-10-15 20:59
唉唷!!!千行大咒!!!
                                      :    :
                  ...


把相关代码抠出来很难么??
这十多行就是了

  1. class Window_Base < Window
  2.   alias window_base_process_escape_character_sam process_escape_character
  3.   def process_escape_character(code, text, pos)
  4.     case code.upcase
  5.     when 'FN'
  6.       text.sub!(/\[(.*?)\]/, "")
  7.       font_name = $1.to_s
  8.       font_name = Font.default_name if font_name.nil?
  9.       contents.font.name = font_name.to_s
  10.     else
  11.       window_base_process_escape_character_sam(code, text, pos)
  12.     end
  13.   end
  14. end
复制代码
回复

使用道具 举报

梦石
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.

在本版发帖返回顶部