查看: 2403|回复: 4

[已经过期] 对话脚本中颜色字的判断?

[复制链接]
梦石
0
星屑
50
在线时间
1061 小时
注册时间
2012-9-10
回帖
286
发表于 2013-5-20 15:09:16 | 显示全部楼层 |阅读模式

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

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

×
对话内容
cg-000.jpg
效果1(只打字)

1

1

加颜色效果

2

2

加颜色效果,但第一行加长内容不加颜色效果

3

3

目前我所使用的对话脚本
吹きだしウィンドウVXAce(合集内)
  1. =begin
  2. 吹きだしウィンドウVXAce

  3. 2011.12.25 tamura改造
  4. 2012年05月12日 改訂

  5. ※このスクリプトは、ちいさな本屋様([url]http://xrxs.at-ninja.jp/[/url])
  6. が製作されたものをtamuraがACE用に改造した物です。

  7. 原版:
  8. ▽▽▽ XRXSv2. メッセージ表示フルグレードアップVX ▽▽▽
  9. publish 2010/ 3/ 2
  10. update  - 11/ 1/10a


  11. ※※警告※※
  12. 「立ち絵機能」をONにしている時に、立ち絵を表示せずに、ウィンドウ位置を
  13. 右か左に変更した時、テールのY座標がずれるようです。
  14. 原因は調査中です。立ち絵を表示しない時は、イベントコマンド「注釈」で、
  15. 「立ち絵表示 off」と記述して立ち絵機能をOFFにしておいてください。

  16. ●機能一覧
  17. ・イベントコマンド「スクリプト」で、$win_x $win_yに値を入力すると、
  18.  ($win_x 、$win_y)の位置にウィンドウを表示する。画面左上が(0,0)。

  19. ・キーボードのQ(装備画面で前のキャラに戻るボタン)を押すと、
  20.  ウィンドウが消える。Qか決定、キャンセルキーで元に戻る。

  21. ・文章のどこでもいいので、以下の表記を行う。
  22. ・ \name[] : []の中の文字を、ウィンドウ左上に小さく表示する。
  23.  表示させる名前には、制御文字 \V、\P、\N、\G が使用可能。

  24. \h[-1] : プレーヤーの上にウィンドウをポップ。
  25. \h[0] : 現在アクティブのイベントの上にウィンドウをポップ。
  26. \h[1] : IDが1番のイベントの上にウィンドウをポップする。
  27. hは大文字でもOK。

  28. ウィンドウは通常の大きさのまま、テールだけ表示したい場合は、
  29. \t[-2] : ウィンドウが上下に表示される時は、X座標をMINAS_TWE_X_POSで固定。
  30.            $win_x で左右に表示される時は、Y座標がウィンドウの中心やや下で固定。
  31. \t[-3] : ウィンドウが上下に表示される時は、X座標をMINAS_THREE_X_POSで固定。
  32.            $win_x で左右に表示される時は、Y座標がウィンドウの中心やや下で固定。
  33. \t[-1] : プレーヤーの上に向かってテール表示。
  34. \t[0] : 現在アクティブのイベントに向かってテール表示。
  35. \t[1] : IDが1番のイベントの上に向かってテール表示。

  36. \O[128] : 文字を透明にする。128はalphaの値で、0で透明、255で通常。
  37. \D : 文字に影をつける
  38. \hold : メッセージ表示の、最後の文章に限定。
  39.      メッセージが終わっても、ウィンドウを閉じずに残します。
  40.      他のメッセージが表示されて次へ送られる時に消えます。
  41.      なお、ホールドされているウィンドウは、Qボタンで消せません。


  42. ●その他
  43. ・ACEに標準装備されている機能は通常通り使用できます。
  44. ・A1殿([url]http://a1tktk.web.fc2.com/[/url])の立ち絵スクリプトに対応しています。
  45.  このスクリプトの上に「RGSS3用A1共通処理」
  46.  このスクリプトの下に「空メッセージでウィンドウを開かない」「立ち絵表示」を
  47.  配置して下さい。
  48.  残念ながら、「ネームウィンドウ」は使えません。上記\nameをお使いください。
  49. ※立ち絵を表示しない時は、注釈で「立ち絵表示 off」とした方が無難です。
  50. ・イベントの下から話しかけたら上へポップ、上から話しかけたら下へポップするという
  51.  機能を追加。カスタマイズポイントで POP_DIRECTION = ture と変更のこと。


  52. ●廃止機能 
  53. ・\Iがすでに使われているので、イタリック文字変換を廃止。
  54. ・スピード変更、改行、最後に入手したアイテムの表示を、ACE化にともない廃止。


  55. 【改訂履歴】
  56. 2012.01.10  ・ウィンドウを消したまま次のウィンドウを自動で表示すると、
  57.               ネームウィンドウが表示されるのを修正。
  58. 2012.01.11  ・ネームウィンドウが出しっぱなしになるのを修正。
  59. 2012.01.12  ・メニューを出してから決定ボタンを押すとネームウィンドウがでる不具合の修正。
  60. 2012.02.01 ・ネームウィンドウのオープン&クローズのタイミングを変更。
  61.       ・hold機能を追加。
  62. 2012.02.10 ・キャラポップした時、一行ずつしか表示されない不具合を修正。
  63. 2012.02.14 ・アイテム名などの文字数が正常に取得できなかったのを修正。
  64. 2012.02.21 ・話しかけられた方向によって、ポップ方向を変えられるようにした。
  65. 2012.02.25 ・すべてのシーン遷移の際はテールを破棄(イベント中でショップ起動など)
  66. 2012.02.28 ・エスケープ文字の処理が上手くいかない問題について暫定対策。
  67. 2012.03.05 ・微妙にウィンドウ幅が足りない時があったので、僅かにウィンドウ幅追加。
  68. 2012.03.14 ・ポップアップ時の顔グラ表示に対応。
  69. 2012.04.20 ・吹きだしが大型になると選択肢が入りきらない不具合の修正。
  70.             ・ネームウィンドウが残ったままシーン遷移があると、ネームウィンドウが
  71.              閉じない不具合の修正。
  72. 2012.05.02  ・名前には、制御文字 \V、\P、\N、\G が使用可能。
  73.             ・\V については、2段階の入れ子が使用可能。
  74.             ・ウィンドウ消去機能を、「背景を暗くする」に対応。
  75. 2012.05.09 ・通常の上表示のとき、ネームウィンドウが見切れるので少し下にずらす。
  76. 2012.05.12 ・ネームウィンドウの幅と高さを変更可能にした。
  77.             ・ネームウィンドウの高さを変えると、どんどん下に伸びるのを修正。

  78. =end

  79. #==============================================================================
  80. # カスタマイズポイント
  81. #==============================================================================
  82. #=begin
  83. class Window_Message < Window_Base
  84.   #
  85.   # 基本行数
  86.   #
  87.   MAX_LINE = 4
  88.   #
  89.   # \p[] - キャラポップの高さ
  90.   #
  91.   CHARPOP_HEIGHT = 40
  92.   #
  93.   #
  94.   #\name[]で表示されるウィンドウのX座標、Y座標、幅、高さ。
  95.   #座標は、メッセージウィンドウの左上端が原点。名前はウィンドウ中央に表示。
  96.   NAME_WINDOW_OFFSET_X =   0
  97.   NAME_WINDOW_OFFSET_Y = -24
  98.   NAME_WINDOW_OFFSET_WIDTH = 32
  99.   NAME_WINDOW_OFFSET_HIGHT = 10
  100.   
  101.   #
  102.   #
  103.   MINAS_TWE_X_POS = 100 # $t[-2]のときの、テールのX座標。
  104.   MINAS_THREE_X_POS = 444 # $t[-3]のときの、テールのX座標。
  105.   
  106.   POP_DIRECTION = true #イベントの方向を考慮。
  107. end

  108. #(メモ)上表示で、ネームウィンドウのために少し下にずらす機能は、
  109. #再定義したupdate_placement_positionのところ。

  110. #==============================================================================
  111. # 参照機能
  112. #==============================================================================
  113. class Game_Temp
  114.   attr_accessor :last_gain_material
  115.   attr_accessor :last_gain_holder
  116. end
  117. #==============================================================================
  118. # フルグレードアップベース - 制御文字・基本機能
  119. #==============================================================================
  120. class Window_Message < Window_Base
  121.   attr_accessor :tail
  122.   #--------------------------------------------------------------------------
  123.   # ● 特殊文字の変換 + 準備
  124.   #     変換・消去してもいい部分を処理、フラグのセット。
  125.   #--------------------------------------------------------------------------
  126.   alias xrxsv2_convert_escape_characters convert_escape_characters
  127.   def convert_escape_characters(text)
  128.     #@textsが使いずらいので、ここで別変数に保管。
  129.     @all_texts = []
  130.     str = text.gsub(/\\/) { "\e" }
  131.     @all_texts = str.split("\n")
  132.    
  133.     #この段階で、変数・アクター名を変換してしまう。
  134.     #ネームウィンドウ内の文字を変換するため。
  135.     text = convert_escape_characters_easy(text)
  136.    
  137.     # 初期化
  138.     contents.font.size   = Font.default_size
  139.     contents.font.bold   = Font.default_italic
  140.     contents.font.italic = Font.default_bold
  141.     contents.font.shadow = Font.default_shadow
  142.     @type_wait = 0
  143.     @line_widths = []
  144.     @line_aligns = []
  145.     self.pop_character = nil
  146.     # ウィンドウ保持指定\holdがあるか?
  147.     @window_hold = (text.gsub!(/\\hold/) { "" } != nil)
  148.     # \info
  149.     @info_mode = (text.gsub!(/\\info/) { "" } != nil)
  150.     # 改行削除指定\_があるか?
  151.     if (/\\_(.*?)\x00/.match(@text)) != nil
  152.       $game_message.choice_start -= 1
  153.       text.gsub!(/\\_(.*?)\x00/) { $1.to_s }
  154.     end
  155.     # \name 判定
  156.     if text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" }
  157.       name = $1
  158.       bitmap = @name_sprite.bitmap
  159.       w = [bitmap.text_size(name).width, 1].max + NAME_WINDOW_OFFSET_WIDTH
  160.       bitmap.dispose
  161.       @name_sprite.bitmap = Bitmap.new(w, 32)
  162.       bitmap = @name_sprite.bitmap
  163.       bitmap.draw_text(0, 0, bitmap.width, bitmap.height, name)
  164.       @name_window.width = w + 16
  165.       @name_window.height = bitmap.height + NAME_WINDOW_OFFSET_HIGHT
  166.       @name_window.create_contents
  167.       @name_window.open if @name_window.openness == 0
  168.       if self.visible #名前だけ表示されるのを防止。
  169.         @name_window.visible = true
  170.         @name_sprite.visible = true
  171.       else
  172.         @name_window.visible = false
  173.         @name_sprite.visible = false
  174.       end
  175.     else
  176.       @name_window.visible = false
  177.       @name_sprite.visible = false
  178.       @name_sprite.bitmap.dispose
  179.       @name_sprite.bitmap = Bitmap.new(32,32)
  180.     end
  181.     $name = $1 #あれこれで使うので、ネームウィンドウに表示予定の名前を取得。
  182.     # キャラボップモード
  183.     if text.gsub!(/\\[Hh]\[-1\]/) { "" }
  184.       self.pop_character = -1
  185.     elsif text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "" }
  186.       self.pop_character = $1.to_i
  187.     elsif text.gsub!(/\\[Hh]/) { "" }
  188.       self.pop_character = 0
  189.     #テール表示モード
  190.     elsif text.gsub!(/\\[Tt]\[-1\]/) { "" }
  191.       self.tail_character = -1
  192.     elsif text.gsub!(/\\[Tt]\[-2\]/) { "" }
  193.       self.tail_character = -2
  194.     elsif text.gsub!(/\\[Tt]\[-3\]/) { "" }
  195.       self.tail_character = -3
  196.     elsif text.gsub!(/\\[Tt]\[([0-9]+)\]/) { "" }
  197.       self.tail_character = $1.to_i
  198.     elsif text.gsub!(/\\[Tt]/) { "" }
  199.       self.tail_character = 0
  200.     else
  201.       self.pop_character = nil
  202.     end
  203.    
  204.     # 制御文字処理
  205.     text = xrxsv2_convert_escape_characters(text)
  206.     text.gsub!(/\\[Ss]\[([0-9]+)\]/i) { "\eS[#{$1}]" }
  207.     text.gsub!(/\\[Oo]\[([0-9]+)\]/i) { "\eO[#{$1}]" }
  208.     text.gsub!(/\\last_holder/i) { "\e18" }
  209.     text.gsub!(/\\last_material/i) { "\e19" }
  210.     text.gsub!(/\\B/) { "\eB" }
  211.     text.gsub!(/\\D/) { "\eD" }
  212.     #text.gsub!(/\\n/) { "\n" }
  213.     #
  214.     # ライン情報の取得
  215.     rxs = ["\x01","\x02","\x03","\x04","\x05","\x06","\x07","\x08",
  216.       /\[([0-9]+)\]/,
  217.       "\x11","\x12","\x13","\x14", "\x15", "\x16", "\x17", "\x18","\x19"]
  218.     lines = text.split("\x00")
  219.     @lines_max = lines.size
  220.     for i in 0...@lines_max
  221.       line = lines[i]
  222.       for rx in rxs
  223.         line.gsub!(rx) {""}
  224.       end
  225.       @line_aligns[i] =
  226.         line.sub!(/\\center/) {""} ? CENTER :
  227.         line.sub!(/\\right/)  {""} ? RIGHT :
  228.                                      AUTO
  229.       # 行の横幅の取得と設定
  230.       cx = text_width_no_escape(line,text) #test
  231.       #cx = contents.text_size(line,text).width
  232.       @line_widths[i] = cx
  233.     end
  234.     # 位置揃え制御文字の削除
  235.     text.gsub!(/\\center/) {""}
  236.     text.gsub!(/\\right/) {""}
  237.     # キャラポップ時のウィンドウリサイズ
  238.     reszie_window_for_pop
  239.    
  240.     del_tail # if @tail != nil
  241.     # $mes_id が空のときと戦闘中はふきだしを表示しない
  242.     if defined?($game_system.show_stand_picture) #立ち絵に対応。
  243.       $mes_id = -1 if $game_system.show_stand_picture == true
  244.     end
  245.     if $mes_id != nil and not $game_party.in_battle
  246.       # ふきだしのテールを描画
  247.       skin = "Window"
  248.       if @background == 0
  249.         #画像の準備
  250.         @tail = Sprite.new
  251.         @tail.visible = false
  252.         # 位置を取得
  253.         tale_pos = get_tale_pos
  254.         if $win_x != nil
  255.           if $win_x > 0
  256.             @tail.bitmap = Cache.system(skin + "-right")
  257.             @tail.x = tale_pos[0]
  258.             @tail.y = tale_pos[1]
  259.             @tail.z = self.z + 1
  260.           elsif  $win_x < 0
  261.             @tail.bitmap = Cache.system(skin + "-left")
  262.             @tail.x = tale_pos[0]
  263.             @tail.y = tale_pos[1]
  264.             @tail.z = self.z + 1
  265.           else
  266.             create_tail_up_under
  267.           end
  268.         else
  269.           create_tail_up_under
  270.         end
  271.         # エクストラスプライトに登録
  272.         @extra_sprites = [] if @extra_sprites.nil?
  273.         @extra_sprites.push(@tail) if @tail != nil
  274.         # 更新
  275.         update_tail
  276.       end
  277.     end

  278.     open_and_wait #リサイズが終わった時点でウィンドウオープン。
  279.    
  280.     return text
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # ● 制御文字の変換。
  284.   #    変数・パーティ名・アクター名・所持金のみ変換する。
  285.   #    文字「\」はエスケープ文字(\e)に変換。
  286.   #--------------------------------------------------------------------------
  287.   def convert_escape_characters_easy(text)
  288.     result = text.to_s.clone
  289.     result.gsub!(/\\[vV]\[/)          { "\eV\[" }
  290.     result.gsub!(/\\[nN]\[/)          { "\eN\[" }
  291.     result.gsub!(/\\[pP]\[/)          { "\eP\[" }
  292.     result.gsub!(/\\[gG]/)          { "\eG" }
  293.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  294.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  295.     result.gsub!(/\eN\[(\d+)\]/i) { actor_name($1.to_i) }
  296.     result.gsub!(/\eP\[(\d+)\]/i) { party_member_name($1.to_i) }
  297.     result.gsub!(/\eG/i)          { Vocab::currency_unit }
  298.     result
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # ● 文字の長さを取得する。エスケープ文字は含まない。
  302.   # line : 表示しようとしている全ての文字列。
  303.   # text : その列の文字。
  304.   #--------------------------------------------------------------------------
  305.   def text_width_no_escape(line , text_o)
  306.     add = 5 #微妙に足りないので水増し。
  307.     text = Marshal.load(Marshal.dump(text_o))
  308.     text.gsub!(/\ehold/) { "" }
  309.     text.gsub!(/\einfo/) { "" }
  310.     # 改行削除指定\_があるか?
  311.     if (/\\_(.*?)\x00/.match(@text)) != nil
  312.       $game_message.choice_start -= 1
  313.       text.gsub!(/\\_(.*?)\x00/) { "" }
  314.     end
  315.     # \name 判定
  316.     text.sub!(/\e[Nn]ame\[(.*?)\]/) { "" }
  317.     text.gsub!(/\e[Hh]\[-1\]/) { "" }
  318.     text.gsub!(/\e[Hh]\[([0-9]+)\]/) { "" }
  319.     text.gsub!(/\e[Hh]/) { "" }
  320.     text.gsub!(/\e[Tt]\[-1\]/) { "" }
  321.     text.gsub!(/\e[Tt]\[-2\]/) { "" }
  322.     text.gsub!(/\e[Tt]\[-3\]/) { "" }
  323.     text.gsub!(/\e[Tt]\[([0-9]+)\]/) { "" }
  324.     text.gsub!(/\e[Tt]/) { "" }
  325.     # 制御文字処理
  326.     text.gsub!(/\e[Ss]\[([0-9]+)\]/i) { "" }
  327.     text.gsub!(/\e[Oo]\[([0-9]+)\]/i) { "" }
  328.     text.gsub!(/\elast_holder/i) { "" }
  329.     text.gsub!(/\elast_material/i) { "" }
  330.     #text.gsub!(/\eV/) { "" } #変数に置き換える。
  331.     #text.gsub!(/\eN/) { "" } #名前へ置き換える。
  332.     #text.gsub!(/\eP/) { "" } #名前へ置き換える。
  333.     #text.gsub!(/\eG/) { "" } #金額へ置き換える。
  334.     #text.gsub!(/\eC/) { "" }
  335.     text.gsub!(/\eB/) { "" }
  336.     text.gsub!(/\eD/) { "" }
  337.     if text =~ /\eI/
  338.       loop do
  339.         if str = text.sub!(/\eI\[(\d+)\]/){ "" }
  340.           add += 24
  341.         else
  342.           break
  343.         end
  344.       end
  345.     end
  346.     #text.gsub!(/\\n/) { "\n" }
  347.     text.sub!(/\ecenter/) {""}
  348.     text.sub!(/\eright/)  {""}
  349.     text.gsub!(/\ecenter/) {""}
  350.     text.gsub!(/\eright/) {""}
  351.    
  352.     text = xrxsv2_convert_escape_characters(text)
  353.     basic_width = text_size(text).width + add
  354.     esc = text.scan(/\e(\S)/)
  355.     return ( basic_width - esc.size * (contents.font.size - 4) ) #\eの幅は20?
  356.   end
  357.   #--------------------------------------------------------------------------
  358.   # ● 最も長い列の長さを調べる。エスケープ文字は含まない。
  359.   #--------------------------------------------------------------------------
  360.   def max_width
  361.     text_size = []
  362.     for i in 0 ... @all_texts.size
  363.       text_size.push text_width_no_escape(@all_texts[i],@all_texts[i]) + 20
  364.     end
  365.     return text_size.max
  366.   end
  367.   #--------------------------------------------------------------------------
  368.   # ● 吹きだしテールが上か下の場合の画像を準備。
  369.   #--------------------------------------------------------------------------
  370.   def create_tail_up_under
  371.     skin = "Window"
  372.     tale_pos = get_tale_pos
  373.     case @position
  374.     when 0  # 上
  375.       @tail.bitmap = Cache.system(skin + "-top")
  376.       @tail.x = tale_pos[0]
  377.       @tail.y = tale_pos[1]
  378.       @tail.z = self.z + 1
  379.     when 1  # 中
  380.       @tail.dispose
  381.       @tail = nil
  382.     when 2  # 下
  383.       @tail.bitmap = Cache.system(skin + "-under")
  384.       @tail.x = tale_pos[0]
  385.       @tail.y = tale_pos[1]
  386.       @tail.z = self.z + 1
  387.     end
  388.   end
  389.   #--------------------------------------------------------------------------
  390.   # ● 全テキストの処理
  391.   #--------------------------------------------------------------------------
  392.   def process_all_text
  393.     #open_and_wait #リサイズがあるので、すぐにウィンドウをオープンしない。
  394.     text = convert_escape_characters($game_message.all_text)
  395.     pos = {}
  396.     new_page(text, pos)
  397.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  398.   end
  399.   #--------------------------------------------------------------------------
  400.   # ● メッセージの更新 *
  401.   #--------------------------------------------------------------------------
  402.   def update_message
  403.     @wait_count = @type_wait
  404.     loop do
  405.       c = @text.slice!(/./m)
  406.       case update_message_type(c)
  407.       when 1
  408.         break
  409.       when 2
  410.         next
  411.       end
  412.       break unless @show_fast or @line_show_fast
  413.     end
  414.   end
  415.   #--------------------------------------------------------------------------
  416.   # 一文字の描画 (返り値 1:break, 2:next)
  417.   #--------------------------------------------------------------------------
  418. #=begin
  419.   def process_escape_character(code, text, pos)
  420.     case code.upcase
  421.     when '$'
  422.       @gold_window.open
  423.     when '.'
  424.       wait(15)
  425.     when '|'
  426.       wait(60)
  427.     when '!'
  428.       input_pause
  429.     when '>'
  430.       @line_show_fast = true
  431.     when '<'
  432.       @line_show_fast = false
  433.     when '^'
  434.       @pause_skip = true
  435.     #when 'n'                      # 改行
  436.     #  new_line
  437.     #  max = MAX_LINE
  438.     #  max = 14 if self.pop_character != nil
  439.     #  if @line_count >= max      # 行数が最大のとき
  440.     #    unless @text.empty?           # さらに続きがあるなら
  441.     #      self.pause = true           # 入力待ちを入れる
  442.           #return 1
  443.     #    end
  444.     #  end
  445.     #when 'S'                       # \S[n]  (スピード変更)
  446.     #  text.sub!(/\[([0-9]+)\]/, "")
  447.     #  @type_wait = $1.to_i
  448.     #  return 2
  449.     when 'O'                       # \O 文字を透明にする。
  450.       text.sub!(/\[([0-9]+)\]/, "")
  451.       contents.font.color.alpha = $1.to_i
  452.       #return 2
  453.     when 'D' #\D 文字に影をつける
  454.       contents.font.shadow ^= true
  455.     #when '18'
  456.     #  name = ($game_temp.last_gain_holder.name rescue "")
  457.     #  update_message_type_draw_at(name)
  458.     #when '19'
  459.     #  item = ($game_temp.last_gain_material.item rescue nil)
  460.     #  draw_item_name(item, @contents_x, @contents_y)
  461.     #  @contents_x += 196
  462.     else
  463.       super
  464.     end
  465.         
  466.   end
  467. #=end
  468.   #--------------------------------------------------------------------------
  469.   # ● 改ページ処理
  470.   #--------------------------------------------------------------------------
  471.   alias xrxsv2_new_page new_page
  472.   def new_page(text, pos)
  473.     xrxsv2_new_page(text, pos)
  474.     update_charpop_window
  475.   end
  476.   #--------------------------------------------------------------------------
  477.   # ● 改行位置の取得
  478.   #--------------------------------------------------------------------------
  479.   #def new_line_x
  480.   #  $game_message.face_name.empty? ? 0 : 112
  481.   #end
  482.   #--------------------------------------------------------------------------
  483.   # ● 改行処理
  484.   #--------------------------------------------------------------------------
  485.   alias xrxsv2_new_line_x new_line_x
  486.   def new_line
  487.     xrxsv2_new_line
  488.     set_align
  489.   end
  490.   #--------------------------------------------------------------------------
  491.   # 位置揃え
  492.   #--------------------------------------------------------------------------
  493.   def set_align
  494.     w = @line_widths[@line_count].to_i
  495.     a = @line_aligns[@line_count]
  496.     case a
  497.     when CENTER
  498.       @contents_x = @contents_x + ((contents.width - @contents_x) - w) / 2
  499.     when RIGHT
  500.       @contents_x = contents.width - w
  501.     end
  502.   end
  503.   #--------------------------------------------------------------------------
  504.   # ● ファイバーのメイン処理 ☆再定義
  505.   #--------------------------------------------------------------------------
  506.   def fiber_main
  507.     $game_message.visible = true
  508.     update_background
  509.     update_placement
  510.     loop do
  511.       process_all_text if $game_message.has_text?
  512.       process_input
  513.       $game_message.clear
  514.       @gold_window.close
  515.       process_hold #ホールドウィンドウの処理。
  516.       Fiber.yield
  517.       break unless text_continue?
  518.     end
  519.     close_and_wait
  520.     $game_message.visible = false
  521.     @fiber = nil
  522.   end
  523.   #--------------------------------------------------------------------------
  524.   # 定数
  525.   #--------------------------------------------------------------------------
  526.   AUTO   = 0
  527.   LEFT   = 1
  528.   CENTER = 2
  529.   RIGHT  = 3
  530. end
  531. #==============================================================================
  532. # アクティブイベント取得
  533. #==============================================================================
  534. class Game_Interpreter
  535.   attr_reader   :event_id
  536. end


  537. #==============================================================================
  538. # 各種機能の追加 - キャラポップ/ネーム/ホールド
  539. #==============================================================================
  540. class Window_Message < Window_Base
  541.   #--------------------------------------------------------------------------
  542.   # ● カーソルの更新 *
  543.   #--------------------------------------------------------------------------
  544.   def update_cursor
  545.     if @index >= 0
  546.       x = ($game_message.face_name.empty? ? 0 : 112)
  547.       y = ($game_message.choice_start + @index) * WLH - 1
  548.       w = contents.width - x
  549.       if self.pop_character != nil
  550.         x += 28
  551.         w -= 20
  552.       end
  553.       self.cursor_rect.set(x, y, w, WLH)
  554.     else
  555.       self.cursor_rect.empty
  556.     end
  557.   end
  558.   #--------------------------------------------------------------------------
  559.   # キャラクターの取得
  560.   #   parameter : パラメータ
  561.   #--------------------------------------------------------------------------
  562.   def get_character(parameter)
  563.     # パラメータで分岐
  564.     case parameter
  565.     when -1  # プレイヤー
  566.       return $game_player
  567.     when 0  # 現在アクティブなイベント
  568.       id = $game_map.interpreter.event_id
  569.       events = $game_map.events
  570.       return events == nil ? nil : events[id]
  571.     else  # 特定のイベント
  572.       events = $game_map.events
  573.       return events == nil ? nil : events[parameter]
  574.     end
  575.   end
  576.   #--------------------------------------------------------------------------
  577.   # (メッセージ終了時)ホールドの処理
  578.   #--------------------------------------------------------------------------
  579.   def process_hold
  580.     if @window_hold
  581.       @held_windows.push(Window_Copy.new(self))
  582.       @held_windows.push(Window_Copy.new(@name_window))
  583.       @held_windows.push(Sprite_Copy.new(@name_sprite))
  584.       @held_windows.push(Sprite_Copy.new(@back_sprite))
  585.       for sprite in @extra_sprites
  586.         next if sprite.disposed?
  587.         @held_windows.push(Sprite_Copy.new(sprite))
  588.       end
  589.       @extra_sprites.clear
  590.       self.openness = 0
  591.       #@name_window.openness = 0
  592.       @back_sprite.visible = false
  593.     else
  594.       @held_windows.each {|object| object.dispose}
  595.       @held_windows.clear
  596.     end
  597.     #@name_window.close
  598.     #@name_sprite.visible = false
  599.   end
  600.   #--------------------------------------------------------------------------
  601.   # キャラポップ位置の設定と取得
  602.   #--------------------------------------------------------------------------
  603.   def pop_character=(character_id)
  604.     @pop_character = character_id
  605.   end
  606.   def pop_character
  607.     return @pop_character
  608.   end
  609.   #--------------------------------------------------------------------------
  610.   # キャラポップ時のウィンドウリサイズ
  611.   #--------------------------------------------------------------------------
  612.   def reszie_window_for_pop
  613.     #キャラポップ
  614.     if self.pop_character != nil
  615.       #max_x = @line_widths.max.to_i
  616.       #n  = max_x + 32
  617.       n = 0
  618.       n += $game_message.face_name.empty? ? 0 : 122
  619.       m  = $game_message.face_name.empty? ? 0 : 96
  620.       w  = @name_sprite.bitmap.width
  621.       self.width  = max_width + n
  622.       self.height = [@all_texts.size * line_height, m].max + 32
  623.       create_contents
  624.       update_charpop_window
  625.     elsif @info_mode
  626.       @line_aligns[0] = CENTER
  627.       self.x = - 8
  628.       self.width = Graphics.width + 16
  629.       self.height = 56
  630.       create_contents
  631.     else
  632.       self.x = 0
  633.       self.width  = Graphics.width
  634.       self.height = MAX_LINE * line_height + 32
  635.       update_placement #位置情報修正。
  636.       create_contents
  637.     end
  638.   end
  639.   #--------------------------------------------------------------------------
  640.   # ● 背景スプライトの作成
  641.   #--------------------------------------------------------------------------
  642.   alias xrxsv2_create_back_sprite create_back_sprite
  643.   def create_back_sprite
  644.     xrxsv2_create_back_sprite
  645.     @back_sprite.zoom_x = 1.0 * Graphics.width / @back_sprite.bitmap.width
  646.     @name_window = Window_Base.new(0,0,112,36)
  647.     @name_window.visible = false
  648.     @name_sprite = Sprite.new
  649.     @name_sprite.bitmap = Bitmap.new(32,32)
  650.     @name_sprite.visible = false
  651.     self.x = self.x
  652.     self.y = self.y
  653.     self.z = self.z
  654.     @held_windows = []
  655.     @extra_sprites = []
  656.   end
  657.   #--------------------------------------------------------------------------
  658.   # ● 背景スプライトの解放
  659.   #--------------------------------------------------------------------------
  660.   alias xrxsv2_dispose_back_sprite dispose_back_sprite
  661.   def dispose_back_sprite
  662.     xrxsv2_dispose_back_sprite
  663.     @name_window.dispose if @name_window != nil #メニュー画面を出そうとするとエラー?
  664.     @name_sprite.dispose if @name_sprite != nil
  665.     for window in @held_windows
  666.       window.dispose
  667.     end
  668.   end
  669.   #--------------------------------------------------------------------------
  670.   # ● 背景スプライトの更新
  671.   #--------------------------------------------------------------------------
  672.   alias xrxsv2_update_back_sprite update_back_sprite
  673.   def update_back_sprite
  674.     @name_window.update
  675.     xrxsv2_update_back_sprite
  676.     update_charpop_window
  677.   end
  678.   #--------------------------------------------------------------------------
  679.   # ウィンドウの位置と不透明度の設定 (キャラポップ)
  680.   #--------------------------------------------------------------------------
  681.   def update_charpop_window
  682.     if self.pop_character
  683.       character = get_character(self.pop_character)
  684.       return if character == nil
  685.       # [X座標]
  686.       n = self.width / 2
  687.       n = [n, @name_skin.width + 16].max if @current_name != nil
  688.       w = @name_sprite.bitmap.width
  689.       x = character.screen_x - [[n, w].max, self.width - 32].min
  690.       # [Y座標]
  691.       if self.pop_character == 0 and POP_DIRECTION #イベントの方向を考慮。
  692.         if character.direction == 2 #下向き
  693.           @position = 0 #上にポップ
  694.         elsif character.direction == 8 #上向き
  695.           @position = 2 #下にポップ
  696.         end
  697.       end
  698.       case @position
  699.       when 0
  700.         y = character.screen_y - CHARPOP_HEIGHT - self.height
  701.       else
  702.         y = character.screen_y + 16
  703.       end
  704.       x_max = Graphics.width - 4 - self.width
  705.       x_min = 4
  706.       y_max = Graphics.height - self.height
  707.       y_min = 4
  708.       self.x = [[x, x_max].min, x_min].max
  709.       self.y = [[y, y_max].min, y_min].max
  710.     end
  711.   end
  712.   #--------------------------------------------------------------------------
  713.   # 位置の連動
  714.   #--------------------------------------------------------------------------
  715.   def x=(n)
  716.     super
  717.     if @name_window
  718.       @name_window.x = n + NAME_WINDOW_OFFSET_X
  719.       @name_sprite.x = n + NAME_WINDOW_OFFSET_X + 8 + NAME_WINDOW_OFFSET_WIDTH / 2
  720.     end
  721.   end
  722.   def y=(n)
  723.     super
  724.     if @name_window
  725.       @name_window.y = n + NAME_WINDOW_OFFSET_Y
  726.       @name_sprite.y = n + NAME_WINDOW_OFFSET_Y + 2 + NAME_WINDOW_OFFSET_HIGHT / 2
  727.     end
  728.   end
  729.   def z=(n)
  730.     super
  731.     if @name_window
  732.       @name_window.z = n + 11#1 テールの上に表示されるので、Zを水増しする。
  733.       @name_sprite.z = n + 12#2
  734.     end
  735.   end
  736.   #--------------------------------------------------------------------------
  737.   # ● ファイバーのメイン処理
  738.   #--------------------------------------------------------------------------
  739.   def fiber_main_namewin
  740.     fiber_main_namewin_default
  741.     @name_window.openness = 0
  742.     @name_sprite.bitmap.clear
  743.     $name = ""
  744.   end
  745.   alias :fiber_main_namewin_default :fiber_main
  746.   alias :fiber_main :fiber_main_namewin
  747. end
  748. #==============================================================================
  749. # 伸縮対応
  750. #==============================================================================
  751. class Window_Message < Window_Base
  752.   #--------------------------------------------------------------------------
  753.   # ● ウィンドウの背景と位置の設定 [再定義]
  754.   #--------------------------------------------------------------------------
  755.   def reset_window
  756.     @background = $game_message.background
  757.     @position = $game_message.position
  758.     if @background == 0   # 通常ウィンドウ
  759.       self.opacity = 255
  760.     else                  # 背景を暗くする、透明にする
  761.       self.opacity = 0
  762.     end
  763.     case @position
  764.     when 0  # 上
  765.       self.y = 0
  766.       @gold_window.y = 360
  767.     when 1  # 中
  768.       self.y = (Graphics.height - self.height) / 2
  769.       @gold_window.y = 0
  770.     when 2  # 下
  771.       self.y = Graphics.height - self.height
  772.       @gold_window.y = 0
  773.     end
  774.   end
  775. end
  776. #==============================================================================
  777. # □ Window_Copy
  778. #------------------------------------------------------------------------------
  779. #   指定のウィンドウのコピーを作成します。
  780. #==============================================================================
  781. class Window_Copy < Window_Base
  782.   #--------------------------------------------------------------------------
  783.   # ○ オブジェクト初期化
  784.   #--------------------------------------------------------------------------
  785.   def initialize(window)
  786.     super(window.x, window.y, window.width, window.height)
  787.     self.contents = window.contents.dup unless window.contents.nil?
  788.     self.opacity = window.opacity
  789.     self.back_opacity = window.back_opacity
  790.     self.z = window.z - 3
  791.     self.visible = window.visible
  792.   end
  793. end
  794. #==============================================================================
  795. # □ Sprite_Copy
  796. #------------------------------------------------------------------------------
  797. #   指定のスプライトのコピーを作成します。
  798. #==============================================================================
  799. class Sprite_Copy < Sprite
  800.   #--------------------------------------------------------------------------
  801.   # ○ オブジェクト初期化
  802.   #--------------------------------------------------------------------------
  803.   def initialize(sprite)
  804.     super()
  805.     self.bitmap = sprite.bitmap.dup unless sprite.bitmap.nil?
  806.     self.opacity = sprite.opacity
  807.     self.x = sprite.x
  808.     self.y = sprite.y
  809.     self.z = sprite.z - 3
  810.     self.ox = sprite.ox
  811.     self.oy = sprite.oy
  812.     self.zoom_x = sprite.zoom_x
  813.     self.visible = sprite.visible
  814.   end
  815. end



  816. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  817. #■吹きだしテールの表示ルーチン。
  818. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  819. #==============================================================================
  820. # +++ 「+ふきだし表示」VX +++
  821. # by パラ犬  [url]http://2d6.parasite.jp/[/url]
  822. #      ×
  823. #    row       [url]http://xms.rdy.jp/[/url]
  824. #
  825. # publish 2010/ 3/ 2
  826. # update  -
  827. #
  828. #------------------------------------------------------------------------------
  829. #    ほぼどんなメッセージウィンドウに対しても後付け可能な「ふきだし表示」です。
  830. #  また、テール部分のみの自動追尾機能を持ちます。
  831. #   ふきだし表示をするには、
  832. #  テール用画像「Window-top」「Window-under」を
  833. #  「Graphics/System」フォルダにインポートしておく必要があります。
  834. #==============================================================================
  835. # ■ Window_Message
  836. #==============================================================================
  837. class Window_Message < Window_Base
  838.   #--------------------------------------------------------------------------
  839.   # ● メッセージの開始
  840.   #--------------------------------------------------------------------------
  841.   alias parashelf_update_all_windows update_all_windows
  842.   def update_all_windows
  843.     parashelf_update_all_windows
  844.     update_tail
  845.   end
  846.   #--------------------------------------------------------------------------
  847.   # クローズ [オーバーライド]
  848.   #--------------------------------------------------------------------------
  849.   def close
  850.     super
  851.     del_tail
  852.     @name_window.close if @name_window != nil #ネームウィンドウのクローズ動作。
  853.   end
  854.   #--------------------------------------------------------------------------
  855.   # ● 背景スプライトの更新
  856.   #--------------------------------------------------------------------------
  857.   alias parashelf_update_back_sprite update_back_sprite
  858.   def update_back_sprite
  859.     parashelf_update_back_sprite
  860.     update_tail
  861.   end
  862.   #--------------------------------------------------------------------------
  863.   # ○ フレーム更新 (ふきだしテールの更新)
  864.   #--------------------------------------------------------------------------
  865.   def update_tail
  866.     # ふきだしモードではイベントの動きに追従
  867.     if $mes_id != nil and @tail != nil
  868.       tale_pos = get_tale_pos
  869.       @tail.x = tale_pos[0]
  870.       @tail.y = tale_pos[1]
  871.       update_tail_bitmap
  872.     end
  873.   end
  874.   ##--------------------------------------------------------------------------
  875.   # ○ ふきだしテールの画像を更新。
  876.   #--------------------------------------------------------------------------
  877.   def update_tail_bitmap
  878.     skin = "Window"
  879.     if $win_x != nil
  880.       if $win_x > 0
  881.         @tail.bitmap = Cache.system(skin + "-right")
  882.       elsif  $win_x < 0
  883.         @tail.bitmap = Cache.system(skin + "-left")
  884.       else
  885.         case @position
  886.         when 0  # 上
  887.           @tail.bitmap = Cache.system(skin + "-top")
  888.         when 2  # 下
  889.           @tail.bitmap = Cache.system(skin + "-under")
  890.         end
  891.       end
  892.     else
  893.       case @position
  894.       when 0  # 上
  895.         @tail.bitmap = Cache.system(skin + "-top")
  896.       when 2  # 下
  897.         @tail.bitmap = Cache.system(skin + "-under")
  898.       end
  899.     end
  900.     # 可視状態
  901.     if self.visible == true
  902.       @tail.visible = self.openness == 255
  903.     else
  904.       @tail.visible = false
  905.     end
  906.   end
  907.   #--------------------------------------------------------------------------
  908.   # ○ テールの位置を計算
  909.   #--------------------------------------------------------------------------
  910.   def get_tale_pos
  911.     if defined?($game_system.show_stand_picture) #A1立ち絵スクリプトを入れている。
  912.       if $game_system.show_stand_picture #立ち絵on
  913.         pos = get_tale_pos_stand_pic
  914.       else
  915.         pos = get_tale_pos_normal
  916.       end
  917.     else
  918.       pos = get_tale_pos_normal
  919.     end
  920.     return pos
  921.   end
  922.   #--------------------------------------------------------------------------
  923.   # ○ テールの位置を計算/立ち絵使用時。※NAME_CHANGEの編集必須。
  924.   #--------------------------------------------------------------------------
  925.   def get_tale_pos_stand_pic
  926.     if $game_message.face_name != ""  and @tail != nil
  927.       name = A1_System::StandPicture::NAME_CHANGE[$game_message.face_name]
  928.       chara = name[$game_message.face_index][0]
  929.       if @stand_pic[chara] != nil #立ち絵無しの場合通常通り。
  930.         x = @stand_pic[chara].pic_sprite.x + @stand_pic[chara].pic_sprite.width / 2
  931.         y = get_tale_pos_normal_updown
  932.         update_tail_bitmap
  933.       else
  934.         return get_tale_pos_normal #立ち絵が見つからない場合は通常通り。
  935.       end
  936.     else
  937.       return get_tale_pos_normal #立ち絵が見つからない場合は通常通り。
  938.     end
  939.     return [x,y]
  940.   end
  941.   #--------------------------------------------------------------------------
  942.   # ○ テールの位置を計算/立ち絵未使用時。
  943.   #--------------------------------------------------------------------------
  944.   def get_tale_pos_normal
  945.     if $mes_id == (-2) #左右の場合は高さはウィンドウ中心。上下ならやや左に配置。
  946.       if $win_x != nil
  947.         if $win_x > 0
  948.           x = $win_x - @tail.width / 2
  949.           y = self.y + self.height / 2 - @tail.height / 2
  950.         elsif $win_x < 0
  951.           x = self.width - @tail.width / 2
  952.           y = self.y + self.height / 2 - @tail.height / 2
  953.         else
  954.           x = MINAS_TWE_X_POS
  955.           y = get_tale_pos_normal_updown
  956.         end
  957.       else
  958.         x = MINAS_TWE_X_POS
  959.         y = get_tale_pos_normal_updown
  960.       end
  961.     elsif $mes_id <= (-3) #左右の場合は高さはウィンドウ中心。上下ならやや左に配置。
  962.       if $win_x != nil
  963.         if $win_x > 0
  964.           x = $win_x - @tail.width / 2
  965.           y = self.y + self.height / 2
  966.         elsif $win_x < 0
  967.           x = self.width - @tail.width / 2
  968.           y = self.y + self.height / 2
  969.         else
  970.           x = MINAS_THREE_X_POS
  971.           y = get_tale_pos_normal_updown
  972.         end
  973.       else
  974.         x = MINAS_THREE_X_POS
  975.         y = get_tale_pos_normal_updown
  976.       end
  977.     else
  978.       character = get_character($mes_id)
  979.       x = [[character.screen_x - 16, self.x].max, self.x + self.width - 32].min
  980.       if $win_x != nil
  981.         if $win_x > 0
  982.           x = $win_x - @tail.width / 2
  983.           y = character.screen_y
  984.         elsif $win_x < 0
  985.           x = self.width
  986.           y = character.screen_y
  987.         else
  988.           y = get_tale_pos_normal_updown
  989.         end
  990.       else
  991.         y = get_tale_pos_normal_updown
  992.       end
  993.     end
  994.     return [x, y]
  995.   end
  996.   #--------------------------------------------------------------------------
  997.   # ○ テールが上下の時、かつ[-2][-3]でない時のy座標の取得。
  998.   #--------------------------------------------------------------------------
  999.   def get_tale_pos_normal_updown
  1000.     case @position
  1001.     when 0
  1002.       y = self.y + self.height - @tail.height / 2
  1003.     else
  1004.       y = self.y - @tail.height / 2
  1005.     end
  1006.     return y
  1007.   end
  1008.   #--------------------------------------------------------------------------
  1009.   # ○ ふきだしを破棄
  1010.   #--------------------------------------------------------------------------
  1011.   def del_tail
  1012.     if @tail != nil
  1013.       @tail.dispose
  1014.       @tail = nil
  1015.     end
  1016.   end
  1017. end
  1018. #
  1019. # ▼▲▼ XRXS 9拡張CO-X. ふきだし自動設定 ▼▲▼
  1020. #==============================================================================
  1021. # ■ Window_Message
  1022. #==============================================================================
  1023. class Window_Message < Window_Base
  1024.   #--------------------------------------------------------------------------
  1025.   # ○ ポップキャラクターの設定
  1026.   #--------------------------------------------------------------------------
  1027.   def pop_character=(character_id)
  1028.     @pop_character = character_id
  1029.     $mes_id = character_id
  1030.   end
  1031.   #--------------------------------------------------------------------------
  1032.   # ○ テールキャラクターの設定
  1033.   #--------------------------------------------------------------------------
  1034.   def tail_character=(character_id)
  1035.     #@pop_character = character_id
  1036.     $mes_id = character_id
  1037.   end
  1038. end


  1039. #==============================================================================
  1040. # ■ Window_ChoiceList
  1041. #------------------------------------------------------------------------------
  1042. #  イベントコマンド[選択肢の表示]で、Y座標を修正します。
  1043. #==============================================================================
  1044. class Window_ChoiceList < Window_Command
  1045.   #--------------------------------------------------------------------------
  1046.   # ● ウィンドウ位置の更新
  1047.   #--------------------------------------------------------------------------
  1048.   def update_placement_hukidasi
  1049.     #self.width = [max_choice_width + 12, 96].max + padding * 2
  1050.     #self.width = [width, Graphics.width].min
  1051.     #self.height = fitting_height($game_message.choices.size)
  1052.     #self.x = Graphics.width - width
  1053.     #if @message_window.y >= Graphics.height / 2
  1054.     #  self.y = @message_window.y - height
  1055.     #else
  1056.     #  self.y = @message_window.y + @message_window.height
  1057.     #end
  1058.     update_placement_hukidasi_default
  1059.     if self.y + self.height > Graphics.height
  1060.       self.y -= ( ( self.height + self.y ) - Graphics.height)
  1061.       self.z += 100
  1062.     end
  1063.   end
  1064.   alias :update_placement_hukidasi_default :update_placement
  1065.   alias :update_placement :update_placement_hukidasi
  1066. end

  1067. #==============================================================================
  1068. # ■ Scene_Menu
  1069. #------------------------------------------------------------------------------
  1070. #  メニューを開いてからウィンドウが出るとネームウィンドウが表示される不具合修正。
  1071. #==============================================================================
  1072. #class Scene_Menu < Scene_MenuBase
  1073. #  def terminate_hukidasi_menyu
  1074. #    @name_window.openness = 0 if @name_window != nil
  1075. #    terminate_hukidasi_menyu_default
  1076. #  end
  1077. #  alias :terminate_hukidasi_menyu_default :terminate
  1078. #  alias :terminate :terminate_hukidasi_menyu
  1079. #end

  1080. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  1081. #■ウィンドウ非表示ルーチン
  1082. #■吹きだしテールとネームウィンドウに対応。
  1083. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  1084. #==============================================================================
  1085. # L(キーボードのQ)を押すと、メッセージウィンドウを表示・非表示
  1086. #==============================================================================
  1087. class Window_Message < Window_Base
  1088.   def update_winoff
  1089.     unless $game_party.in_battle #バトル中は無効。
  1090.       if Input.trigger?(Input::L)
  1091.         if self.visible == true
  1092.           self.visible = false
  1093.           @background = 777 if @back_sprite != nil and @background == 1 #「背景を暗くする」
  1094.           @tail.visible = false if @tail != nil
  1095.         else
  1096.           self.visible = true
  1097.           @background = 1 if @back_sprite != nil and @background == 777 #「背景を暗くする」
  1098.         end
  1099.         if @name_window != nil
  1100.           if @name_window.visible == false and $name != nil and $name != ""
  1101.             @name_window.visible = true
  1102.             @name_sprite.visible = true
  1103.           else
  1104.             @name_window.visible = false
  1105.             @name_sprite.visible = false
  1106.           end
  1107.         end
  1108.       elsif Input.trigger?(Input::C) or Input.trigger?(Input::B)
  1109.         if self.visible == false
  1110.           self.visible = true
  1111.           @back_sprite.visible = true unless @back_sprite
  1112.         end
  1113.         @tail.visible = true if @tail != nil and @tail.visible == false
  1114.         if @name_window != nil and $name != nil
  1115.           if $name != ""
  1116.             @name_window.visible = true
  1117.             @name_sprite.visible = true
  1118.           end
  1119.         end
  1120.       end
  1121.     end
  1122.     update_winoff_default
  1123.   end
  1124.   alias :update_winoff_default :update
  1125.   alias :update :update_winoff
  1126. end


  1127. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  1128. #■ウィンドウ表示位置指定ルーチン
  1129. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  1130. #===========================================================================
  1131. #イベントコマンド「スクリプト」を使い、
  1132. #$win_x=100 
  1133. #$win_y=100
  1134. #と入力すれば、ウィンドウを(100、100)の位置に表示します。
  1135. #使わない時は
  1136. #$win_x=nil
  1137. #などとnilを入力しておいてください。
  1138. #===========================================================================
  1139. class Window_Message < Window_Base
  1140.   #--------------------------------------------------------------------------
  1141.   # ● ウィンドウの背景と位置の設定 [再定義]
  1142.   #--------------------------------------------------------------------------
  1143.   def update_placement_position
  1144.     update_placement_position_default
  1145.     if $win_x != nil
  1146.       if $win_x > 0
  1147.         self.x = $win_x
  1148.         self.width -= $win_x
  1149.       else
  1150.         self.x = 0
  1151.         self.width += $win_x
  1152.       end
  1153.     end
  1154.     if $win_y != nil
  1155.       self.y = $win_y
  1156.     end
  1157.     #上表示の時、ネームウィンドウが見切れるので少し下にずらす。
  1158.     if self.y == 0 and @position == 0 and @name_window != nil and $name != nil
  1159.       self.y += (-NAME_WINDOW_OFFSET_Y)
  1160.     end
  1161.   end
  1162.   alias_method :update_placement_position_default, :update_placement
  1163.   alias_method :update_placement, :update_placement_position
  1164. end


  1165. #==============================================================================
  1166. # ■ SceneManager
  1167. #------------------------------------------------------------------------------
  1168. #  シーン遷移のさい、テールを破棄。ネームウィンドウのデータをクリア。
  1169. #==============================================================================
  1170. module SceneManager
  1171.   #--------------------------------------------------------------------------
  1172.   # ● 呼び出し
  1173.   #--------------------------------------------------------------------------
  1174.   def self.call_sceman_hukidasi(scene_class)
  1175.     if defined?(self.scene.message_window)
  1176.       self.scene.message_window.del_tail if self.scene.message_window.tail != nil
  1177.       $name = ""
  1178.     end
  1179.     @stack.push(@scene)
  1180.     @scene = scene_class.new
  1181.   end
  1182.   #--------------------------------------------------------------------------
  1183.   # ● クラスメソッドのエイリアス
  1184.   #--------------------------------------------------------------------------
  1185.   class << self
  1186.     alias :call_sceman_hukidasi_default :call
  1187.     alias :call :call_sceman_hukidasi
  1188.   end
  1189. end

  1190. #==============================================================================
  1191. # ■ Scene_Map
  1192. #------------------------------------------------------------------------------
  1193. #  戦闘トランジションのさい、テールを破棄。
  1194. #==============================================================================
  1195. class Scene_Map < Scene_Base
  1196.   attr_accessor :message_window
  1197.   #--------------------------------------------------------------------------
  1198.   # ● 戦闘前トランジション実行
  1199.   #--------------------------------------------------------------------------
  1200.   def perform_battle_transition_hukidasi
  1201.     @message_window.del_tail #テールの破棄
  1202.     perform_battle_transition_hukidasi_default
  1203.   end
  1204.   alias_method :perform_battle_transition_hukidasi_default, :perform_battle_transition
  1205.   alias_method :perform_battle_transition, :perform_battle_transition_hukidasi
  1206. end
复制代码

其他对话脚本也有这样的状况...
想请教,有无方法多加几行脚本,让\c[]为空?
还是有不影响的脚本?
大家是如何处里该效果?都不用颜色字吗?
还是只能第一行加长,第2行才加颜色- -

点评

不好意思,这个我真的不懂······VA我实在没有碰过呢  发表于 2013-5-20 17:56
资料库更新...累死人的一堆文字...
我不是做avg,卻要有avg的叙述....-   3 -
梦石
20
星屑
1840
在线时间
6925 小时
注册时间
2012-12-14
回帖
10960

短篇十战斗者组别冠军开拓者贵宾短篇九勇士组亚军

发表于 2013-5-20 16:55:26 | 显示全部楼层
\c[]是用来定义文字的基本颜色的。
具体定义是在Window_Base的157行开始的。
\c[]为空要做什么吗?
表示VA各种不懂

点评

没有关系,不行我就用第3种方法,再不行我就用图片显示- v - xp的对话脚本没这问题吗?  发表于 2013-5-21 08:39
言不达义,是我错...,就是想可以颜色变化,却不会变成空格...  发表于 2013-5-20 17:23
大家好,这里是晨露的说。请多多指教。
刚入门RM软件制作,请大家多多帮助我哦。
落雪君的欢乐像素教程,欢迎查阅。

回复

使用道具 举报

梦石
0
星屑
50
在线时间
687 小时
注册时间
2012-10-29
回帖
1526
发表于 2013-5-20 22:31:09 | 显示全部楼层
脚本的 text_size 问题,没有对 \C 控制符处理,所以文字长度会包含控制符本身的长度,但显示时控制符是被去掉不显示的,所以实际上显示的文字长度没有那么长,就多出一小段空白了,好像对话脚本都没处理掉这个问题。

点评

所以...目前只能用第3种或不显示颜色字?不大理解的是,原先对话是没有这问题,用对话脚本反而造成问题?  发表于 2013-5-21 08:33
修改劇本中,仔細審查原來的劇情大綱,覺得有點不太滿意,嘗試編寫不同主角不同主線的劇情,希望能寫得出來。
回复

使用道具 举报

梦石
0
星屑
50
在线时间
687 小时
注册时间
2012-10-29
回帖
1526
发表于 2013-5-21 16:27:11 | 显示全部楼层
本帖最后由 j433463 于 2013-5-21 16:31 编辑

不用对话脚本,对话框是固定宽度的,当然看不出文字宽度的变化,但对话脚本是因应最大文字宽度来调整对话框宽度,

所以当对话中用到控制符时如果没有减去控制符的宽度,就会多出一段空白,这个在 YAMI 对话脚本更明显。



其实您第三种并不是没有同样的问题,只是因为第三种有用到控制符的尾行较短,多出的长度还不算最宽文字行,

所以对话框才没有明显变化,但您仔细看的话,对话框右边能看出比正常的对话框多了一点空白距离,

假如您尾行再多两个中文字,恐怕和第二种结果是一样的。

点评

脚本果然是麻烦的东西,那我...就慢慢等新脚本或解决方法出现吧@..@  发表于 2013-5-21 17:51

评分

参与人数 1星屑 +100 收起 理由
Sion + 100 感谢帮忙

查看全部评分

修改劇本中,仔細審查原來的劇情大綱,覺得有點不太滿意,嘗試編寫不同主角不同主線的劇情,希望能寫得出來。
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部