- =begin 
- 吹きだしウィンドウVXAce 
-   
- 2011年12月25日 tamura改造 
- 2014年06月03日 改訂 
-   
- ※このスクリプトは、ちいさな本屋様([url]http://xrxs.at-ninja.jp/[/url]) 
- が製作されたものをtamuraがACE用に改造した物です。 
-   
- 原版: 
-  ▽▽▽ XRXSv2. メッセージ表示フルグレードアップVX ▽▽▽ 
-  publish 2010/ 3/ 2 
-  update  - 11/ 1/10a 
-   
-   
- ※※警告※※ 
- THINK_TAIL や SYSTEM_LINE の機能を使わない場合は、 
- これらに使用していないスイッチを割り当てておいてください。 
-   
-   
- 「立ち絵機能」をONにしている時に、立ち絵を表示せずに、ウィンドウ位置を 
- 右か左に変更した時、テールのY座標がずれるようです。 
- 原因は調査中です。立ち絵を表示しない時は、イベントコマンド「注釈」で、 
- 「立ち絵表示 off」と記述して立ち絵機能をOFFにしておいてください。 
-   
- ●機能一覧 
- ・イベントコマンド「スクリプト」で、$win_x $win_yに値を入力すると、 
-  ($win_x 、$win_y)の位置にウィンドウを表示する。画面左上が(0,0)。 
-   
- ・キーボードのQ(装備画面で前のキャラに戻るボタン)を押すと、 
-  ウィンドウが消える。Qか決定、キャンセルキーで元に戻る。 
-   
- ・イベントコマンド「スクリプト」で、 
- $name_right = true  
- と入力すれば、ネームウィンドウがウィンドウの右に移ります。 
- 元に戻すには、イベントコマンド「スクリプト」で 
- $name_right = false  
- と入力すれば、左側に戻ります。 
-   
-   
- ・SYSTEM_LINEに指定したスイッチをON/OFFにすると、 
- 文章の1行目を表示しない/表示する を切り替えることができます。 
-   
-   
- ・文章のどこでもいいので、以下の表記を行う。 
- ・ \name[] : []の中の文字を、ウィンドウ左上に小さく表示する。 
-  表示させる名前には、制御文字 \V、\P、\N、\G が使用可能。 
-   
- ・ポップアップウィンドウの表示の仕方。 
-  \h[-1] : プレーヤーの上にウィンドウをポップ。 
-  \h[0] : 現在アクティブのイベントの上にウィンドウをポップ。 
-  \h[1] : IDが1番のイベントの上にウィンドウをポップする。 
-  hは大文字でもOK。 
-  \h[ナタリー] : イベントの名前がナタリーとなっているイベントの上にポップする。 
-   
- ・サイドビュー導入時 
-  \h[1] : 指定された番号の者の上にウィンドウをポップ。 
-   アクター側から1、2、3……、終わったら次に敵グループを加算して数える。 
-   パーティの3番目は3、パーティが4人なら敵の1番目は5、ということ。 
-  \h[スライムA] : 名前がスライムAとなっている者にポップ。 
-   
-  ポップアップを行うとき、 
-  「メッセージの表示」の設定で、ウィンドウの「表示位置」によって、 
-  ウィンドウがイベントの上に出るか下に出るかを設定できます。 
-   
- ウィンドウは通常の大きさのまま、テールだけ表示したい場合は、 
-  \t[-2] : ウィンドウが上下に表示される時は、X座標をMINAS_TWE_X_POSで固定。 
-            $win_x で左右に表示される時は、Y座標がウィンドウの中心やや下で固定。 
-  \t[-3] : ウィンドウが上下に表示される時は、X座標をMINAS_THREE_X_POSで固定。 
-            $win_x で左右に表示される時は、Y座標がウィンドウの中心やや下で固定。 
-  \t[-1] : プレーヤーの上に向かってテール表示。 
-  \t[0] : 現在アクティブのイベントに向かってテール表示。 
-  \t[1] : IDが1番のイベントの上に向かってテール表示。 
-   
-  その他 
-  \O[128] : 文字を透明にする。128はalphaの値で、0で透明、255で通常。 
-  \D : 文字に影をつける 
-  \hold : メッセージ表示の、最後の文章に限定。 
-       メッセージが終わっても、ウィンドウを閉じずに残します。 
-       他のメッセージが表示されて次へ送られる時に消えます。 
-       なお、ホールドされているウィンドウは、Qボタンで消せません。 
-   
-  \skin[skin01] : ウィンドウスキンを、skin01.png に変更します。 
-      VXACEのデフォルトに戻したい場合は \skin[Window] です。 
-      スキンのファイルは必ず Graphics\System フォルダに入れておいてください。 
-   
-  \tone[-34,0,68,0] : ウィンドウの色を変更します。 
-    この例だとVXACEのデフォルトです。 
-    データベースのシステムタブで、色を調べられます。 
-    4つ目の値はgrayと呼ばれ、通常は0です。 
-       
-   
-   
-   
-   
- ●その他 
- ・ACEに標準装備されている機能は通常通り使用できます。 
- ・A1殿([url]http://a1tktk.web.fc2.com/[/url])の立ち絵スクリプトに対応しています。 
-  このスクリプトの上に「RGSS3用A1共通処理」 
-  このスクリプトの下に「空メッセージでウィンドウを開かない」「立ち絵表示」を 
-  配置して下さい。 
-  残念ながら、「ネームウィンドウ」は使えません。上記\nameをお使いください。 
- ※立ち絵を表示しない時は、注釈で「立ち絵表示 off」とした方が無難です。 
- ・イベントの下から話しかけたら上へポップ、上から話しかけたら下へポップするという 
-  機能を追加。カスタマイズポイントで POP_DIRECTION = ture と変更のこと。 
-   
-   
- ●廃止機能  
- ・\Iがすでに使われているので、イタリック文字変換を廃止。 
- ・スピード変更、改行、最後に入手したアイテムの表示を、ACE化にともない廃止。 
-   
-   
- 【改訂履歴】 
- 2012.01.10  ・ウィンドウを消したまま次のウィンドウを自動で表示すると、 
-               ネームウィンドウが表示されるのを修正。 
- 2012.01.11  ・ネームウィンドウが出しっぱなしになるのを修正。 
- 2012.01.12  ・メニューを出してから決定ボタンを押すとネームウィンドウがでる不具合の修正。 
- 2012.02.01 ・ネームウィンドウのオープン&クローズのタイミングを変更。 
-       ・hold機能を追加。 
- 2012.02.10 ・キャラポップした時、一行ずつしか表示されない不具合を修正。 
- 2012.02.14 ・アイテム名などの文字数が正常に取得できなかったのを修正。 
- 2012.02.21 ・話しかけられた方向によって、ポップ方向を変えられるようにした。 
- 2012.02.25 ・すべてのシーン遷移の際はテールを破棄(イベント中でショップ起動など) 
- 2012.02.28 ・エスケープ文字の処理が上手くいかない問題について暫定対策。 
- 2012.03.05 ・微妙にウィンドウ幅が足りない時があったので、僅かにウィンドウ幅追加。 
- 2012.03.14 ・ポップアップ時の顔グラ表示に対応。 
- 2012.04.20 ・吹きだしが大型になると選択肢が入りきらない不具合の修正。 
-             ・ネームウィンドウが残ったままシーン遷移があると、ネームウィンドウが 
-              閉じない不具合の修正。 
- 2012.05.02  ・名前には、制御文字 \V、\P、\N、\G が使用可能。 
-             ・\V については、2段階の入れ子が使用可能。 
-             ・ウィンドウ消去機能を、「背景を暗くする」に対応。 
- 2012.05.09 ・通常の上表示のとき、ネームウィンドウが見切れるので少し下にずらす。 
- 2012.05.12 ・ネームウィンドウの幅と高さを変更可能にした。 
-             ・ネームウィンドウの高さを変えると、どんどん下に伸びるのを修正。 
- 2012.07.15 ・イベントコマンドで、$name_right = true と入力すると、 
-        名前ウィンドウが右に移ります。 
- 2012.08.26 ・思案型テールへの変更機能追加。 
-             ・文章の1行目を表示しない機能は、スイッチを使えるようにした。 
-              (セーブ&ロードに対応していないため) 
-              なお、従来の$system_line も使用可能。 
- 2012.10.08 ・ウィンドウスキンおよびウィンドウの色を変更可能にした。 
- 2012.10.16 ・立ち絵の指定がない時にエラーが起こるのを修正。 
- 2012.10.17 ・A1殿の立ち絵スクリプトの最新版に対応。 
- 2013.06.20 ・上記の説明が間違っている個所があったので修正。 
- 2014.02.12 ・文字の色を変えると不自然なスペースができるのを修正。 
- 2014.06.03 ・サイドビュー導入時でもウィンドウを表示できるようにしました。 
-       ・名前を指定して、ポップアップウィンドウを表示できるようになりました。 
-   
- =end 
-   
- #============================================================================== 
- # カスタマイズポイント 
- #============================================================================== 
- #=begin 
- class Window_Message < Window_Base 
-   # 
-   # 基本行数 
-   # 
-   MAX_LINE = 4 
-   # 
-   # \p[] - キャラポップの高さ 
-   # 
-   CHARPOP_HEIGHT = 40 
-   # 
-   # 
-   #\name[]で表示されるウィンドウのX座標、Y座標、幅、高さ の変更値。 
-   #座標は、メッセージウィンドウの左上端が原点。名前はウィンドウ中央に表示。 
-   NAME_WINDOW_OFFSET_X =   0 
-   NAME_WINDOW_OFFSET_Y = -37 
-   NAME_WINDOW_OFFSET_WIDTH = 0 
-   NAME_WINDOW_OFFSET_HIGHT = 5 
-   
-   # 
-   # 
-   MINAS_TWE_X_POS = 100 # $t[-2]のときの、テールのX座標。 
-   MINAS_THREE_X_POS = 444 # $t[-3]のときの、テールのX座標。 
-   
-   POP_DIRECTION = false #イベントの方向を考慮。 
-   
-   THINK_TAIL = 101 #この番号のゲームスイッチがONの時、思案型テールになります。 
-   SYSTEM_LINE = 102 #この番号のゲームスイッチがONの時、最初の1行を表示しません。 
-   
- end 
-   
- #(メモ)上表示で、ネームウィンドウのために少し下にずらす機能は、 
- #再定義したupdate_placement_positionのところ。 
-   
- #============================================================================== 
- # ■ BattleManager 
- #------------------------------------------------------------------------------ 
- #  戦闘の進行を管理するモジュールです。 
- #============================================================================== 
- module BattleManager 
-   #-------------------------------------------------------------------------- 
-   # ● 逃走の処理 
-   #-------------------------------------------------------------------------- 
-   def self.process_escape_hukidasi 
-     $now_escape = true 
-     process_escape_hukidasi_default 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● クラスメソッドのエイリアス 
-   #-------------------------------------------------------------------------- 
-   class << self 
-     alias :process_escape_hukidasi_default :process_escape 
-     alias :process_escape :process_escape_hukidasi 
-   end 
- end   
-   
- #============================================================================== 
- # 参照機能 
- #============================================================================== 
- class Game_Temp 
-   attr_accessor :last_gain_material 
-   attr_accessor :last_gain_holder 
- end 
-   
- #============================================================================== 
- # ■ Game_Event 
- #============================================================================== 
- class Game_Event < Game_Character 
-   #-------------------------------------------------------------------------- 
-   # ● 公開インスタンス変数 
-   #-------------------------------------------------------------------------- 
-   attr_reader   :event 
- end   
-   
- class Window_Message < Window_Base 
-   #-------------------------------------------------------------------------- 
-   # ● 改ページ処理 
-   #-------------------------------------------------------------------------- 
-   def new_page(text, pos) 
-     contents.clear 
-     draw_face($game_message.face_name, $game_message.face_index, 0, 0) 
-     reset_font_settings 
-     pos[:x] = new_line_x 
-   
-     #変更部分。システム用の一行目を表示しない。 
-     if $system_line != true and $game_switches[SYSTEM_LINE] != true 
-       pos[:y] = 0 
-     else 
-       if !$game_party.in_battle or $svhuki 
-         if $now_escape #逃走中。サイドビューでは、逃走中はin_battleがfalse 
-           pos[:y] = 0 
-           $now_escape = false 
-         else 
-           pos[:y] = 0 - line_height #最初の一行を表示しない。 
-         end 
-       else 
-         pos[:y] = 0 
-       end 
-     end 
-   
-     pos[:new_x] = new_line_x 
-     pos[:height] = calc_line_height(text) 
-     clear_flags 
-   end 
- end 
-   
- #============================================================================== 
- # フルグレードアップベース - 制御文字・基本機能 
- #============================================================================== 
- class Window_Message < Window_Base 
-   attr_accessor :tail 
-   #-------------------------------------------------------------------------- 
-   # ● 特殊文字の変換 + 準備 
-   #     変換・消去してもいい部分を処理、フラグのセット。 
-   #-------------------------------------------------------------------------- 
-   alias xrxsv2_convert_escape_characters convert_escape_characters 
-   def convert_escape_characters(text) 
-     #@textsが使いずらいので、ここで別変数に保管。 
-     @all_texts = [] 
-     str = text.gsub(/\\/) { "\e" } 
-     @all_texts = str.split("\n") 
-   
-     #この段階で、変数・アクター名を変換してしまう。 
-     #ネームウィンドウ内の文字を変換するため。 
-     text = convert_escape_characters_easy(text) 
-   
-     # 初期化 
-     contents.font.size   = Font.default_size 
-     contents.font.bold   = Font.default_italic 
-     contents.font.italic = Font.default_bold 
-     contents.font.shadow = Font.default_shadow 
-     @type_wait = 0 
-     @line_widths = [] 
-     @line_aligns = [] 
-     self.pop_character = nil 
-     # ウィンドウ保持指定\holdがあるか? 
-     @window_hold = (text.gsub!(/\\hold/) { "" } != nil) 
-     # \info 
-     @info_mode = (text.gsub!(/\\info/) { "" } != nil) 
-     # 改行削除指定\_があるか? 
-     if (/\\_(.*?)\x00/.match(@text)) != nil 
-       $game_message.choice_start -= 1 
-       text.gsub!(/\\_(.*?)\x00/) { $1.to_s } 
-     end 
-     # \name 判定 
-     if text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" } 
-       name = $1 
-       bitmap = @name_sprite.bitmap 
-       w = [bitmap.text_size(name).width, 1].max + NAME_WINDOW_OFFSET_WIDTH 
-       bitmap.dispose 
-       @name_sprite.bitmap = Bitmap.new(w, 32) 
-       bitmap = @name_sprite.bitmap 
-       bitmap.draw_text(0, 0, bitmap.width, bitmap.height, name) 
-       @name_window.width = w + 16 
-       @name_window.height = bitmap.height + NAME_WINDOW_OFFSET_HIGHT 
-       @name_window.create_contents 
-       @name_window.open if @name_window.openness == 0 
-       if self.visible #名前だけ表示されるのを防止。 
-         @name_window.visible = true 
-         @name_sprite.visible = true 
-       else 
-         @name_window.visible = false 
-         @name_sprite.visible = false 
-       end 
-     else 
-       @name_window.visible = false 
-       @name_sprite.visible = false 
-       @name_sprite.bitmap.dispose 
-       @name_sprite.bitmap = Bitmap.new(32,32) 
-     end 
-     $name = $1 #あれこれで使うので、ネームウィンドウに表示予定の名前を取得。 
-     #スキン変更 
-     if text.sub!(/\\[Ss]kin\[(.*?)\]/) { "" } 
-       skin = $1 
-       self.windowskin = Cache.system(skin) 
-       @name_window.windowskin = Cache.system(skin) 
-     end 
-     #ウィンドウトーン変更 
-     if text.sub!(/\\[Tt]one\[(\-?\d+),(\-?\d+),(\-?\d+),(\-?\d+)\]/) { "" } 
-       $game_system.window_tone.red = $1.to_f 
-       $game_system.window_tone.green = $2.to_f 
-       $game_system.window_tone.blue = $3.to_f 
-       $game_system.window_tone.gray = $4.to_f 
-     end 
-     # キャラボップモード 
-     if text.gsub!(/\\[Hh]\[-1\]/) { "" } 
-       self.pop_character = -1 
-     elsif text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "" } 
-       self.pop_character = $1.to_i 
-     elsif text.gsub!(/\\[Hh]\[(.*?)\]/) { "" } #名前指定(サイドビュー対応) 
-       self.pop_character = 0 #見つからないときのため、最初に0を入力。 
-       if $game_party.in_battle 
-         members = $game_party.members + $game_troop.members 
-         members.each_with_index {|member , index| 
-           if member.name == $1 
-             self.pop_character = index +1 
-             break 
-           end 
-         } 
-       else 
-         members = $game_map.events 
-         members.each_with_index {|member , index| 
-           if member[1].event.name == $1 
-             self.pop_character = index + 1 
-             break 
-           end 
-         } 
-       end 
-     elsif text.gsub!(/\\[Hh]/) { "" } 
-       self.pop_character = 0 
-     #テール表示モード 
-     elsif text.gsub!(/\\[Tt]\[-1\]/) { "" } 
-       self.tail_character = -1 
-     elsif text.gsub!(/\\[Tt]\[-2\]/) { "" } 
-       self.tail_character = -2 
-     elsif text.gsub!(/\\[Tt]\[-3\]/) { "" } 
-       self.tail_character = -3 
-     elsif text.gsub!(/\\[Tt]\[([0-9]+)\]/) { "" } 
-       self.tail_character = $1.to_i 
-     elsif text.gsub!(/\\[Tt]/) { "" } 
-       self.tail_character = 0 
-     else 
-       self.pop_character = nil 
-     end 
-   
-     # 制御文字処理 
-     text = xrxsv2_convert_escape_characters(text) 
-     text.gsub!(/\\[Ss]\[([0-9]+)\]/i) { "\eS[#{$1}]" } 
-     text.gsub!(/\\[Oo]\[([0-9]+)\]/i) { "\eO[#{$1}]" } 
-     text.gsub!(/\\last_holder/i) { "\e18" } 
-     text.gsub!(/\\last_material/i) { "\e19" } 
-     text.gsub!(/\\B/) { "\eB" } 
-     text.gsub!(/\\D/) { "\eD" } 
-     #text.gsub!(/\\n/) { "\n" } 
-     # 
-     # ライン情報の取得 
-     rxs = ["\x01","\x02","\x03","\x04","\x05","\x06","\x07","\x08", 
-       /\[([0-9]+)\]/, 
-       "\x11","\x12","\x13","\x14", "\x15", "\x16", "\x17", "\x18","\x19"] 
-     lines = text.split("\x00") 
-     @lines_max = lines.size 
-     for i in 0...@lines_max 
-       line = lines[i] 
-       for rx in rxs 
-         line.gsub!(rx) {""} 
-       end 
-       @line_aligns[i] = 
-         line.sub!(/\\center/) {""} ? CENTER : 
-         line.sub!(/\\right/)  {""} ? RIGHT : 
-                                      AUTO 
-       # 行の横幅の取得と設定 
-       cx = text_width_no_escape(line,text) #test 
-       #cx = contents.text_size(line,text).width 
-       @line_widths[i] = cx 
-     end 
-     # 位置揃え制御文字の削除 
-     text.gsub!(/\\center/) {""} 
-     text.gsub!(/\\right/) {""} 
-     # キャラポップ時のウィンドウリサイズ 
-     reszie_window_for_pop 
-   
-     del_tail # if @tail != nil 
-     # $mes_id が空のときと戦闘中はふきだしを表示しない 
-     if defined?($game_system.show_stand_picture) #立ち絵に対応。 
-       $mes_id = -1 if $game_system.show_stand_picture == true 
-     end 
-     if $mes_id != nil and (!$game_party.in_battle or $svhuki) 
-       # ふきだしのテールを描画 
-       skin = "Window" 
-       if @background == 0 
-         #画像の準備 
-         @tail = Sprite.new 
-         @tail.visible = false 
-         # 位置を取得 
-         tale_pos = get_tale_pos 
-         if $win_x != nil 
-           if $win_x > 0 
-             @tail.bitmap = Cache.system(skin + "-right") 
-             @tail.x = tale_pos[0] 
-             @tail.y = tale_pos[1] 
-             @tail.z = self.z + 1 
-           elsif  $win_x < 0 
-             @tail.bitmap = Cache.system(skin + "-left") 
-             @tail.x = tale_pos[0] 
-             @tail.y = tale_pos[1] 
-             @tail.z = self.z + 1 
-           else 
-             create_tail_up_under 
-           end 
-         else 
-           create_tail_up_under 
-         end 
-         # エクストラスプライトに登録 
-         @extra_sprites = [] if @extra_sprites.nil? 
-         @extra_sprites.push(@tail) if @tail != nil 
-         # 更新 
-         update_tail 
-       end 
-     end 
-   
-     open_and_wait #リサイズが終わった時点でウィンドウオープン。 
-   
-     return text 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● 制御文字の変換。 
-   #    変数・パーティ名・アクター名・所持金のみ変換する。 
-   #    文字「\」はエスケープ文字(\e)に変換。 
-   #-------------------------------------------------------------------------- 
-   def convert_escape_characters_easy(text) 
-     result = text.to_s.clone 
-     result.gsub!(/\\[vV]\[/)          { "\eV\[" } 
-     result.gsub!(/\\[nN]\[/)          { "\eN\[" } 
-     result.gsub!(/\\[pP]\[/)          { "\eP\[" } 
-     result.gsub!(/\\[gG]/)          { "\eG" } 
-     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] } 
-     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] } 
-     result.gsub!(/\eN\[(\d+)\]/i) { actor_name($1.to_i) } 
-     result.gsub!(/\eP\[(\d+)\]/i) { party_member_name($1.to_i) } 
-     result.gsub!(/\eG/i)          { Vocab::currency_unit } 
-     result 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● 文字の長さを取得する。エスケープ文字は含まない。 
-   # line : 表示しようとしている全ての文字列。 
-   # text : その列の文字。 
-   #-------------------------------------------------------------------------- 
-   def text_width_no_escape(line , text_o) 
-     add = 5 #微妙に足りないので水増し。 
-     text = Marshal.load(Marshal.dump(text_o)) 
-     text.gsub!(/\ehold/) { "" } 
-     text.gsub!(/\einfo/) { "" } 
-     # 改行削除指定\_があるか? 
-     if (/\\_(.*?)\x00/.match(@text)) != nil 
-       $game_message.choice_start -= 1 
-       text.gsub!(/\\_(.*?)\x00/) { "" } 
-     end 
-     # \name 判定 
-     text.sub!(/\e[Nn]ame\[(.*?)\]/) { "" } 
-     text.gsub!(/\e[Hh]\[-1\]/) { "" } 
-     text.gsub!(/\e[Hh]\[([0-9]+)\]/) { "" } 
-     text.gsub!(/\e[Hh]/) { "" } 
-     text.gsub!(/\e[Tt]\[-1\]/) { "" } 
-     text.gsub!(/\e[Tt]\[-2\]/) { "" } 
-     text.gsub!(/\e[Tt]\[-3\]/) { "" } 
-     text.gsub!(/\e[Tt]\[([0-9]+)\]/) { "" } 
-     text.gsub!(/\e[Tt]/) { "" } 
-     # 制御文字処理 
-     text.gsub!(/\e[Ss]\[([0-9]+)\]/i) { "" } 
-     text.gsub!(/\e[Oo]\[([0-9]+)\]/i) { "" } 
-     text.gsub!(/\elast_holder/i) { "" } 
-     text.gsub!(/\elast_material/i) { "" } 
-     #text.gsub!(/\eV/) { "" } #変数に置き換える。 
-     #text.gsub!(/\eN/) { "" } #名前へ置き換える。 
-     #text.gsub!(/\eP/) { "" } #名前へ置き換える。 
-     #text.gsub!(/\eG/) { "" } #金額へ置き換える。 
-     text.gsub!(/\eC\[([0-9]+)\]/) { "" } 
-     text.gsub!(/\eB/) { "" } 
-     text.gsub!(/\eD/) { "" } 
-     if text =~ /\eI/ 
-       loop do 
-         if str = text.sub!(/\eI\[(\d+)\]/){ "" } 
-           add += 24 
-         else 
-           break 
-         end 
-       end 
-     end 
-     #text.gsub!(/\\n/) { "\n" } 
-     text.sub!(/\ecenter/) {""} 
-     text.sub!(/\eright/)  {""} 
-     text.gsub!(/\ecenter/) {""} 
-     text.gsub!(/\eright/) {""} 
-   
-     text = xrxsv2_convert_escape_characters(text) 
-     basic_width = text_size(text).width + add 
-     esc = text.scan(/\e(\S)/) 
-     return ( basic_width - esc.size * (contents.font.size - 4) ) #\eの幅は20? 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● 最も長い列の長さを調べる。エスケープ文字は含まない。 
-   #-------------------------------------------------------------------------- 
-   def max_width 
-     text_size = [] 
-     for i in 0 ... @all_texts.size 
-       text_size.push text_width_no_escape(@all_texts[i],@all_texts[i]) + 20 
-     end 
-     return text_size.max 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● 吹きだしテールが上か下の場合の画像を準備。 
-   #-------------------------------------------------------------------------- 
-   def create_tail_up_under 
-     skin = "Window" 
-     tale_pos = get_tale_pos 
-     case @position 
-     when 0  # 上 
-       @tail.bitmap = Cache.system(skin + "-top") 
-       @tail.x = tale_pos[0] 
-       @tail.y = tale_pos[1] 
-       @tail.z = self.z + 1 
-     when 1  # 中 
-       @tail.dispose 
-       @tail = nil 
-     when 2  # 下 
-       @tail.bitmap = Cache.system(skin + "-under") 
-       @tail.x = tale_pos[0] 
-       @tail.y = tale_pos[1] 
-       @tail.z = self.z + 1 
-     end 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● 全テキストの処理 
-   #-------------------------------------------------------------------------- 
-   def process_all_text 
-     #open_and_wait #リサイズがあるので、すぐにウィンドウをオープンしない。 
-     text = convert_escape_characters($game_message.all_text) 
-     pos = {} 
-     new_page(text, pos) 
-     process_character(text.slice!(0, 1), text, pos) until text.empty? 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● メッセージの更新 * 
-   #-------------------------------------------------------------------------- 
-   def update_message 
-     @wait_count = @type_wait 
-     loop do 
-       c = @text.slice!(/./m) 
-       case update_message_type(c) 
-       when 1 
-         break 
-       when 2 
-         next 
-       end 
-       break unless @show_fast or @line_show_fast 
-     end 
-   end 
-   #-------------------------------------------------------------------------- 
-   # 一文字の描画 (返り値 1:break, 2:next) 
-   #-------------------------------------------------------------------------- 
- #=begin 
-   def process_escape_character(code, text, pos) 
-     case code.upcase 
-     when '$' 
-       @gold_window.open 
-     when '.' 
-       wait(15) 
-     when '|' 
-       wait(60) 
-     when '!' 
-       input_pause 
-     when '>' 
-       @line_show_fast = true 
-     when '<' 
-       @line_show_fast = false 
-     when '^' 
-       @pause_skip = true 
-     #when 'n'                      # 改行 
-     #  new_line 
-     #  max = MAX_LINE 
-     #  max = 14 if self.pop_character != nil 
-     #  if @line_count >= max      # 行数が最大のとき 
-     #    unless @text.empty?           # さらに続きがあるなら 
-     #      self.pause = true           # 入力待ちを入れる 
-           #return 1 
-     #    end 
-     #  end 
-     #when 'S'                       # \S[n]  (スピード変更) 
-     #  text.sub!(/\[([0-9]+)\]/, "") 
-     #  @type_wait = $1.to_i 
-     #  return 2 
-     when 'O'                       # \O 文字を透明にする。 
-       text.sub!(/\[([0-9]+)\]/, "") 
-       contents.font.color.alpha = $1.to_i 
-       #return 2 
-     when 'D' #\D 文字に影をつける 
-       contents.font.shadow ^= true 
-     #when '18' 
-     #  name = ($game_temp.last_gain_holder.name rescue "") 
-     #  update_message_type_draw_at(name) 
-     #when '19' 
-     #  item = ($game_temp.last_gain_material.item rescue nil) 
-     #  draw_item_name(item, @contents_x, @contents_y) 
-     #  @contents_x += 196 
-     else 
-       super 
-     end 
-   
-   end 
- #=end 
-   #-------------------------------------------------------------------------- 
-   # ● 改ページ処理 
-   #-------------------------------------------------------------------------- 
-   alias xrxsv2_new_page new_page 
-   def new_page(text, pos) 
-     xrxsv2_new_page(text, pos) 
-     update_charpop_window 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● 改行位置の取得 
-   #-------------------------------------------------------------------------- 
-   #def new_line_x 
-   #  $game_message.face_name.empty? ? 0 : 112 
-   #end 
-   #-------------------------------------------------------------------------- 
-   # ● 改行処理 
-   #-------------------------------------------------------------------------- 
-   alias xrxsv2_new_line_x new_line_x 
-   def new_line 
-     xrxsv2_new_line 
-     set_align 
-   end 
-   #-------------------------------------------------------------------------- 
-   # 位置揃え 
-   #-------------------------------------------------------------------------- 
-   def set_align 
-     w = @line_widths[@line_count].to_i 
-     a = @line_aligns[@line_count] 
-     case a 
-     when CENTER 
-       @contents_x = @contents_x + ((contents.width - @contents_x) - w) / 2 
-     when RIGHT 
-       @contents_x = contents.width - w 
-     end 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● ファイバーのメイン処理 ☆再定義 
-   #-------------------------------------------------------------------------- 
-   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 
-       process_hold #ホールドウィンドウの処理。 
-       Fiber.yield 
-       break unless text_continue? 
-     end 
-     close_and_wait 
-     $game_message.visible = false 
-     @fiber = nil 
-   end 
-   #-------------------------------------------------------------------------- 
-   # 定数 
-   #-------------------------------------------------------------------------- 
-   AUTO   = 0 
-   LEFT   = 1 
-   CENTER = 2 
-   RIGHT  = 3 
- end 
- #============================================================================== 
- # アクティブイベント取得 
- #============================================================================== 
- class Game_Interpreter 
-   attr_reader   :event_id 
- end 
-   
-   
- #============================================================================== 
- # 各種機能の追加 - キャラポップ/ネーム/ホールド 
- #============================================================================== 
- class Window_Message < Window_Base 
-   #-------------------------------------------------------------------------- 
-   # ● カーソルの更新 * 
-   #-------------------------------------------------------------------------- 
-   def update_cursor 
-     if @index >= 0 
-       x = ($game_message.face_name.empty? ? 0 : 112) 
-       y = ($game_message.choice_start + @index) * WLH - 1 
-       w = contents.width - x 
-       if self.pop_character != nil 
-         x += 28 
-         w -= 20 
-       end 
-       self.cursor_rect.set(x, y, w, WLH) 
-     else 
-       self.cursor_rect.empty 
-     end 
-   end 
-   #-------------------------------------------------------------------------- 
-   # キャラクターの取得 
-   #   parameter : パラメータ 
-   #-------------------------------------------------------------------------- 
-   def get_character(parameter) 
-     # パラメータで分岐 
-     case parameter 
-     when -1  # プレイヤー 
-       return $game_player 
-     when 0  # 現在アクティブなイベント 
-       id = $game_map.interpreter.event_id 
-       events = $game_map.events 
-       return events == nil ? nil : events[id] 
-     else  # 特定のイベント 
-       if $game_party.in_battle and $svhuki #サイドビュー対応 
-         battle_chara = [nil] + $game_party.members + $game_troop.members 
-         return battle_chara[parameter] 
-       else 
-         events = $game_map.events 
-         return events == nil ? nil : events[parameter] 
-       end   
-     end 
-   end 
-   #-------------------------------------------------------------------------- 
-   # (メッセージ終了時)ホールドの処理 
-   #-------------------------------------------------------------------------- 
-   def process_hold 
-     if @window_hold 
-       @held_windows.push(Window_Copy.new(self)) 
-       @held_windows.push(Window_Copy.new(@name_window)) 
-       @held_windows.push(Sprite_Copy.new(@name_sprite)) 
-       @held_windows.push(Sprite_Copy.new(@back_sprite)) 
-       for sprite in @extra_sprites 
-         next if sprite.disposed? 
-         @held_windows.push(Sprite_Copy.new(sprite)) 
-       end 
-       @extra_sprites.clear 
-       self.openness = 0 
-       #@name_window.openness = 0 
-       @back_sprite.visible = false 
-     else 
-       @held_windows.each {|object| object.dispose} 
-       @held_windows.clear 
-     end 
-     #@name_window.close 
-     #@name_sprite.visible = false 
-   end 
-   #-------------------------------------------------------------------------- 
-   # キャラポップ位置の設定と取得 
-   #-------------------------------------------------------------------------- 
-   def pop_character=(character_id) 
-     @pop_character = character_id 
-   end 
-   def pop_character 
-     return @pop_character 
-   end 
-   #-------------------------------------------------------------------------- 
-   # キャラポップ時のウィンドウリサイズ 
-   #-------------------------------------------------------------------------- 
-   def reszie_window_for_pop 
-     #キャラポップ 
-     if self.pop_character != nil 
-       #max_x = @line_widths.max.to_i 
-       #n  = max_x + 32 
-       n = 0 
-       n += $game_message.face_name.empty? ? 0 : 122 
-       m  = $game_message.face_name.empty? ? 0 : 96 
-       w  = @name_sprite.bitmap.width 
-       self.width  = max_width + n 
-       self.height = [@all_texts.size * line_height, m].max + 32 
-   
-       #システム用の一行目を表示しない。 
-       if $system_line or $game_switches[SYSTEM_LINE] 
-         self.height -= line_height if !$game_party.in_battle or $svhuki 
-       end 
-   
-       create_contents 
-       update_charpop_window 
-     elsif @info_mode 
-       @line_aligns[0] = CENTER 
-       self.x = - 8 
-       self.width = Graphics.width + 16 
-       self.height = 56 
-       create_contents 
-     else 
-       self.x = 0 
-       self.width  = Graphics.width 
-       self.height = MAX_LINE * line_height + 32 
-       update_placement #位置情報修正。 
-       create_contents 
-     end 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● 背景スプライトの作成 
-   #-------------------------------------------------------------------------- 
-   alias xrxsv2_create_back_sprite create_back_sprite 
-   def create_back_sprite 
-     xrxsv2_create_back_sprite 
-     @back_sprite.zoom_x = 1.0 * Graphics.width / @back_sprite.bitmap.width 
-     @name_window = Window_Base.new(0,0,112,32) 
-     @name_window.visible = false 
-     @name_sprite = Sprite.new 
-     @name_sprite.bitmap = Bitmap.new(32,32) 
-     @name_sprite.visible = false 
-     self.x = self.x 
-     self.y = self.y 
-     self.z = self.z 
-     @held_windows = [] 
-     @extra_sprites = [] 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● 背景スプライトの解放 
-   #-------------------------------------------------------------------------- 
-   alias xrxsv2_dispose_back_sprite dispose_back_sprite 
-   def dispose_back_sprite 
-     xrxsv2_dispose_back_sprite 
-     @name_window.dispose if @name_window != nil #メニュー画面を出そうとするとエラー? 
-     @name_sprite.dispose if @name_sprite != nil  
-     for window in @held_windows 
-       window.dispose 
-     end 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● 背景スプライトの更新 
-   #-------------------------------------------------------------------------- 
-   alias xrxsv2_update_back_sprite update_back_sprite 
-   def update_back_sprite 
-     @name_window.update 
-     xrxsv2_update_back_sprite 
-     update_charpop_window 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ウィンドウの位置と不透明度の設定 (キャラポップ) 
-   #-------------------------------------------------------------------------- 
-   def update_charpop_window 
-     if self.pop_character 
-       character = get_character(self.pop_character) 
-       return if character == nil 
-   
-       if defined?(character.sv) and $svhuki #サイドビュー対応 
-         chara_x = character.sv.x / 100 #- $sv_camera.x * 2 
-         chara_y = character.sv.y / 100 #- $sv_camera.y 
-       else 
-         chara_x = character.screen_x 
-         chara_y = character.screen_y 
-       end 
-   
-       # [X座標] 
-       n = self.width / 2 
-       n = [n, @name_skin.width + 16].max if @current_name != nil 
-       w = @name_sprite.bitmap.width 
-       x = chara_x - [[n, w].max, self.width - 32].min 
-   
-       # [Y座標] 
-       if self.pop_character == 0 and POP_DIRECTION #イベントの方向を考慮。 
-         if character.direction == 2 #下向き 
-           @position = 0 #上にポップ 
-         elsif character.direction == 2 #上向き 
-           @position = 2 #下にポップ 
-         end 
-       end 
-       case @position 
-       when 0 
-         y = chara_y - CHARPOP_HEIGHT - self.height 
-       else 
-         y = chara_y + 16 
-       end 
-       x_max = Graphics.width - 4 - self.width  
-       x_min = 4 
-       y_max = Graphics.height - self.height 
-       y_min = 4 
-       self.x = [[x, x_max].min, x_min].max 
-       self.y = [[y, y_max].min, y_min].max 
-     end 
-   end 
-   #-------------------------------------------------------------------------- 
-   # 位置の連動 
-   #-------------------------------------------------------------------------- 
-   def x=(n) 
-     super 
-     if @name_window 
-       if $name_right 
-         @name_window.x = n + self.width - @name_window.width - NAME_WINDOW_OFFSET_X 
-         @name_sprite.x = @name_window.x + 8 + NAME_WINDOW_OFFSET_WIDTH / 2 
-       else 
-         @name_window.x = n + NAME_WINDOW_OFFSET_X 
-         @name_sprite.x = @name_window.x + 8 + NAME_WINDOW_OFFSET_WIDTH / 2 
-       end 
-     end 
-   end 
-   def y=(n) 
-     super 
-     if @name_window 
-       @name_window.y = n + NAME_WINDOW_OFFSET_Y 
-       @name_sprite.y = n + NAME_WINDOW_OFFSET_Y + 2 + NAME_WINDOW_OFFSET_HIGHT / 2 
-     end 
-   end 
-   def z=(n) 
-     super 
-     if @name_window 
-       @name_window.z = n + 11#1 テールの上に表示されるので、Zを水増しする。 
-       @name_sprite.z = n + 12#2 
-     end 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● ファイバーのメイン処理 
-   #-------------------------------------------------------------------------- 
-   def fiber_main_namewin 
-     fiber_main_namewin_default 
-     @name_window.openness = 0 
-     @name_sprite.bitmap.clear 
-     $name = "" 
-   end 
-   alias :fiber_main_namewin_default :fiber_main 
-   alias :fiber_main :fiber_main_namewin 
- end 
- #============================================================================== 
- # 伸縮対応 
- #============================================================================== 
- class Window_Message < Window_Base 
-   #-------------------------------------------------------------------------- 
-   # ● ウィンドウの背景と位置の設定 [再定義] 
-   #-------------------------------------------------------------------------- 
-   def reset_window 
-     @background = $game_message.background 
-     @position = $game_message.position 
-     if @background == 0   # 通常ウィンドウ 
-       self.opacity = 255 
-     else                  # 背景を暗くする、透明にする 
-       self.opacity = 0 
-     end 
-     case @position 
-     when 0  # 上 
-       self.y = 0 
-       @gold_window.y = 360 
-     when 1  # 中 
-       self.y = (Graphics.height - self.height) / 2 
-       @gold_window.y = 0 
-     when 2  # 下 
-       self.y = Graphics.height - self.height 
-       @gold_window.y = 0 
-     end 
-   end 
- end 
- #============================================================================== 
- # □ Window_Copy 
- #------------------------------------------------------------------------------ 
- #   指定のウィンドウのコピーを作成します。 
- #============================================================================== 
- class Window_Copy < Window_Base 
-   #-------------------------------------------------------------------------- 
-   # ○ オブジェクト初期化 
-   #-------------------------------------------------------------------------- 
-   def initialize(window) 
-     super(window.x, window.y, window.width, window.height) 
-     self.contents = window.contents.dup unless window.contents.nil? 
-     self.opacity = window.opacity 
-     self.back_opacity = window.back_opacity 
-     self.z = window.z - 3 
-     self.visible = window.visible 
-   end 
- end 
- #============================================================================== 
- # □ Sprite_Copy 
- #------------------------------------------------------------------------------ 
- #   指定のスプライトのコピーを作成します。 
- #============================================================================== 
- class Sprite_Copy < Sprite 
-   #-------------------------------------------------------------------------- 
-   # ○ オブジェクト初期化 
-   #-------------------------------------------------------------------------- 
-   def initialize(sprite) 
-     super() 
-     self.bitmap = sprite.bitmap.dup unless sprite.bitmap.nil? 
-     self.opacity = sprite.opacity 
-     self.x = sprite.x 
-     self.y = sprite.y 
-     self.z = sprite.z - 3 
-     self.ox = sprite.ox 
-     self.oy = sprite.oy 
-     self.zoom_x = sprite.zoom_x 
-     self.visible = sprite.visible 
-   end 
- end 
-   
-   
-   
- #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□ 
- #■吹きだしテールの表示ルーチン。 
- #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□ 
- #============================================================================== 
- # +++ 「+ふきだし表示」VX +++  
- # by パラ犬  [url]http://2d6.parasite.jp/[/url] 
- #      × 
- #    row       [url]http://xms.rdy.jp/[/url] 
- # 
- # publish 2010/ 3/ 2 
- # update  - 
- # 
- #------------------------------------------------------------------------------ 
- #    ほぼどんなメッセージウィンドウに対しても後付け可能な「ふきだし表示」です。 
- #  また、テール部分のみの自動追尾機能を持ちます。 
- #   ふきだし表示をするには、 
- #  テール用画像「Window-top」「Window-under」を 
- #  「Graphics/System」フォルダにインポートしておく必要があります。 
- #============================================================================== 
- # ■ Window_Message 
- #============================================================================== 
- class Window_Message < Window_Base 
-   #-------------------------------------------------------------------------- 
-   # ● メッセージの開始 
-   #-------------------------------------------------------------------------- 
-   alias parashelf_update_all_windows update_all_windows 
-   def update_all_windows 
-     parashelf_update_all_windows 
-     update_tail 
-   end 
-   #-------------------------------------------------------------------------- 
-   # クローズ [オーバーライド] 
-   #-------------------------------------------------------------------------- 
-   def close 
-     super 
-     del_tail 
-     @name_window.close if @name_window != nil #ネームウィンドウのクローズ動作。 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● 背景スプライトの更新 
-   #-------------------------------------------------------------------------- 
-   alias parashelf_update_back_sprite update_back_sprite 
-   def update_back_sprite 
-     parashelf_update_back_sprite 
-     update_tail 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ○ フレーム更新 (ふきだしテールの更新) 
-   #-------------------------------------------------------------------------- 
-   def update_tail 
-     # ふきだしモードではイベントの動きに追従 
-     if $mes_id != nil and @tail != nil 
-       tale_pos = get_tale_pos 
-       @tail.x = tale_pos[0] 
-       @tail.y = tale_pos[1] 
-       update_tail_bitmap 
-     end 
-   end 
-   ##-------------------------------------------------------------------------- 
-   # ○ ふきだしテールの画像を更新。 
-   #-------------------------------------------------------------------------- 
-   def update_tail_bitmap 
-     skin = "Window" 
-     skin = "Think" if $game_switches[THINK_TAIL] 
-     if $win_x != nil 
-       if $win_x > 0 
-         @tail.bitmap = Cache.system(skin + "-right") 
-       elsif  $win_x < 0 
-         @tail.bitmap = Cache.system(skin + "-left") 
-       else 
-         case @position 
-         when 0  # 上 
-           @tail.bitmap = Cache.system(skin + "-top") 
-         when 2  # 下 
-           @tail.bitmap = Cache.system(skin + "-under") 
-         end 
-       end 
-     else 
-       case @position 
-       when 0  # 上 
-         @tail.bitmap = Cache.system(skin + "-top") 
-       when 2  # 下 
-         @tail.bitmap = Cache.system(skin + "-under") 
-       end 
-     end 
-     # 可視状態 
-     if self.visible == true 
-       @tail.visible = self.openness == 255 
-     else 
-       @tail.visible = false 
-     end 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ○ テールの位置を計算 
-   #-------------------------------------------------------------------------- 
-   def get_tale_pos 
-     if defined?($game_system.show_stand_picture) #A1立ち絵スクリプトを入れている。 
-       if $game_system.show_stand_picture #立ち絵on 
-         pos = get_tale_pos_stand_pic 
-       else 
-         pos = get_tale_pos_normal 
-       end 
-     else 
-       pos = get_tale_pos_normal 
-     end 
-     return pos 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ○ テールの位置を計算/立ち絵使用時。※NAME_CHANGEの編集必須。 
-   #-------------------------------------------------------------------------- 
-   def get_tale_pos_stand_pic 
-     if $game_message.face_name != ""  and @tail != nil 
-       target_name = $game_message.face_name + "_" + $game_message.face_index.to_s 
-       name = A1_System::StandPicture::NAME_CHANGE[target_name] 
-       chara = name[0] if name != nil 
-       if @stand_pic[chara] != nil #立ち絵無しの場合通常通り。 
-         x = @stand_pic[chara].pic_sprite.x + @stand_pic[chara].pic_sprite.width / 2 
-         y = get_tale_pos_normal_updown 
-         update_tail_bitmap 
-       else 
-         return get_tale_pos_normal #立ち絵が見つからない場合は通常通り。 
-       end 
-     else 
-       return get_tale_pos_normal #立ち絵が見つからない場合は通常通り。 
-     end 
-     return [x,y] 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ○ テールの位置を計算/立ち絵未使用時。 
-   #-------------------------------------------------------------------------- 
-   def get_tale_pos_normal 
-     if $mes_id == (-2) #左右の場合は高さはウィンドウ中心。上下ならやや左に配置。 
-       if $win_x != nil 
-         if $win_x > 0 
-           x = $win_x - @tail.width / 2 
-           y = self.y + self.height / 2 - @tail.height / 2 
-         elsif $win_x < 0 
-           x = self.width - @tail.width / 2 
-           y = self.y + self.height / 2 - @tail.height / 2 
-         else 
-           x = MINAS_TWE_X_POS 
-           y = get_tale_pos_normal_updown 
-         end 
-       else 
-         x = MINAS_TWE_X_POS 
-         y = get_tale_pos_normal_updown 
-       end 
-     elsif $mes_id <= (-3) #左右の場合は高さはウィンドウ中心。上下ならやや左に配置。 
-       if $win_x != nil 
-         if $win_x > 0 
-           x = $win_x - @tail.width / 2 
-           y = self.y + self.height / 2 
-         elsif $win_x < 0 
-           x = self.width - @tail.width / 2 
-           y = self.y + self.height / 2 
-         else 
-           x = MINAS_THREE_X_POS 
-           y = get_tale_pos_normal_updown 
-         end 
-       else 
-         x = MINAS_THREE_X_POS 
-         y = get_tale_pos_normal_updown 
-       end 
-     else 
-       character = get_character($mes_id) 
-   
-       if defined?(character.sv) and $svhuki #サイドビュー対応 
-         if $sv_camera.mirror #バックアタック 
-           chara_x = character.sv.x / 100 - $sv_camera.x 
-         else 
-           chara_x = character.sv.x / 100 - $sv_camera.x * 2 
-         end 
-         chara_y = character.sv.y / 100 - $sv_camera.y 
-       else 
-         chara_x = character.screen_x 
-         chara_y = character.screen_y 
-       end 
-   
-       x = [[chara_x - 16, self.x].max, self.x + self.width - 32].min 
-       if $win_x != nil 
-         if $win_x > 0 
-           x = $win_x - @tail.width / 2 
-           y = chara_y 
-         elsif $win_x < 0 
-           x = self.width 
-           y = chara_y 
-         else 
-           y = get_tale_pos_normal_updown 
-         end 
-       else 
-         y = get_tale_pos_normal_updown 
-       end 
-     end 
-     return [x, y] 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ○ テールが上下の時、かつ[-2][-3]でない時のy座標の取得。 
-   #-------------------------------------------------------------------------- 
-   def get_tale_pos_normal_updown 
-     case @position 
-     when 0 
-       y = self.y + self.height - @tail.height / 2 
-     else 
-       y = self.y - @tail.height / 2 
-     end 
-     return y 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ○ ふきだしを破棄 
-   #-------------------------------------------------------------------------- 
-   def del_tail 
-     if @tail != nil 
-       @tail.dispose 
-       @tail = nil 
-     end 
-   end 
- end 
- # 
- # ▼▲▼ XRXS 9拡張CO-X. ふきだし自動設定 ▼▲▼ 
- #============================================================================== 
- # ■ Window_Message 
- #============================================================================== 
- class Window_Message < Window_Base 
-   #-------------------------------------------------------------------------- 
-   # ○ ポップキャラクターの設定 
-   #-------------------------------------------------------------------------- 
-   def pop_character=(character_id) 
-     @pop_character = character_id 
-     $mes_id = character_id 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ○ テールキャラクターの設定 
-   #-------------------------------------------------------------------------- 
-   def tail_character=(character_id) 
-     #@pop_character = character_id 
-     $mes_id = character_id 
-   end 
- end 
-   
-   
- #============================================================================== 
- # ■ Window_ChoiceList 
- #------------------------------------------------------------------------------ 
- #  イベントコマンド[選択肢の表示]で、Y座標を修正します。 
- #============================================================================== 
- class Window_ChoiceList < Window_Command 
-   #-------------------------------------------------------------------------- 
-   # ● ウィンドウ位置の更新 
-   #-------------------------------------------------------------------------- 
-   def update_placement_hukidasi 
-     #self.width = [max_choice_width + 12, 96].max + padding * 2 
-     #self.width = [width, Graphics.width].min 
-     #self.height = fitting_height($game_message.choices.size) 
-     #self.x = Graphics.width - width 
-     #if @message_window.y >= Graphics.height / 2 
-     #  self.y = @message_window.y - height 
-     #else 
-     #  self.y = @message_window.y + @message_window.height 
-     #end 
-     update_placement_hukidasi_default 
-     if self.y + self.height > Graphics.height 
-       self.y -= ( ( self.height + self.y ) - Graphics.height) 
-       self.z += 100 
-     end 
-   end 
-   alias :update_placement_hukidasi_default :update_placement 
-   alias :update_placement :update_placement_hukidasi 
- end 
-   
- #============================================================================== 
- # ■ Scene_Menu 
- #------------------------------------------------------------------------------ 
- #  メニューを開いてからウィンドウが出るとネームウィンドウが表示される不具合修正。 
- #============================================================================== 
- #class Scene_Menu < Scene_MenuBase 
- #  def terminate_hukidasi_menyu 
- #    @name_window.openness = 0 if @name_window != nil 
- #    terminate_hukidasi_menyu_default 
- #  end 
- #  alias :terminate_hukidasi_menyu_default :terminate 
- #  alias :terminate :terminate_hukidasi_menyu 
- #end 
-   
- #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□ 
- #■ウィンドウ非表示ルーチン 
- #■吹きだしテールとネームウィンドウに対応。 
- #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□ 
- #============================================================================== 
- # L(キーボードのQ)を押すと、メッセージウィンドウを表示・非表示 
- #============================================================================== 
- class Window_Message < Window_Base 
-   def update_winoff 
-     unless $game_party.in_battle #バトル中は無効。 
-       if Input.trigger?(Input::L) 
-         if self.visible == true 
-           self.visible = false 
-           @background = 777 if @back_sprite != nil and @background == 1 #「背景を暗くする」 
-           @tail.visible = false if @tail != nil 
-         else 
-           self.visible = true 
-           @background = 1 if @back_sprite != nil and @background == 777 #「背景を暗くする」 
-         end 
-         if @name_window != nil 
-           if @name_window.visible == false and $name != nil and $name != "" 
-             @name_window.visible = true 
-             @name_sprite.visible = true 
-           else 
-             @name_window.visible = false 
-             @name_sprite.visible = false 
-           end 
-         end 
-       elsif Input.trigger?(Input::C) or Input.trigger?(Input::B) 
-         if self.visible == false 
-           self.visible = true  
-           @back_sprite.visible = true unless @back_sprite 
-         end 
-         @tail.visible = true if @tail != nil and @tail.visible == false 
-         if @name_window != nil and $name != nil 
-           if $name != "" 
-             @name_window.visible = true 
-             @name_sprite.visible = true 
-           end 
-         end 
-       end 
-     end 
-     update_winoff_default 
-   end 
-   alias :update_winoff_default :update 
-   alias :update :update_winoff 
- end 
-   
-   
- #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□ 
- #■ウィンドウ表示位置指定ルーチン 
- #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□ 
- #=========================================================================== 
- #イベントコマンド「スクリプト」を使い、 
- #$win_x=100  
- #$win_y=100 
- #と入力すれば、ウィンドウを(100、100)の位置に表示します。 
- #使わない時は 
- #$win_x=nil 
- #などとnilを入力しておいてください。 
- #=========================================================================== 
- class Window_Message < Window_Base 
-   #-------------------------------------------------------------------------- 
-   # ● ウィンドウの背景と位置の設定 [再定義] 
-   #-------------------------------------------------------------------------- 
-   def update_placement_position 
-     update_placement_position_default 
-     if $win_x != nil 
-       if $win_x > 0 
-         self.x = $win_x 
-         self.width -= $win_x 
-       else 
-         self.x = 0 
-         self.width += $win_x 
-       end 
-     end 
-     if $win_y != nil 
-       self.y = $win_y 
-     end 
-     #上表示の時、ネームウィンドウが見切れるので少し下にずらす。 
-     if self.y == 0 and @position == 0 and @name_window != nil and $name != nil 
-       self.y += (-NAME_WINDOW_OFFSET_Y) 
-     end 
-   end 
-   alias_method :update_placement_position_default, :update_placement 
-   alias_method :update_placement, :update_placement_position 
- end 
-   
-   
- #============================================================================== 
- # ■ SceneManager 
- #------------------------------------------------------------------------------ 
- #  シーン遷移のさい、テールを破棄。ネームウィンドウのデータをクリア。 
- #============================================================================== 
- module SceneManager 
-   #-------------------------------------------------------------------------- 
-   # ● 呼び出し 
-   #-------------------------------------------------------------------------- 
-   def self.call_sceman_hukidasi(scene_class) 
-     if defined?(self.scene.message_window) 
-       self.scene.message_window.del_tail if self.scene.message_window.tail != nil 
-       $name = "" 
-     end 
-     @stack.push(@scene) 
-     @scene = scene_class.new 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● クラスメソッドのエイリアス 
-   #-------------------------------------------------------------------------- 
-   class << self 
-     alias :call_sceman_hukidasi_default :call 
-     alias :call :call_sceman_hukidasi 
-   end 
- end 
-   
- #============================================================================== 
- # ■ Scene_Map 
- #------------------------------------------------------------------------------ 
- #  戦闘トランジションのさい、テールを破棄。 
- #============================================================================== 
- class Scene_Map < Scene_Base 
-   attr_accessor :message_window 
-   #-------------------------------------------------------------------------- 
-   # ● 戦闘前トランジション実行 
-   #-------------------------------------------------------------------------- 
-   def perform_battle_transition_hukidasi 
-     @message_window.del_tail #テールの破棄 
-     perform_battle_transition_hukidasi_default 
-   end 
-   alias_method :perform_battle_transition_hukidasi_default, :perform_battle_transition 
-   alias_method :perform_battle_transition, :perform_battle_transition_hukidasi 
- end 
-   
-   
- #=end