设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1716|回复: 4
打印 上一主题 下一主题

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1061 小时
注册时间
2012-9-10
帖子
314
跳转到指定楼层
1
发表于 2013-5-20 15:09:16 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
对话内容

效果1(只打字)

加颜色效果

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

目前我所使用的对话脚本
吹きだしウィンドウVXAce(合集内)
RUBY 代码复制
  1. =begin
  2. 吹きだしウィンドウVXAce
  3.  
  4. 2011.12.25 tamura改造
  5. 2012年05月12日 改訂
  6.  
  7. ※このスクリプトは、ちいさな本屋様([url]http://xrxs.at-ninja.jp/[/url])
  8. が製作されたものをtamuraがACE用に改造した物です。
  9.  
  10. 原版:
  11.  ▽▽▽ XRXSv2. メッセージ表示フルグレードアップVX ▽▽▽
  12.  publish 2010/ 3/ 2
  13.  update  - 11/ 1/10a
  14.  
  15.  
  16. ※※警告※※
  17. 「立ち絵機能」をONにしている時に、立ち絵を表示せずに、ウィンドウ位置を
  18. 右か左に変更した時、テールのY座標がずれるようです。
  19. 原因は調査中です。立ち絵を表示しない時は、イベントコマンド「注釈」で、
  20. 「立ち絵表示 off」と記述して立ち絵機能をOFFにしておいてください。
  21.  
  22. ●機能一覧
  23. ・イベントコマンド「スクリプト」で、$win_x $win_yに値を入力すると、
  24.  ($win_x 、$win_y)の位置にウィンドウを表示する。画面左上が(0,0)。
  25.  
  26. ・キーボードのQ(装備画面で前のキャラに戻るボタン)を押すと、
  27.  ウィンドウが消える。Qか決定、キャンセルキーで元に戻る。
  28.  
  29. ・文章のどこでもいいので、以下の表記を行う。
  30. ・ \name[] : []の中の文字を、ウィンドウ左上に小さく表示する。
  31.  表示させる名前には、制御文字 \V、\P、\N、\G が使用可能。
  32.  
  33.  \h[-1] : プレーヤーの上にウィンドウをポップ。
  34.  \h[0] : 現在アクティブのイベントの上にウィンドウをポップ。
  35.  \h[1] : IDが1番のイベントの上にウィンドウをポップする。
  36.  hは大文字でもOK。
  37.  
  38. ウィンドウは通常の大きさのまま、テールだけ表示したい場合は、
  39.  \t[-2] : ウィンドウが上下に表示される時は、X座標をMINAS_TWE_X_POSで固定。
  40.            $win_x で左右に表示される時は、Y座標がウィンドウの中心やや下で固定。
  41.  \t[-3] : ウィンドウが上下に表示される時は、X座標をMINAS_THREE_X_POSで固定。
  42.            $win_x で左右に表示される時は、Y座標がウィンドウの中心やや下で固定。
  43.  \t[-1] : プレーヤーの上に向かってテール表示。
  44.  \t[0] : 現在アクティブのイベントに向かってテール表示。
  45.  \t[1] : IDが1番のイベントの上に向かってテール表示。
  46.  
  47.  \O[128] : 文字を透明にする。128はalphaの値で、0で透明、255で通常。
  48.  \D : 文字に影をつける
  49.  \hold : メッセージ表示の、最後の文章に限定。
  50.       メッセージが終わっても、ウィンドウを閉じずに残します。
  51.       他のメッセージが表示されて次へ送られる時に消えます。
  52.       なお、ホールドされているウィンドウは、Qボタンで消せません。
  53.  
  54.  
  55. ●その他
  56. ・ACEに標準装備されている機能は通常通り使用できます。
  57. ・A1殿([url]http://a1tktk.web.fc2.com/[/url])の立ち絵スクリプトに対応しています。
  58.  このスクリプトの上に「RGSS3用A1共通処理」
  59.  このスクリプトの下に「空メッセージでウィンドウを開かない」「立ち絵表示」を
  60.  配置して下さい。
  61.  残念ながら、「ネームウィンドウ」は使えません。上記\nameをお使いください。
  62. ※立ち絵を表示しない時は、注釈で「立ち絵表示 off」とした方が無難です。
  63. ・イベントの下から話しかけたら上へポップ、上から話しかけたら下へポップするという
  64.  機能を追加。カスタマイズポイントで POP_DIRECTION = ture と変更のこと。
  65.  
  66.  
  67. ●廃止機能 
  68. ・\Iがすでに使われているので、イタリック文字変換を廃止。
  69. ・スピード変更、改行、最後に入手したアイテムの表示を、ACE化にともない廃止。
  70.  
  71.  
  72. 【改訂履歴】
  73. 2012.01.10  ・ウィンドウを消したまま次のウィンドウを自動で表示すると、
  74.               ネームウィンドウが表示されるのを修正。
  75. 2012.01.11  ・ネームウィンドウが出しっぱなしになるのを修正。
  76. 2012.01.12  ・メニューを出してから決定ボタンを押すとネームウィンドウがでる不具合の修正。
  77. 2012.02.01 ・ネームウィンドウのオープン&クローズのタイミングを変更。
  78.       ・hold機能を追加。
  79. 2012.02.10 ・キャラポップした時、一行ずつしか表示されない不具合を修正。
  80. 2012.02.14 ・アイテム名などの文字数が正常に取得できなかったのを修正。
  81. 2012.02.21 ・話しかけられた方向によって、ポップ方向を変えられるようにした。
  82. 2012.02.25 ・すべてのシーン遷移の際はテールを破棄(イベント中でショップ起動など)
  83. 2012.02.28 ・エスケープ文字の処理が上手くいかない問題について暫定対策。
  84. 2012.03.05 ・微妙にウィンドウ幅が足りない時があったので、僅かにウィンドウ幅追加。
  85. 2012.03.14 ・ポップアップ時の顔グラ表示に対応。
  86. 2012.04.20 ・吹きだしが大型になると選択肢が入りきらない不具合の修正。
  87.             ・ネームウィンドウが残ったままシーン遷移があると、ネームウィンドウが
  88.              閉じない不具合の修正。
  89. 2012.05.02  ・名前には、制御文字 \V、\P、\N、\G が使用可能。
  90.             ・\V については、2段階の入れ子が使用可能。
  91.             ・ウィンドウ消去機能を、「背景を暗くする」に対応。
  92. 2012.05.09 ・通常の上表示のとき、ネームウィンドウが見切れるので少し下にずらす。
  93. 2012.05.12 ・ネームウィンドウの幅と高さを変更可能にした。
  94.             ・ネームウィンドウの高さを変えると、どんどん下に伸びるのを修正。
  95.  
  96. =end
  97.  
  98. #==============================================================================
  99. # カスタマイズポイント
  100. #==============================================================================
  101. #=begin
  102. class Window_Message < Window_Base
  103.   #
  104.   # 基本行数
  105.   #
  106.   MAX_LINE = 4
  107.   #
  108.   # \p[] - キャラポップの高さ
  109.   #
  110.   CHARPOP_HEIGHT = 40
  111.   #
  112.   #
  113.   #\name[]で表示されるウィンドウのX座標、Y座標、幅、高さ。
  114.   #座標は、メッセージウィンドウの左上端が原点。名前はウィンドウ中央に表示。
  115.   NAME_WINDOW_OFFSET_X =   0
  116.   NAME_WINDOW_OFFSET_Y = -24
  117.   NAME_WINDOW_OFFSET_WIDTH = 32
  118.   NAME_WINDOW_OFFSET_HIGHT = 10
  119.  
  120.   #
  121.   #
  122.   MINAS_TWE_X_POS = 100 # $t[-2]のときの、テールのX座標。
  123.   MINAS_THREE_X_POS = 444 # $t[-3]のときの、テールのX座標。
  124.  
  125.   POP_DIRECTION = true #イベントの方向を考慮。
  126. end
  127.  
  128. #(メモ)上表示で、ネームウィンドウのために少し下にずらす機能は、
  129. #再定義したupdate_placement_positionのところ。
  130.  
  131. #==============================================================================
  132. # 参照機能
  133. #==============================================================================
  134. class Game_Temp
  135.   attr_accessor :last_gain_material
  136.   attr_accessor :last_gain_holder
  137. end
  138. #==============================================================================
  139. # フルグレードアップベース - 制御文字・基本機能
  140. #==============================================================================
  141. class Window_Message < Window_Base
  142.   attr_accessor :tail
  143.   #--------------------------------------------------------------------------
  144.   # ● 特殊文字の変換 + 準備
  145.   #     変換・消去してもいい部分を処理、フラグのセット。
  146.   #--------------------------------------------------------------------------
  147.   alias xrxsv2_convert_escape_characters convert_escape_characters
  148.   def convert_escape_characters(text)
  149.     #@textsが使いずらいので、ここで別変数に保管。
  150.     @all_texts = []
  151.     str = text.gsub(/\\/) { "\e" }
  152.     @all_texts = str.split("\n")
  153.  
  154.     #この段階で、変数・アクター名を変換してしまう。
  155.     #ネームウィンドウ内の文字を変換するため。
  156.     text = convert_escape_characters_easy(text)
  157.  
  158.     # 初期化
  159.     contents.font.size   = Font.default_size
  160.     contents.font.bold   = Font.default_italic
  161.     contents.font.italic = Font.default_bold
  162.     contents.font.shadow = Font.default_shadow
  163.     @type_wait = 0
  164.     @line_widths = []
  165.     @line_aligns = []
  166.     self.pop_character = nil
  167.     # ウィンドウ保持指定\holdがあるか?
  168.     @window_hold = (text.gsub!(/\\hold/) { "" } != nil)
  169.     # \info
  170.     @info_mode = (text.gsub!(/\\info/) { "" } != nil)
  171.     # 改行削除指定\_があるか?
  172.     if (/\\_(.*?)\x00/.match(@text)) != nil
  173.       $game_message.choice_start -= 1
  174.       text.gsub!(/\\_(.*?)\x00/) { $1.to_s }
  175.     end
  176.     # \name 判定
  177.     if text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" }
  178.       name = $1
  179.       bitmap = @name_sprite.bitmap
  180.       w = [bitmap.text_size(name).width, 1].max + NAME_WINDOW_OFFSET_WIDTH
  181.       bitmap.dispose
  182.       @name_sprite.bitmap = Bitmap.new(w, 32)
  183.       bitmap = @name_sprite.bitmap
  184.       bitmap.draw_text(0, 0, bitmap.width, bitmap.height, name)
  185.       @name_window.width = w + 16
  186.       @name_window.height = bitmap.height + NAME_WINDOW_OFFSET_HIGHT
  187.       @name_window.create_contents
  188.       @name_window.open if @name_window.openness == 0
  189.       if self.visible #名前だけ表示されるのを防止。
  190.         @name_window.visible = true
  191.         @name_sprite.visible = true
  192.       else
  193.         @name_window.visible = false
  194.         @name_sprite.visible = false
  195.       end
  196.     else
  197.       @name_window.visible = false
  198.       @name_sprite.visible = false
  199.       @name_sprite.bitmap.dispose
  200.       @name_sprite.bitmap = Bitmap.new(32,32)
  201.     end
  202.     $name = $1 #あれこれで使うので、ネームウィンドウに表示予定の名前を取得。
  203.     # キャラボップモード
  204.     if text.gsub!(/\\[Hh]\[-1\]/) { "" }
  205.       self.pop_character = -1
  206.     elsif text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "" }
  207.       self.pop_character = $1.to_i
  208.     elsif text.gsub!(/\\[Hh]/) { "" }
  209.       self.pop_character = 0
  210.     #テール表示モード
  211.     elsif text.gsub!(/\\[Tt]\[-1\]/) { "" }
  212.       self.tail_character = -1
  213.     elsif text.gsub!(/\\[Tt]\[-2\]/) { "" }
  214.       self.tail_character = -2
  215.     elsif text.gsub!(/\\[Tt]\[-3\]/) { "" }
  216.       self.tail_character = -3
  217.     elsif text.gsub!(/\\[Tt]\[([0-9]+)\]/) { "" }
  218.       self.tail_character = $1.to_i
  219.     elsif text.gsub!(/\\[Tt]/) { "" }
  220.       self.tail_character = 0
  221.     else
  222.       self.pop_character = nil
  223.     end
  224.  
  225.     # 制御文字処理
  226.     text = xrxsv2_convert_escape_characters(text)
  227.     text.gsub!(/\\[Ss]\[([0-9]+)\]/i) { "\eS[#{$1}]" }
  228.     text.gsub!(/\\[Oo]\[([0-9]+)\]/i) { "\eO[#{$1}]" }
  229.     text.gsub!(/\\last_holder/i) { "\e18" }
  230.     text.gsub!(/\\last_material/i) { "\e19" }
  231.     text.gsub!(/\\B/) { "\eB" }
  232.     text.gsub!(/\\D/) { "\eD" }
  233.     #text.gsub!(/\\n/) { "\n" }
  234.     #
  235.     # ライン情報の取得
  236.     rxs = ["\x01","\x02","\x03","\x04","\x05","\x06","\x07","\x08",
  237.       /\[([0-9]+)\]/,
  238.       "\x11","\x12","\x13","\x14", "\x15", "\x16", "\x17", "\x18","\x19"]
  239.     lines = text.split("\x00")
  240.     @lines_max = lines.size
  241.     for i in 0...@lines_max
  242.       line = lines[i]
  243.       for rx in rxs
  244.         line.gsub!(rx) {""}
  245.       end
  246.       @line_aligns[i] =
  247.         line.sub!(/\\center/) {""} ? CENTER :
  248.         line.sub!(/\\right/)  {""} ? RIGHT :
  249.                                      AUTO
  250.       # 行の横幅の取得と設定
  251.       cx = text_width_no_escape(line,text) #test
  252.       #cx = contents.text_size(line,text).width
  253.       @line_widths[i] = cx
  254.     end
  255.     # 位置揃え制御文字の削除
  256.     text.gsub!(/\\center/) {""}
  257.     text.gsub!(/\\right/) {""}
  258.     # キャラポップ時のウィンドウリサイズ
  259.     reszie_window_for_pop
  260.  
  261.     del_tail # if @tail != nil
  262.     # $mes_id が空のときと戦闘中はふきだしを表示しない
  263.     if defined?($game_system.show_stand_picture) #立ち絵に対応。
  264.       $mes_id = -1 if $game_system.show_stand_picture == true
  265.     end
  266.     if $mes_id != nil and not $game_party.in_battle
  267.       # ふきだしのテールを描画
  268.       skin = "Window"
  269.       if @background == 0
  270.         #画像の準備
  271.         @tail = Sprite.new
  272.         @tail.visible = false
  273.         # 位置を取得
  274.         tale_pos = get_tale_pos
  275.         if $win_x != nil
  276.           if $win_x > 0
  277.             @tail.bitmap = Cache.system(skin + "-right")
  278.             @tail.x = tale_pos[0]
  279.             @tail.y = tale_pos[1]
  280.             @tail.z = self.z + 1
  281.           elsif  $win_x < 0
  282.             @tail.bitmap = Cache.system(skin + "-left")
  283.             @tail.x = tale_pos[0]
  284.             @tail.y = tale_pos[1]
  285.             @tail.z = self.z + 1
  286.           else
  287.             create_tail_up_under
  288.           end
  289.         else
  290.           create_tail_up_under
  291.         end
  292.         # エクストラスプライトに登録
  293.         @extra_sprites = [] if @extra_sprites.nil?
  294.         @extra_sprites.push(@tail) if @tail != nil
  295.         # 更新
  296.         update_tail
  297.       end
  298.     end
  299.  
  300.     open_and_wait #リサイズが終わった時点でウィンドウオープン。
  301.  
  302.     return text
  303.   end
  304.   #--------------------------------------------------------------------------
  305.   # ● 制御文字の変換。
  306.   #    変数・パーティ名・アクター名・所持金のみ変換する。
  307.   #    文字「\」はエスケープ文字(\e)に変換。
  308.   #--------------------------------------------------------------------------
  309.   def convert_escape_characters_easy(text)
  310.     result = text.to_s.clone
  311.     result.gsub!(/\\[vV]\[/)          { "\eV\[" }
  312.     result.gsub!(/\\[nN]\[/)          { "\eN\[" }
  313.     result.gsub!(/\\[pP]\[/)          { "\eP\[" }
  314.     result.gsub!(/\\[gG]/)          { "\eG" }
  315.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  316.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  317.     result.gsub!(/\eN\[(\d+)\]/i) { actor_name($1.to_i) }
  318.     result.gsub!(/\eP\[(\d+)\]/i) { party_member_name($1.to_i) }
  319.     result.gsub!(/\eG/i)          { Vocab::currency_unit }
  320.     result
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ● 文字の長さを取得する。エスケープ文字は含まない。
  324.   # line : 表示しようとしている全ての文字列。
  325.   # text : その列の文字。
  326.   #--------------------------------------------------------------------------
  327.   def text_width_no_escape(line , text_o)
  328.     add = 5 #微妙に足りないので水増し。
  329.     text = Marshal.load(Marshal.dump(text_o))
  330.     text.gsub!(/\ehold/) { "" }
  331.     text.gsub!(/\einfo/) { "" }
  332.     # 改行削除指定\_があるか?
  333.     if (/\\_(.*?)\x00/.match(@text)) != nil
  334.       $game_message.choice_start -= 1
  335.       text.gsub!(/\\_(.*?)\x00/) { "" }
  336.     end
  337.     # \name 判定
  338.     text.sub!(/\e[Nn]ame\[(.*?)\]/) { "" }
  339.     text.gsub!(/\e[Hh]\[-1\]/) { "" }
  340.     text.gsub!(/\e[Hh]\[([0-9]+)\]/) { "" }
  341.     text.gsub!(/\e[Hh]/) { "" }
  342.     text.gsub!(/\e[Tt]\[-1\]/) { "" }
  343.     text.gsub!(/\e[Tt]\[-2\]/) { "" }
  344.     text.gsub!(/\e[Tt]\[-3\]/) { "" }
  345.     text.gsub!(/\e[Tt]\[([0-9]+)\]/) { "" }
  346.     text.gsub!(/\e[Tt]/) { "" }
  347.     # 制御文字処理
  348.     text.gsub!(/\e[Ss]\[([0-9]+)\]/i) { "" }
  349.     text.gsub!(/\e[Oo]\[([0-9]+)\]/i) { "" }
  350.     text.gsub!(/\elast_holder/i) { "" }
  351.     text.gsub!(/\elast_material/i) { "" }
  352.     #text.gsub!(/\eV/) { "" } #変数に置き換える。
  353.     #text.gsub!(/\eN/) { "" } #名前へ置き換える。
  354.     #text.gsub!(/\eP/) { "" } #名前へ置き換える。
  355.     #text.gsub!(/\eG/) { "" } #金額へ置き換える。
  356.     #text.gsub!(/\eC/) { "" }
  357.     text.gsub!(/\eB/) { "" }
  358.     text.gsub!(/\eD/) { "" }
  359.     if text =~ /\eI/
  360.       loop do
  361.         if str = text.sub!(/\eI\[(\d+)\]/){ "" }
  362.           add += 24
  363.         else
  364.           break
  365.         end
  366.       end
  367.     end
  368.     #text.gsub!(/\\n/) { "\n" }
  369.     text.sub!(/\ecenter/) {""}
  370.     text.sub!(/\eright/)  {""}
  371.     text.gsub!(/\ecenter/) {""}
  372.     text.gsub!(/\eright/) {""}
  373.  
  374.     text = xrxsv2_convert_escape_characters(text)
  375.     basic_width = text_size(text).width + add
  376.     esc = text.scan(/\e(\S)/)
  377.     return ( basic_width - esc.size * (contents.font.size - 4) ) #\eの幅は20?
  378.   end
  379.   #--------------------------------------------------------------------------
  380.   # ● 最も長い列の長さを調べる。エスケープ文字は含まない。
  381.   #--------------------------------------------------------------------------
  382.   def max_width
  383.     text_size = []
  384.     for i in 0 ... @all_texts.size
  385.       text_size.push text_width_no_escape(@all_texts[i],@all_texts[i]) + 20
  386.     end
  387.     return text_size.max
  388.   end
  389.   #--------------------------------------------------------------------------
  390.   # ● 吹きだしテールが上か下の場合の画像を準備。
  391.   #--------------------------------------------------------------------------
  392.   def create_tail_up_under
  393.     skin = "Window"
  394.     tale_pos = get_tale_pos
  395.     case @position
  396.     when 0  # 上
  397.       @tail.bitmap = Cache.system(skin + "-top")
  398.       @tail.x = tale_pos[0]
  399.       @tail.y = tale_pos[1]
  400.       @tail.z = self.z + 1
  401.     when 1  # 中
  402.       @tail.dispose
  403.       @tail = nil
  404.     when 2  # 下
  405.       @tail.bitmap = Cache.system(skin + "-under")
  406.       @tail.x = tale_pos[0]
  407.       @tail.y = tale_pos[1]
  408.       @tail.z = self.z + 1
  409.     end
  410.   end
  411.   #--------------------------------------------------------------------------
  412.   # ● 全テキストの処理
  413.   #--------------------------------------------------------------------------
  414.   def process_all_text
  415.     #open_and_wait #リサイズがあるので、すぐにウィンドウをオープンしない。
  416.     text = convert_escape_characters($game_message.all_text)
  417.     pos = {}
  418.     new_page(text, pos)
  419.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  420.   end
  421.   #--------------------------------------------------------------------------
  422.   # ● メッセージの更新 *
  423.   #--------------------------------------------------------------------------
  424.   def update_message
  425.     @wait_count = @type_wait
  426.     loop do
  427.       c = @text.slice!(/./m)
  428.       case update_message_type(c)
  429.       when 1
  430.         break
  431.       when 2
  432.         next
  433.       end
  434.       break unless @show_fast or @line_show_fast
  435.     end
  436.   end
  437.   #--------------------------------------------------------------------------
  438.   # 一文字の描画 (返り値 1:break, 2:next)
  439.   #--------------------------------------------------------------------------
  440. #=begin
  441.   def process_escape_character(code, text, pos)
  442.     case code.upcase
  443.     when '$'
  444.       @gold_window.open
  445.     when '.'
  446.       wait(15)
  447.     when '|'
  448.       wait(60)
  449.     when '!'
  450.       input_pause
  451.     when '>'
  452.       @line_show_fast = true
  453.     when '<'
  454.       @line_show_fast = false
  455.     when '^'
  456.       @pause_skip = true
  457.     #when 'n'                      # 改行
  458.     #  new_line
  459.     #  max = MAX_LINE
  460.     #  max = 14 if self.pop_character != nil
  461.     #  if @line_count >= max      # 行数が最大のとき
  462.     #    unless @text.empty?           # さらに続きがあるなら
  463.     #      self.pause = true           # 入力待ちを入れる
  464.           #return 1
  465.     #    end
  466.     #  end
  467.     #when 'S'                       # \S[n]  (スピード変更)
  468.     #  text.sub!(/\[([0-9]+)\]/, "")
  469.     #  @type_wait = $1.to_i
  470.     #  return 2
  471.     when 'O'                       # \O 文字を透明にする。
  472.       text.sub!(/\[([0-9]+)\]/, "")
  473.       contents.font.color.alpha = $1.to_i
  474.       #return 2
  475.     when 'D' #\D 文字に影をつける
  476.       contents.font.shadow ^= true
  477.     #when '18'
  478.     #  name = ($game_temp.last_gain_holder.name rescue "")
  479.     #  update_message_type_draw_at(name)
  480.     #when '19'
  481.     #  item = ($game_temp.last_gain_material.item rescue nil)
  482.     #  draw_item_name(item, @contents_x, @contents_y)
  483.     #  @contents_x += 196
  484.     else
  485.       super
  486.     end
  487.  
  488.   end
  489. #=end
  490.   #--------------------------------------------------------------------------
  491.   # ● 改ページ処理
  492.   #--------------------------------------------------------------------------
  493.   alias xrxsv2_new_page new_page
  494.   def new_page(text, pos)
  495.     xrxsv2_new_page(text, pos)
  496.     update_charpop_window
  497.   end
  498.   #--------------------------------------------------------------------------
  499.   # ● 改行位置の取得
  500.   #--------------------------------------------------------------------------
  501.   #def new_line_x
  502.   #  $game_message.face_name.empty? ? 0 : 112
  503.   #end
  504.   #--------------------------------------------------------------------------
  505.   # ● 改行処理
  506.   #--------------------------------------------------------------------------
  507.   alias xrxsv2_new_line_x new_line_x
  508.   def new_line
  509.     xrxsv2_new_line
  510.     set_align
  511.   end
  512.   #--------------------------------------------------------------------------
  513.   # 位置揃え
  514.   #--------------------------------------------------------------------------
  515.   def set_align
  516.     w = @line_widths[@line_count].to_i
  517.     a = @line_aligns[@line_count]
  518.     case a
  519.     when CENTER
  520.       @contents_x = @contents_x + ((contents.width - @contents_x) - w) / 2
  521.     when RIGHT
  522.       @contents_x = contents.width - w
  523.     end
  524.   end
  525.   #--------------------------------------------------------------------------
  526.   # ● ファイバーのメイン処理 ☆再定義
  527.   #--------------------------------------------------------------------------
  528.   def fiber_main
  529.     $game_message.visible = true
  530.     update_background
  531.     update_placement
  532.     loop do
  533.       process_all_text if $game_message.has_text?
  534.       process_input
  535.       $game_message.clear
  536.       @gold_window.close
  537.       process_hold #ホールドウィンドウの処理。
  538.       Fiber.yield
  539.       break unless text_continue?
  540.     end
  541.     close_and_wait
  542.     $game_message.visible = false
  543.     @fiber = nil
  544.   end
  545.   #--------------------------------------------------------------------------
  546.   # 定数
  547.   #--------------------------------------------------------------------------
  548.   AUTO   = 0
  549.   LEFT   = 1
  550.   CENTER = 2
  551.   RIGHT  = 3
  552. end
  553. #==============================================================================
  554. # アクティブイベント取得
  555. #==============================================================================
  556. class Game_Interpreter
  557.   attr_reader   :event_id
  558. end
  559.  
  560.  
  561. #==============================================================================
  562. # 各種機能の追加 - キャラポップ/ネーム/ホールド
  563. #==============================================================================
  564. class Window_Message < Window_Base
  565.   #--------------------------------------------------------------------------
  566.   # ● カーソルの更新 *
  567.   #--------------------------------------------------------------------------
  568.   def update_cursor
  569.     if @index >= 0
  570.       x = ($game_message.face_name.empty? ? 0 : 112)
  571.       y = ($game_message.choice_start + @index) * WLH - 1
  572.       w = contents.width - x
  573.       if self.pop_character != nil
  574.         x += 28
  575.         w -= 20
  576.       end
  577.       self.cursor_rect.set(x, y, w, WLH)
  578.     else
  579.       self.cursor_rect.empty
  580.     end
  581.   end
  582.   #--------------------------------------------------------------------------
  583.   # キャラクターの取得
  584.   #   parameter : パラメータ
  585.   #--------------------------------------------------------------------------
  586.   def get_character(parameter)
  587.     # パラメータで分岐
  588.     case parameter
  589.     when -1  # プレイヤー
  590.       return $game_player
  591.     when 0  # 現在アクティブなイベント
  592.       id = $game_map.interpreter.event_id
  593.       events = $game_map.events
  594.       return events == nil ? nil : events[id]
  595.     else  # 特定のイベント
  596.       events = $game_map.events
  597.       return events == nil ? nil : events[parameter]
  598.     end
  599.   end
  600.   #--------------------------------------------------------------------------
  601.   # (メッセージ終了時)ホールドの処理
  602.   #--------------------------------------------------------------------------
  603.   def process_hold
  604.     if @window_hold
  605.       @held_windows.push(Window_Copy.new(self))
  606.       @held_windows.push(Window_Copy.new(@name_window))
  607.       @held_windows.push(Sprite_Copy.new(@name_sprite))
  608.       @held_windows.push(Sprite_Copy.new(@back_sprite))
  609.       for sprite in @extra_sprites
  610.         next if sprite.disposed?
  611.         @held_windows.push(Sprite_Copy.new(sprite))
  612.       end
  613.       @extra_sprites.clear
  614.       self.openness = 0
  615.       #@name_window.openness = 0
  616.       @back_sprite.visible = false
  617.     else
  618.       @held_windows.each {|object| object.dispose}
  619.       @held_windows.clear
  620.     end
  621.     #@name_window.close
  622.     #@name_sprite.visible = false
  623.   end
  624.   #--------------------------------------------------------------------------
  625.   # キャラポップ位置の設定と取得
  626.   #--------------------------------------------------------------------------
  627.   def pop_character=(character_id)
  628.     @pop_character = character_id
  629.   end
  630.   def pop_character
  631.     return @pop_character
  632.   end
  633.   #--------------------------------------------------------------------------
  634.   # キャラポップ時のウィンドウリサイズ
  635.   #--------------------------------------------------------------------------
  636.   def reszie_window_for_pop
  637.     #キャラポップ
  638.     if self.pop_character != nil
  639.       #max_x = @line_widths.max.to_i
  640.       #n  = max_x + 32
  641.       n = 0
  642.       n += $game_message.face_name.empty? ? 0 : 122
  643.       m  = $game_message.face_name.empty? ? 0 : 96
  644.       w  = @name_sprite.bitmap.width
  645.       self.width  = max_width + n
  646.       self.height = [@all_texts.size * line_height, m].max + 32
  647.       create_contents
  648.       update_charpop_window
  649.     elsif @info_mode
  650.       @line_aligns[0] = CENTER
  651.       self.x = - 8
  652.       self.width = Graphics.width + 16
  653.       self.height = 56
  654.       create_contents
  655.     else
  656.       self.x = 0
  657.       self.width  = Graphics.width
  658.       self.height = MAX_LINE * line_height + 32
  659.       update_placement #位置情報修正。
  660.       create_contents
  661.     end
  662.   end
  663.   #--------------------------------------------------------------------------
  664.   # ● 背景スプライトの作成
  665.   #--------------------------------------------------------------------------
  666.   alias xrxsv2_create_back_sprite create_back_sprite
  667.   def create_back_sprite
  668.     xrxsv2_create_back_sprite
  669.     @back_sprite.zoom_x = 1.0 * Graphics.width / @back_sprite.bitmap.width
  670.     @name_window = Window_Base.new(0,0,112,36)
  671.     @name_window.visible = false
  672.     @name_sprite = Sprite.new
  673.     @name_sprite.bitmap = Bitmap.new(32,32)
  674.     @name_sprite.visible = false
  675.     self.x = self.x
  676.     self.y = self.y
  677.     self.z = self.z
  678.     @held_windows = []
  679.     @extra_sprites = []
  680.   end
  681.   #--------------------------------------------------------------------------
  682.   # ● 背景スプライトの解放
  683.   #--------------------------------------------------------------------------
  684.   alias xrxsv2_dispose_back_sprite dispose_back_sprite
  685.   def dispose_back_sprite
  686.     xrxsv2_dispose_back_sprite
  687.     @name_window.dispose if @name_window != nil #メニュー画面を出そうとするとエラー?
  688.     @name_sprite.dispose if @name_sprite != nil
  689.     for window in @held_windows
  690.       window.dispose
  691.     end
  692.   end
  693.   #--------------------------------------------------------------------------
  694.   # ● 背景スプライトの更新
  695.   #--------------------------------------------------------------------------
  696.   alias xrxsv2_update_back_sprite update_back_sprite
  697.   def update_back_sprite
  698.     @name_window.update
  699.     xrxsv2_update_back_sprite
  700.     update_charpop_window
  701.   end
  702.   #--------------------------------------------------------------------------
  703.   # ウィンドウの位置と不透明度の設定 (キャラポップ)
  704.   #--------------------------------------------------------------------------
  705.   def update_charpop_window
  706.     if self.pop_character
  707.       character = get_character(self.pop_character)
  708.       return if character == nil
  709.       # [X座標]
  710.       n = self.width / 2
  711.       n = [n, @name_skin.width + 16].max if @current_name != nil
  712.       w = @name_sprite.bitmap.width
  713.       x = character.screen_x - [[n, w].max, self.width - 32].min
  714.       # [Y座標]
  715.       if self.pop_character == 0 and POP_DIRECTION #イベントの方向を考慮。
  716.         if character.direction == 2 #下向き
  717.           @position = 0 #上にポップ
  718.         elsif character.direction == 8 #上向き
  719.           @position = 2 #下にポップ
  720.         end
  721.       end
  722.       case @position
  723.       when 0
  724.         y = character.screen_y - CHARPOP_HEIGHT - self.height
  725.       else
  726.         y = character.screen_y + 16
  727.       end
  728.       x_max = Graphics.width - 4 - self.width
  729.       x_min = 4
  730.       y_max = Graphics.height - self.height
  731.       y_min = 4
  732.       self.x = [[x, x_max].min, x_min].max
  733.       self.y = [[y, y_max].min, y_min].max
  734.     end
  735.   end
  736.   #--------------------------------------------------------------------------
  737.   # 位置の連動
  738.   #--------------------------------------------------------------------------
  739.   def x=(n)
  740.     super
  741.     if @name_window
  742.       @name_window.x = n + NAME_WINDOW_OFFSET_X
  743.       @name_sprite.x = n + NAME_WINDOW_OFFSET_X + 8 + NAME_WINDOW_OFFSET_WIDTH / 2
  744.     end
  745.   end
  746.   def y=(n)
  747.     super
  748.     if @name_window
  749.       @name_window.y = n + NAME_WINDOW_OFFSET_Y
  750.       @name_sprite.y = n + NAME_WINDOW_OFFSET_Y + 2 + NAME_WINDOW_OFFSET_HIGHT / 2
  751.     end
  752.   end
  753.   def z=(n)
  754.     super
  755.     if @name_window
  756.       @name_window.z = n + 11#1 テールの上に表示されるので、Zを水増しする。
  757.       @name_sprite.z = n + 12#2
  758.     end
  759.   end
  760.   #--------------------------------------------------------------------------
  761.   # ● ファイバーのメイン処理
  762.   #--------------------------------------------------------------------------
  763.   def fiber_main_namewin
  764.     fiber_main_namewin_default
  765.     @name_window.openness = 0
  766.     @name_sprite.bitmap.clear
  767.     $name = ""
  768.   end
  769.   alias :fiber_main_namewin_default :fiber_main
  770.   alias :fiber_main :fiber_main_namewin
  771. end
  772. #==============================================================================
  773. # 伸縮対応
  774. #==============================================================================
  775. class Window_Message < Window_Base
  776.   #--------------------------------------------------------------------------
  777.   # ● ウィンドウの背景と位置の設定 [再定義]
  778.   #--------------------------------------------------------------------------
  779.   def reset_window
  780.     @background = $game_message.background
  781.     @position = $game_message.position
  782.     if @background == 0   # 通常ウィンドウ
  783.       self.opacity = 255
  784.     else                  # 背景を暗くする、透明にする
  785.       self.opacity = 0
  786.     end
  787.     case @position
  788.     when 0  # 上
  789.       self.y = 0
  790.       @gold_window.y = 360
  791.     when 1  # 中
  792.       self.y = (Graphics.height - self.height) / 2
  793.       @gold_window.y = 0
  794.     when 2  # 下
  795.       self.y = Graphics.height - self.height
  796.       @gold_window.y = 0
  797.     end
  798.   end
  799. end
  800. #==============================================================================
  801. # □ Window_Copy
  802. #------------------------------------------------------------------------------
  803. #   指定のウィンドウのコピーを作成します。
  804. #==============================================================================
  805. class Window_Copy < Window_Base
  806.   #--------------------------------------------------------------------------
  807.   # ○ オブジェクト初期化
  808.   #--------------------------------------------------------------------------
  809.   def initialize(window)
  810.     super(window.x, window.y, window.width, window.height)
  811.     self.contents = window.contents.dup unless window.contents.nil?
  812.     self.opacity = window.opacity
  813.     self.back_opacity = window.back_opacity
  814.     self.z = window.z - 3
  815.     self.visible = window.visible
  816.   end
  817. end
  818. #==============================================================================
  819. # □ Sprite_Copy
  820. #------------------------------------------------------------------------------
  821. #   指定のスプライトのコピーを作成します。
  822. #==============================================================================
  823. class Sprite_Copy < Sprite
  824.   #--------------------------------------------------------------------------
  825.   # ○ オブジェクト初期化
  826.   #--------------------------------------------------------------------------
  827.   def initialize(sprite)
  828.     super()
  829.     self.bitmap = sprite.bitmap.dup unless sprite.bitmap.nil?
  830.     self.opacity = sprite.opacity
  831.     self.x = sprite.x
  832.     self.y = sprite.y
  833.     self.z = sprite.z - 3
  834.     self.ox = sprite.ox
  835.     self.oy = sprite.oy
  836.     self.zoom_x = sprite.zoom_x
  837.     self.visible = sprite.visible
  838.   end
  839. end
  840.  
  841.  
  842.  
  843. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  844. #■吹きだしテールの表示ルーチン。
  845. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  846. #==============================================================================
  847. # +++ 「+ふきだし表示」VX +++
  848. # by パラ犬  [url]http://2d6.parasite.jp/[/url]
  849. #      ×
  850. #    row       [url]http://xms.rdy.jp/[/url]
  851. #
  852. # publish 2010/ 3/ 2
  853. # update  -
  854. #
  855. #------------------------------------------------------------------------------
  856. #    ほぼどんなメッセージウィンドウに対しても後付け可能な「ふきだし表示」です。
  857. #  また、テール部分のみの自動追尾機能を持ちます。
  858. #   ふきだし表示をするには、
  859. #  テール用画像「Window-top」「Window-under」を
  860. #  「Graphics/System」フォルダにインポートしておく必要があります。
  861. #==============================================================================
  862. # ■ Window_Message
  863. #==============================================================================
  864. class Window_Message < Window_Base
  865.   #--------------------------------------------------------------------------
  866.   # ● メッセージの開始
  867.   #--------------------------------------------------------------------------
  868.   alias parashelf_update_all_windows update_all_windows
  869.   def update_all_windows
  870.     parashelf_update_all_windows
  871.     update_tail
  872.   end
  873.   #--------------------------------------------------------------------------
  874.   # クローズ [オーバーライド]
  875.   #--------------------------------------------------------------------------
  876.   def close
  877.     super
  878.     del_tail
  879.     @name_window.close if @name_window != nil #ネームウィンドウのクローズ動作。
  880.   end
  881.   #--------------------------------------------------------------------------
  882.   # ● 背景スプライトの更新
  883.   #--------------------------------------------------------------------------
  884.   alias parashelf_update_back_sprite update_back_sprite
  885.   def update_back_sprite
  886.     parashelf_update_back_sprite
  887.     update_tail
  888.   end
  889.   #--------------------------------------------------------------------------
  890.   # ○ フレーム更新 (ふきだしテールの更新)
  891.   #--------------------------------------------------------------------------
  892.   def update_tail
  893.     # ふきだしモードではイベントの動きに追従
  894.     if $mes_id != nil and @tail != nil
  895.       tale_pos = get_tale_pos
  896.       @tail.x = tale_pos[0]
  897.       @tail.y = tale_pos[1]
  898.       update_tail_bitmap
  899.     end
  900.   end
  901.   ##--------------------------------------------------------------------------
  902.   # ○ ふきだしテールの画像を更新。
  903.   #--------------------------------------------------------------------------
  904.   def update_tail_bitmap
  905.     skin = "Window"
  906.     if $win_x != nil
  907.       if $win_x > 0
  908.         @tail.bitmap = Cache.system(skin + "-right")
  909.       elsif  $win_x < 0
  910.         @tail.bitmap = Cache.system(skin + "-left")
  911.       else
  912.         case @position
  913.         when 0  # 上
  914.           @tail.bitmap = Cache.system(skin + "-top")
  915.         when 2  # 下
  916.           @tail.bitmap = Cache.system(skin + "-under")
  917.         end
  918.       end
  919.     else
  920.       case @position
  921.       when 0  # 上
  922.         @tail.bitmap = Cache.system(skin + "-top")
  923.       when 2  # 下
  924.         @tail.bitmap = Cache.system(skin + "-under")
  925.       end
  926.     end
  927.     # 可視状態
  928.     if self.visible == true
  929.       @tail.visible = self.openness == 255
  930.     else
  931.       @tail.visible = false
  932.     end
  933.   end
  934.   #--------------------------------------------------------------------------
  935.   # ○ テールの位置を計算
  936.   #--------------------------------------------------------------------------
  937.   def get_tale_pos
  938.     if defined?($game_system.show_stand_picture) #A1立ち絵スクリプトを入れている。
  939.       if $game_system.show_stand_picture #立ち絵on
  940.         pos = get_tale_pos_stand_pic
  941.       else
  942.         pos = get_tale_pos_normal
  943.       end
  944.     else
  945.       pos = get_tale_pos_normal
  946.     end
  947.     return pos
  948.   end
  949.   #--------------------------------------------------------------------------
  950.   # ○ テールの位置を計算/立ち絵使用時。※NAME_CHANGEの編集必須。
  951.   #--------------------------------------------------------------------------
  952.   def get_tale_pos_stand_pic
  953.     if $game_message.face_name != ""  and @tail != nil
  954.       name = A1_System::StandPicture::NAME_CHANGE[$game_message.face_name]
  955.       chara = name[$game_message.face_index][0]
  956.       if @stand_pic[chara] != nil #立ち絵無しの場合通常通り。
  957.         x = @stand_pic[chara].pic_sprite.x + @stand_pic[chara].pic_sprite.width / 2
  958.         y = get_tale_pos_normal_updown
  959.         update_tail_bitmap
  960.       else
  961.         return get_tale_pos_normal #立ち絵が見つからない場合は通常通り。
  962.       end
  963.     else
  964.       return get_tale_pos_normal #立ち絵が見つからない場合は通常通り。
  965.     end
  966.     return [x,y]
  967.   end
  968.   #--------------------------------------------------------------------------
  969.   # ○ テールの位置を計算/立ち絵未使用時。
  970.   #--------------------------------------------------------------------------
  971.   def get_tale_pos_normal
  972.     if $mes_id == (-2) #左右の場合は高さはウィンドウ中心。上下ならやや左に配置。
  973.       if $win_x != nil
  974.         if $win_x > 0
  975.           x = $win_x - @tail.width / 2
  976.           y = self.y + self.height / 2 - @tail.height / 2
  977.         elsif $win_x < 0
  978.           x = self.width - @tail.width / 2
  979.           y = self.y + self.height / 2 - @tail.height / 2
  980.         else
  981.           x = MINAS_TWE_X_POS
  982.           y = get_tale_pos_normal_updown
  983.         end
  984.       else
  985.         x = MINAS_TWE_X_POS
  986.         y = get_tale_pos_normal_updown
  987.       end
  988.     elsif $mes_id <= (-3) #左右の場合は高さはウィンドウ中心。上下ならやや左に配置。
  989.       if $win_x != nil
  990.         if $win_x > 0
  991.           x = $win_x - @tail.width / 2
  992.           y = self.y + self.height / 2
  993.         elsif $win_x < 0
  994.           x = self.width - @tail.width / 2
  995.           y = self.y + self.height / 2
  996.         else
  997.           x = MINAS_THREE_X_POS
  998.           y = get_tale_pos_normal_updown
  999.         end
  1000.       else
  1001.         x = MINAS_THREE_X_POS
  1002.         y = get_tale_pos_normal_updown
  1003.       end
  1004.     else
  1005.       character = get_character($mes_id)
  1006.       x = [[character.screen_x - 16, self.x].max, self.x + self.width - 32].min
  1007.       if $win_x != nil
  1008.         if $win_x > 0
  1009.           x = $win_x - @tail.width / 2
  1010.           y = character.screen_y
  1011.         elsif $win_x < 0
  1012.           x = self.width
  1013.           y = character.screen_y
  1014.         else
  1015.           y = get_tale_pos_normal_updown
  1016.         end
  1017.       else
  1018.         y = get_tale_pos_normal_updown
  1019.       end
  1020.     end
  1021.     return [x, y]
  1022.   end
  1023.   #--------------------------------------------------------------------------
  1024.   # ○ テールが上下の時、かつ[-2][-3]でない時のy座標の取得。
  1025.   #--------------------------------------------------------------------------
  1026.   def get_tale_pos_normal_updown
  1027.     case @position
  1028.     when 0
  1029.       y = self.y + self.height - @tail.height / 2
  1030.     else
  1031.       y = self.y - @tail.height / 2
  1032.     end
  1033.     return y
  1034.   end
  1035.   #--------------------------------------------------------------------------
  1036.   # ○ ふきだしを破棄
  1037.   #--------------------------------------------------------------------------
  1038.   def del_tail
  1039.     if @tail != nil
  1040.       @tail.dispose
  1041.       @tail = nil
  1042.     end
  1043.   end
  1044. end
  1045. #
  1046. # ▼▲▼ XRXS 9拡張CO-X. ふきだし自動設定 ▼▲▼
  1047. #==============================================================================
  1048. # ■ Window_Message
  1049. #==============================================================================
  1050. class Window_Message < Window_Base
  1051.   #--------------------------------------------------------------------------
  1052.   # ○ ポップキャラクターの設定
  1053.   #--------------------------------------------------------------------------
  1054.   def pop_character=(character_id)
  1055.     @pop_character = character_id
  1056.     $mes_id = character_id
  1057.   end
  1058.   #--------------------------------------------------------------------------
  1059.   # ○ テールキャラクターの設定
  1060.   #--------------------------------------------------------------------------
  1061.   def tail_character=(character_id)
  1062.     #@pop_character = character_id
  1063.     $mes_id = character_id
  1064.   end
  1065. end
  1066.  
  1067.  
  1068. #==============================================================================
  1069. # ■ Window_ChoiceList
  1070. #------------------------------------------------------------------------------
  1071. #  イベントコマンド[選択肢の表示]で、Y座標を修正します。
  1072. #==============================================================================
  1073. class Window_ChoiceList < Window_Command
  1074.   #--------------------------------------------------------------------------
  1075.   # ● ウィンドウ位置の更新
  1076.   #--------------------------------------------------------------------------
  1077.   def update_placement_hukidasi
  1078.     #self.width = [max_choice_width + 12, 96].max + padding * 2
  1079.     #self.width = [width, Graphics.width].min
  1080.     #self.height = fitting_height($game_message.choices.size)
  1081.     #self.x = Graphics.width - width
  1082.     #if @message_window.y >= Graphics.height / 2
  1083.     #  self.y = @message_window.y - height
  1084.     #else
  1085.     #  self.y = @message_window.y + @message_window.height
  1086.     #end
  1087.     update_placement_hukidasi_default
  1088.     if self.y + self.height > Graphics.height
  1089.       self.y -= ( ( self.height + self.y ) - Graphics.height)
  1090.       self.z += 100
  1091.     end
  1092.   end
  1093.   alias :update_placement_hukidasi_default :update_placement
  1094.   alias :update_placement :update_placement_hukidasi
  1095. end
  1096.  
  1097. #==============================================================================
  1098. # ■ Scene_Menu
  1099. #------------------------------------------------------------------------------
  1100. #  メニューを開いてからウィンドウが出るとネームウィンドウが表示される不具合修正。
  1101. #==============================================================================
  1102. #class Scene_Menu < Scene_MenuBase
  1103. #  def terminate_hukidasi_menyu
  1104. #    @name_window.openness = 0 if @name_window != nil
  1105. #    terminate_hukidasi_menyu_default
  1106. #  end
  1107. #  alias :terminate_hukidasi_menyu_default :terminate
  1108. #  alias :terminate :terminate_hukidasi_menyu
  1109. #end
  1110.  
  1111. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  1112. #■ウィンドウ非表示ルーチン
  1113. #■吹きだしテールとネームウィンドウに対応。
  1114. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  1115. #==============================================================================
  1116. # L(キーボードのQ)を押すと、メッセージウィンドウを表示・非表示
  1117. #==============================================================================
  1118. class Window_Message < Window_Base
  1119.   def update_winoff
  1120.     unless $game_party.in_battle #バトル中は無効。
  1121.       if Input.trigger?(Input::L)
  1122.         if self.visible == true
  1123.           self.visible = false
  1124.           @background = 777 if @back_sprite != nil and @background == 1 #「背景を暗くする」
  1125.           @tail.visible = false if @tail != nil
  1126.         else
  1127.           self.visible = true
  1128.           @background = 1 if @back_sprite != nil and @background == 777 #「背景を暗くする」
  1129.         end
  1130.         if @name_window != nil
  1131.           if @name_window.visible == false and $name != nil and $name != ""
  1132.             @name_window.visible = true
  1133.             @name_sprite.visible = true
  1134.           else
  1135.             @name_window.visible = false
  1136.             @name_sprite.visible = false
  1137.           end
  1138.         end
  1139.       elsif Input.trigger?(Input::C) or Input.trigger?(Input::B)
  1140.         if self.visible == false
  1141.           self.visible = true
  1142.           @back_sprite.visible = true unless @back_sprite
  1143.         end
  1144.         @tail.visible = true if @tail != nil and @tail.visible == false
  1145.         if @name_window != nil and $name != nil
  1146.           if $name != ""
  1147.             @name_window.visible = true
  1148.             @name_sprite.visible = true
  1149.           end
  1150.         end
  1151.       end
  1152.     end
  1153.     update_winoff_default
  1154.   end
  1155.   alias :update_winoff_default :update
  1156.   alias :update :update_winoff
  1157. end
  1158.  
  1159.  
  1160. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  1161. #■ウィンドウ表示位置指定ルーチン
  1162. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  1163. #===========================================================================
  1164. #イベントコマンド「スクリプト」を使い、
  1165. #$win_x=100 
  1166. #$win_y=100
  1167. #と入力すれば、ウィンドウを(100、100)の位置に表示します。
  1168. #使わない時は
  1169. #$win_x=nil
  1170. #などとnilを入力しておいてください。
  1171. #===========================================================================
  1172. class Window_Message < Window_Base
  1173.   #--------------------------------------------------------------------------
  1174.   # ● ウィンドウの背景と位置の設定 [再定義]
  1175.   #--------------------------------------------------------------------------
  1176.   def update_placement_position
  1177.     update_placement_position_default
  1178.     if $win_x != nil
  1179.       if $win_x > 0
  1180.         self.x = $win_x
  1181.         self.width -= $win_x
  1182.       else
  1183.         self.x = 0
  1184.         self.width += $win_x
  1185.       end
  1186.     end
  1187.     if $win_y != nil
  1188.       self.y = $win_y
  1189.     end
  1190.     #上表示の時、ネームウィンドウが見切れるので少し下にずらす。
  1191.     if self.y == 0 and @position == 0 and @name_window != nil and $name != nil
  1192.       self.y += (-NAME_WINDOW_OFFSET_Y)
  1193.     end
  1194.   end
  1195.   alias_method :update_placement_position_default, :update_placement
  1196.   alias_method :update_placement, :update_placement_position
  1197. end
  1198.  
  1199.  
  1200. #==============================================================================
  1201. # ■ SceneManager
  1202. #------------------------------------------------------------------------------
  1203. #  シーン遷移のさい、テールを破棄。ネームウィンドウのデータをクリア。
  1204. #==============================================================================
  1205. module SceneManager
  1206.   #--------------------------------------------------------------------------
  1207.   # ● 呼び出し
  1208.   #--------------------------------------------------------------------------
  1209.   def self.call_sceman_hukidasi(scene_class)
  1210.     if defined?(self.scene.message_window)
  1211.       self.scene.message_window.del_tail if self.scene.message_window.tail != nil
  1212.       $name = ""
  1213.     end
  1214.     @stack.push(@scene)
  1215.     @scene = scene_class.new
  1216.   end
  1217.   #--------------------------------------------------------------------------
  1218.   # ● クラスメソッドのエイリアス
  1219.   #--------------------------------------------------------------------------
  1220.   class << self
  1221.     alias :call_sceman_hukidasi_default :call
  1222.     alias :call :call_sceman_hukidasi
  1223.   end
  1224. end
  1225.  
  1226. #==============================================================================
  1227. # ■ Scene_Map
  1228. #------------------------------------------------------------------------------
  1229. #  戦闘トランジションのさい、テールを破棄。
  1230. #==============================================================================
  1231. class Scene_Map < Scene_Base
  1232.   attr_accessor :message_window
  1233.   #--------------------------------------------------------------------------
  1234.   # ● 戦闘前トランジション実行
  1235.   #--------------------------------------------------------------------------
  1236.   def perform_battle_transition_hukidasi
  1237.     @message_window.del_tail #テールの破棄
  1238.     perform_battle_transition_hukidasi_default
  1239.   end
  1240.   alias_method :perform_battle_transition_hukidasi_default, :perform_battle_transition
  1241.   alias_method :perform_battle_transition, :perform_battle_transition_hukidasi
  1242. end

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

点评

不好意思,这个我真的不懂······VA我实在没有碰过呢  发表于 2013-5-20 17:56
资料库更新...累死人的一堆文字...
我不是做avg,卻要有avg的叙述....-   3 -

Lv5.捕梦者 (版主)

梦石
20
星屑
1840
在线时间
6925 小时
注册时间
2012-12-14
帖子
11485

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

2
发表于 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软件制作,请大家多多帮助我哦。
落雪君的欢乐像素教程,欢迎查阅。

回复 支持 反对

使用道具 举报

Lv1.梦旅人

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

点评

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

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
687 小时
注册时间
2012-10-29
帖子
1543
4
发表于 2013-5-21 16:27:11 | 只看该作者
本帖最后由 j433463 于 2013-5-21 16:31 编辑

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

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



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

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

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

点评

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

评分

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

查看全部评分

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

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-27 09:50

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表