查看: 3456|回复: 8

[已经解决] 這個日本 的 漫畫式對話 要怎麼使用呢?

[复制链接]
梦石
0
星屑
5241
在线时间
760 小时
注册时间
2009-1-21
回帖
236
发表于 2012-7-14 04:34:25 | 显示全部楼层 |阅读模式

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

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

×
RT

網址在這

他必要的腳本我都弄了

只是 我看不太懂 要怎麼使用就是了

日文我只懂一點點  所以 整體 我還是看不大懂
梦石
0
星屑
803
在线时间
2068 小时
注册时间
2011-10-3
回帖
1620
发表于 2012-7-14 12:25:27 | 显示全部楼层
  1. =begin
  2. 吹きだしウィンドウVXAce

  3. 2011.12.25 tamura改造
  4. 2012年02月28日 改訂

  5. ※このスクリプトは、ちいさな本屋様(http://xrxs.at-ninja.jp/)
  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. \h[-1] : プレーヤーの上にウィンドウをポップ。
  24. \h[0] : 現在アクティブのイベントの上にウィンドウをポップ。
  25. \h[1] : IDが1番のイベントの上にウィンドウをポップする。
  26. hは大文字でもOK。

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

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


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


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


  54. 【改訂履歴】
  55. 2012.01.10  ?ウィンドウを消したまま次のウィンドウを自動で表示すると、
  56.               ネームウィンドウが表示されるのを修正。
  57. 2012.01.11  ?ネームウィンドウが出しっぱなしになるのを修正。
  58. 2012.01.12  ?メニューを出してから決定ボタンを押すとネームウィンドウがでる不具合の修正。
  59. 2012.02.01 ?ネームウィンドウのオープン&クローズのタイミングを変更。
  60.       ?hold機能を追加。
  61. 2012.02.10 ?キャラポップした時、一行ずつしか表示されない不具合を修正。
  62. 2012.02.14 ?アイテム名などの文字数が正常に取得できなかったのを修正。
  63. 2012.02.21 ?話しかけられた方向によって、ポップ方向を変えられるようにした。
  64. 2012.02.25 ?すべてのシーン遷移の際はテールを破棄(イベント中でショップ起動など)
  65. 2012.02.28 ?エスケープ文字の処理が上手くいかない問題について暫定対策。

  66. =end

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

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


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



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

  999. #==============================================================================
  1000. # ■ Scene_Menu
  1001. #------------------------------------------------------------------------------
  1002. #  メニューを開いてからウィンドウが出るとネームウィンドウが表示される不具合修正。
  1003. #==============================================================================
  1004. #class Scene_Menu < Scene_MenuBase
  1005. #  def terminate_hukidasi_menyu
  1006. #    @name_window.openness = 0 if @name_window != nil
  1007. #    terminate_hukidasi_menyu_default
  1008. #  end
  1009. #  alias :terminate_hukidasi_menyu_default :terminate
  1010. #  alias :terminate :terminate_hukidasi_menyu
  1011. #end

  1012. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  1013. #■ウィンドウ非表示ルーチン
  1014. #■吹きだしテールとネームウィンドウに対応。
  1015. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  1016. #==============================================================================
  1017. # L(キーボードのQ)を押すと、メッセージウィンドウを表示?非表示
  1018. #==============================================================================
  1019. class Window_Message < Window_Base
  1020.   def update_winoff
  1021.     unless $game_party.in_battle #バトル中は無効。
  1022.       if Input.trigger?(Input::L)
  1023.         if self.visible == true
  1024.           self.visible = false
  1025.           @tail.visible = false if @tail != nil
  1026.         else
  1027.           self.visible = true
  1028.         end
  1029.         if @name_window != nil
  1030.           if @name_window.visible == false and $name != nil and $name != ""
  1031.             @name_window.visible = true
  1032.             @name_sprite.visible = true
  1033.           else
  1034.             @name_window.visible = false
  1035.             @name_sprite.visible = false
  1036.           end
  1037.         end
  1038.       elsif Input.trigger?(Input::C) or Input.trigger?(Input::B)
  1039.         self.visible = true if self.visible == false
  1040.         @tail.visible = true if @tail != nil and @tail.visible == false
  1041.         if @name_window != nil and $name != nil
  1042.           if $name != ""
  1043.             @name_window.visible = true
  1044.             @name_sprite.visible = true
  1045.           end
  1046.         end
  1047.       end
  1048.     end
  1049.     update_winoff_default
  1050.   end
  1051.   alias :update_winoff_default :update
  1052.   alias :update :update_winoff
  1053. end


  1054. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  1055. #■ウィンドウ表示位置指定ルーチン
  1056. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  1057. #===========================================================================
  1058. #イベントコマンド「スクリプト」を使い、
  1059. #$win_x=100 
  1060. #$win_y=100
  1061. #と入力すれば、ウィンドウを(100、100)の位置に表示します。
  1062. #使わない時は
  1063. #$win_x=nil
  1064. #などとnilを入力しておいてください。
  1065. #===========================================================================
  1066. class Window_Message < Window_Base
  1067.   #--------------------------------------------------------------------------
  1068.   # ● ウィンドウの背景と位置の設定 [再定義]
  1069.   #--------------------------------------------------------------------------
  1070.   def update_placement_position
  1071.     update_placement_position_default
  1072.     if $win_x != nil
  1073.       if $win_x > 0
  1074.         self.x = $win_x
  1075.         self.width -= $win_x
  1076.       else
  1077.         self.x = 0
  1078.         self.width += $win_x
  1079.       end
  1080.     end
  1081.     if $win_y != nil
  1082.       self.y = $win_y
  1083.     end
  1084.   end
  1085.   alias_method :update_placement_position_default, :update_placement
  1086.   alias_method :update_placement, :update_placement_position
  1087. end


  1088. #==============================================================================
  1089. # ■ SceneManager
  1090. #------------------------------------------------------------------------------
  1091. #  シーン遷移のさい、テールを破棄する。
  1092. #==============================================================================
  1093. module SceneManager
  1094.   #--------------------------------------------------------------------------
  1095.   # ● 呼び出し
  1096.   #--------------------------------------------------------------------------
  1097.   def self.call_sceman_hukidasi(scene_class)
  1098.     if defined?(self.scene.message_window)
  1099.       self.scene.message_window.del_tail if self.scene.message_window.tail != nil
  1100.     end
  1101.     @stack.push(@scene)
  1102.     @scene = scene_class.new
  1103.   end
  1104.   #--------------------------------------------------------------------------
  1105.   # ● クラスメソッドのエイリアス
  1106.   #--------------------------------------------------------------------------
  1107.   class << self
  1108.     alias :call_sceman_hukidasi_default :call
  1109.     alias :call :call_sceman_hukidasi
  1110.   end
  1111. end

  1112. #==============================================================================
  1113. # ■ Scene_Map
  1114. #------------------------------------------------------------------------------
  1115. #  戦闘トランジションのさい、テールを破棄。
  1116. #==============================================================================
  1117. class Scene_Map < Scene_Base
  1118.   attr_accessor :message_window
  1119.   #--------------------------------------------------------------------------
  1120.   # ● 戦闘前トランジション実行
  1121.   #--------------------------------------------------------------------------
  1122.   def perform_battle_transition_hukidasi
  1123.     @message_window.del_tail #テールの破棄
  1124.     perform_battle_transition_hukidasi_default
  1125.   end
  1126.   alias_method :perform_battle_transition_hukidasi_default, :perform_battle_transition
  1127.   alias_method :perform_battle_transition, :perform_battle_transition_hukidasi
  1128. end
复制代码
回复

使用道具 举报

梦石
0
星屑
5241
在线时间
760 小时
注册时间
2009-1-21
回帖
236
 楼主| 发表于 2012-7-14 13:04:59 | 显示全部楼层
布里蓝 发表于 2012-7-14 12:25

雖然說
這個 我剛剛有看到

不過 我還是比較想知道
這類的 要怎麼用


這個是VX 的
我給的腳本是 VA 的
雖然所需要的圖 是一樣的
不過不知道 功能有沒有一樣就是了
像是 顯示 名字  更改顏色  之類的

%%%.jpg


可是那個VA 腳本 我看不大懂 要怎麼使用
回复

使用道具 举报

梦石
0
星屑
803
在线时间
2068 小时
注册时间
2011-10-3
回帖
1620
发表于 2012-7-14 13:26:10 | 显示全部楼层
如果你要VX的话你就发错区了。



用法:
显示文章:
\name[名字]对话对话………………

在\name[]后面加上\h[]的话可以把对话框变成气泡式对话框

\h[]的“[]”可以不加,不加就是箭头直接指着该事件,[-1]的话就是显示在玩家头上,

可以填入任意事件编号,就会显示到对应事件上

评分

参与人数 1星屑 +200 梦石 +2 收起 理由
迷糊的安安 + 200 + 2 认可答案 附赠66RPG提供的精美好人卡一张^^.

查看全部评分

回复

使用道具 举报

梦石
0
星屑
5241
在线时间
760 小时
注册时间
2009-1-21
回帖
236
 楼主| 发表于 2012-7-14 15:58:08 | 显示全部楼层
布里蓝 发表于 2012-7-14 13:26
如果你要VX的话你就发错区了。

沒有阿
我要的是 VA的

請問 你的 用法
是你的 腳本

還是 我一樓 的腳本呢?!


此外 感謝幫忙
回复

使用道具 举报

梦石
0
星屑
50
在线时间
78 小时
注册时间
2011-6-29
回帖
11
发表于 2012-7-14 16:26:14 | 显示全部楼层
他說的是他那份腳本的使用方法

不過你這份腳本的使用方法也寫得好像不是很清楚
我大概看了一下他腳本裡的說明

先到「設定項目」裡面把一些該設定的設定好
之後使用內建指令的「註釋」,在裡面輸入

[pre lang="ruby" line="1"]イベント吹き出し event_id[/pre]

其中 event_id的部份就是你要用泡泡框的事件的ID
這樣應該就可以用泡泡框了

因為他說明寫得不清不楚 大概就是這樣用吧
回复

使用道具 举报

梦石
0
星屑
803
在线时间
2068 小时
注册时间
2011-10-3
回帖
1620
发表于 2012-7-14 16:37:01 | 显示全部楼层
LZ的脚本我进都进不去,就把我用的给LZ了,反正都是VA的
回复

使用道具 举报

梦石
0
星屑
5241
在线时间
760 小时
注册时间
2009-1-21
回帖
236
 楼主| 发表于 2012-7-14 18:06:09 | 显示全部楼层
布里蓝 发表于 2012-7-14 16:37
LZ的脚本我进都进不去,就把我用的给LZ了,反正都是VA的



主腳本

[pre lang="ruby" line="1"]#===========================================================================
# ◆ A1 Scripts ◆
#    吹き出しメッセージ(RGSS3)
#
# バージョン   : 1.00 (2012/01/12)
# 作者         : A1
# URL     : http://a1tktk.web.fc2.com/
#---------------------------------------------------------------------------
# 機能:
# ・吹き出しメッセージを表示します
#---------------------------------------------------------------------------
# 更新履歴   :2012/01/12 Ver1.00 リリース
#---------------------------------------------------------------------------
# 設置場所      
#    A1共通スクリプト以下
#    (ネームウィンドウ以下)
#
# 必要スクリプト
#    A1共通スクリプトVer4.00以上
#
# 必要ファイル
#    Window_Popup.png  ※ Graphics/System にインポート
#---------------------------------------------------------------------------
# 使い方
#   ■ 設定項目 に設定
#
#   イベントコマンド「注釈」に記述
#
#     並列吹き出し
#
#       指定後1回のの文章を並列吹き出しとして表示します
#       並列吹き出しは、吹き出し表示中でもプレイヤーの移動や
#       イベントコマンドの実行・続行が可能です
#
#       また、他の吹き出しと同時に閉じることがなくなります
#
#     イベント吹き出し event_id
#
#       イベントを直接指定して吹き出しを表示します
#
#     吹き出しクローズ key
#
#       指定した吹き出しを閉じます
#       設定項目で設定した [歩行グラフィック名]_[歩行グラフィックIndex] を
#       key に指定します
#
#       例:吹き出しクローズ Actor4_0
#
#     吹き出しクローズ [イベント,event_id]
#
#       イベント吹き出しで表示した吹き出しを閉じます
#
#       例:吹き出しクローズ [イベント,5]
#
#           ※先に「イベント吹き出し」でevent_id 5 のイベントに
#             吹き出しを表示させているものとします
#
#     吹き出し使用 on|off
#
#       吹き出しの使用を切り替えます
#       on で吹き出し使用、off で吹き出し使用しなくなります
#
#
#   メッセージウィンドウコマンド
#
#     \CC[count] :クローズカウントを設定します(フレーム数)
#                  設定項目のデフォルト値より優先されます
#
#     \KP        :吹き出しのヒレが「考え中」になります
#
#     \PR        :並列吹き出し状態として表示した吹き出しの
#                  並列吹き出し状態をメッセージ終了後に解除します
#
#                  解除された場合、他の吹き出しと同時に閉じるようになります
#==============================================================================
$imported ||= {}
$imported["A1_PopupMassage"] = true
if $imported["A1_Common_Script"]
old_common_script("吹き出しメッセージ", "4.00") if common_version < 4.00
#==============================================================================
# ■ 設定項目
#==============================================================================
module A1_System::CnildMassageWindowConfig
  #--------------------------------------------------------------------------
  # 顔グラフィックと歩行グラフィックの対応
  #
  #  "[顔グラフィック名]_[Index]" => "[歩行グラフィック名]_[Index]" ※Index毎に設定
  #  "[顔グラフィック名]"         => "[歩行グラフィック名]_[Index]" ※該当顔グラフィック全てに適用
  #
  #  歩行グラフィックは配列で複数指定することが可能です
  #--------------------------------------------------------------------------
  LINK_FACE       = {
   # 顔グラフィック => 歩行グラフィック
    "Actor4_0"      => "Actor4_0",
    "Actor4_4"      => "Actor4_4",
    "Actor4_5"      => "Actor4_5",
  }
  #--------------------------------------------------------------------------
  # 文字入力待ちでないウィンドウが閉じるまでの時間(フレーム)のデフォルト値
  #   -1 にすると手動で閉じるかイベント終了まで閉じません
  #   -1 にすると「並列吹き出し」にしたウィンドウは手動で閉じるまでずっと閉じません
  #--------------------------------------------------------------------------
  DEFAULT_CLOSE_COUNT = -1
  #--------------------------------------------------------------------------
  # 吹き出しメッセージ使用のデフォルト値
  #--------------------------------------------------------------------------
  DEFAULT_ENABLE_POPUP = true
end
#==============================================================================
# ■ Cache
#------------------------------------------------------------------------------
#  各種グラフィックを読み込み、Bitmap オブジェクトを作成、保持するモジュール
# です。読み込みの高速化とメモリ節約のため、作成した Bitmap オブジェクトを内部
# のハッシュに保存し、同じビットマップが再度要求されたときに既存のオブジェクト
# を返すようになっています。
#==============================================================================

module Cache
  #--------------------------------------------------------------------------
  # ○ 顔グラフィックの取得
  #--------------------------------------------------------------------------
  def self.half_face(filename)
    load_file_name = "Graphics/Faces/#{filename}"
    key            = "#{load_file_name}_halfface"
    load_resize_bitmap(load_file_name, key, [-0.5, -0.5])
  end
end
#==============================================================================
# ■ Window_Message
#------------------------------------------------------------------------------
#  文章表示に使うメッセージウィンドウです。
#==============================================================================

class Window_Message < Window_Base
  #--------------------------------------------------------------------------
  # ○ 定数
  #--------------------------------------------------------------------------
  LINK_FACE = A1_System::CnildMassageWindowConfig::LINK_FACE
  #--------------------------------------------------------------------------
  # ○ 子メッセージウィンドウのキーを取得
  #--------------------------------------------------------------------------
  def child_key
    return event_id_key if $game_temp.event_popup_id
    key = LINK_FACE["#{$game_message.face_name}_#{$game_message.face_index}"]
    key = LINK_FACE["#{$game_message.face_name}"] unless key
    return key
  end
  #--------------------------------------------------------------------------
  # ○ イベントIDからキーを設定
  #--------------------------------------------------------------------------
  def event_id_key
    key = "event_id_key_#{$game_temp.event_popup_id}"
    $game_temp.event_popup_id = nil
    return key
  end
  #--------------------------------------------------------------------------
  # ☆ 全ウィンドウの作成
  #--------------------------------------------------------------------------
  alias a1_child_message_window_wm_create_all_windows create_all_windows
  def create_all_windows
    a1_child_message_window_wm_create_all_windows
    @child_message_window = {}
  end
  #--------------------------------------------------------------------------
  # ☆ 全ウィンドウの解放
  #--------------------------------------------------------------------------
  alias a1_child_message_window_wm_dispose_all_windows dispose_all_windows
  def dispose_all_windows
    a1_child_message_window_wm_dispose_all_windows
    @child_message_window.values.each {|window| window.dispose }
  end
  #--------------------------------------------------------------------------
  # ☆ 全ウィンドウの更新
  #--------------------------------------------------------------------------
  alias a1_child_message_window_wm_update_all_windows update_all_windows
  def update_all_windows
    a1_child_message_window_wm_update_all_windows
    @child_message_window.values.each {|window| window.update }
    close_window = $game_message.close_message
    @child_message_window[close_window].close if close_window && @child_message_window[close_window]
    $game_message.close_message = nil
  end
  #--------------------------------------------------------------------------
  # ☆ 全テキストの処理
  #--------------------------------------------------------------------------
  alias a1_child_message_window_wm_process_all_text process_all_text
  def process_all_text
    @use_child = false
    return a1_child_message_window_wm_process_all_text unless need_setup?
    @child_key = child_key
    return if setup_child_message if @child_key && !@child_key.empty?
    a1_child_message_window_wm_process_all_text
  end
  #--------------------------------------------------------------------------
  # ○ 子メッセージウィンドウのセットアップが必要?
  #--------------------------------------------------------------------------
  def need_setup?
    return false if $game_party.in_battle
    return false if @my_child_window
    return $game_system.enable_child_msg
  end
  #--------------------------------------------------------------------------
  # ○ 子メッセージウィンドウのセットアップ
  #--------------------------------------------------------------------------
  def setup_child_message
    @child_message_window[@child_key] ||= create_child_message
    return false unless @child_message_window[@child_key].link_event
    close
    process_child_message_window(@child_message_window[@child_key])
    return true
  end
  #--------------------------------------------------------------------------
  # ○ 子メッセージウィンドウの作成
  #--------------------------------------------------------------------------
  def create_child_message
    window = Window_ChildMessage.new
    return set_link_event_id(window, $1.to_i) if @child_key =~ /event_id_key_(\d+)/
    return window if link_player(window)
    $game_map.events.values.each {|event| break if link_event(event, window) }
    return window
  end
  #--------------------------------------------------------------------------
  # ○ リンクするプレイヤーの取得
  #--------------------------------------------------------------------------
  def link_player(window)
    return true if link_event($game_player, window)
    $game_player.followers.each {|follower| return true if link_event(follower, window) }
    return false
  end
  #--------------------------------------------------------------------------
  # ○ リンクするイベントの取得
  #--------------------------------------------------------------------------
  def link_event(event, window)
    return false unless search_link_event(event.character_name, event.character_index)
    set_link_event(window, event)
    return true
  end
  #--------------------------------------------------------------------------
  # ○ リンクするイベントの検索
  #--------------------------------------------------------------------------
  def search_link_event(name, index)
    return "#{name}_#{index}" == @child_key unless @child_key.is_a?(Array)
    @child_key.each {|key| return true if "#{name}_#{index}" == key }
    return false
  end
  #--------------------------------------------------------------------------
  # ○ リンクするイベントの設定(ID)
  #--------------------------------------------------------------------------
  def set_link_event_id(window, event_id)
    window.link_event = $game_map.events[event_id]
    return window
  end
  #--------------------------------------------------------------------------
  # ○ リンクするイベントの設定
  #--------------------------------------------------------------------------
  def set_link_event(window, event)
    window.link_event = event
  end
  #--------------------------------------------------------------------------
  # ○ 子メッセージウィンドウの処理
  #--------------------------------------------------------------------------
  def process_child_message_window(window)
    @child_window = window
    window.position     = $game_message.position
    text                = convert_escape_characters($game_message.all_text)
    text_width          = $a1_common.text_width(window.contents.font, text)
    $game_message.texts = text.split("\n")
    window.set_face_info($game_message.face_name, $game_message.face_index)
    window.set_width(window.new_line_x + text_width + standard_padding * 2)
    window.background   = $game_message.background
    window.create_contents
    setup_priority(window)
    window.process_all_text
    @use_child = true
  end
  #--------------------------------------------------------------------------
  # ○ 子メッセージウィンドウの表示優先度の設定
  #--------------------------------------------------------------------------
  def setup_priority(now_window)
    @priority_order ||= []
    @priority_order.delete(@child_key)
    @priority_order.insert(0, @child_key)
    @priority_order.each_with_index {|key, i | @child_message_window[key].priority = @priority_order.size - i }
  end
  #--------------------------------------------------------------------------
  # ○ クローズカウントのセット
  #--------------------------------------------------------------------------
  def set_close_count(value)
    @child_window.close_count = value
    return ""
  end
  #--------------------------------------------------------------------------
  # ○ ポップアップ種別のセット
  #--------------------------------------------------------------------------
  def set_popup_kind
    @child_window.popup_kind = 1
    return ""
  end
  #--------------------------------------------------------------------------
  # ☆ 入力待ち処理
  #--------------------------------------------------------------------------
  alias a1_child_message_window_wm_input_pause input_pause
  def input_pause
    return if @use_child
    a1_child_message_window_wm_input_pause
  end
  #--------------------------------------------------------------------------
  # ☆ ウィンドウを閉じ、完全に閉じるまで待つ
  #--------------------------------------------------------------------------
  alias a1_child_message_window_wm_close_and_wait close_and_wait
  def close_and_wait
    @child_message_window.values.each {|window| window.close if window.input_wait }
    a1_child_message_window_wm_close_and_wait
    @priority_order = []
  end
  #--------------------------------------------------------------------------
  # ☆ 全ウィンドウが完全に閉じているか判定
  #--------------------------------------------------------------------------
  alias a1_child_message_window_wm_all_close? all_close?
  def all_close?
    return false unless a1_child_message_window_wm_all_close?
    @child_message_window.values.each {|window| return false unless window.close? if window.input_wait }
    return true
  end
  #--------------------------------------------------------------------------
  # ☆ 背景と位置の変更判定
  #--------------------------------------------------------------------------
  alias a1_child_message_window_wm_settings_changed? settings_changed?
  def settings_changed?
    return false if $game_system.enable_child_msg
    a1_child_message_window_wm_settings_changed?
  end
  #--------------------------------------------------------------------------
  # ○ 吹き出しの初期化
  #--------------------------------------------------------------------------
  def init_popup_message
    @child_message_window.values.each {|window| window.dispose }
    @child_message_window = {}
  end
end
#==============================================================================
# ■ Window_ChildMessage
#==============================================================================

class Window_ChildMessage < Window_Message
  #--------------------------------------------------------------------------
  # ○ 定数
  #--------------------------------------------------------------------------
  CLOSE_COUNT      = A1_System::CnildMassageWindowConfig::DEFAULT_CLOSE_COUNT
  POS_UP           = 0
  POS_MIDDLE       = 1
  POS_DOWN         = 2
  POPUP_RECT       = { POS_UP     => [Rect.new( 0,  0, 32, 64), Rect.new( 0, 64, 32, 64)],
                       POS_MIDDLE => [Rect.new( 0,  0, 32, 64), Rect.new( 0, 64, 32, 64)],
                       POS_DOWN   => [Rect.new(32,  0, 32, 64), Rect.new(32, 64, 32, 64)],
                     }
  #--------------------------------------------------------------------------
  # ○ オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    @my_child_window = true
    @screen_width = Graphics.width
    super
    create_popup
  end
  #--------------------------------------------------------------------------
  # ○ 表示優先度の設定
  #--------------------------------------------------------------------------
  def priority=(value)
    self.z = 200 + value
    @popup_sprite.z = 200 + value
  end
  #--------------------------------------------------------------------------
  # ○ 吹き出しスプライトの作成
  #--------------------------------------------------------------------------
  def create_popup
    @popup_sprite = Sprite.new
    @popup_sprite.visible = false
    @popup_bitmap = Cache.system("Window_Popup")
    bitmap = Bitmap.new(32, 64)
    @popup_sprite.bitmap = bitmap
    @input_wait = true
  end
  #--------------------------------------------------------------------------
  # ○ 顔グラフィックの情報を設定
  #--------------------------------------------------------------------------
  def set_face_info(name, index)
    @face_name  = name
    @face_index = index
    @name_window_key = show_name(@face_name, @face_index) if $imported["A1_Name_Window"]
  end
  #--------------------------------------------------------------------------
  # ○ リンクするイベントの取得
  #--------------------------------------------------------------------------
  def link_event
    @event
  end
  #--------------------------------------------------------------------------
  # ○ リンクするイベントの設定
  #--------------------------------------------------------------------------
  def link_event=(event)
    @event = event
  end
  #--------------------------------------------------------------------------
  # ○ 表示位置の設定
  #--------------------------------------------------------------------------
  def position=(pos)
    @position = pos
    @position = 0 if @position == 1
    set_popup_bitmap(0)
  end
  #--------------------------------------------------------------------------
  # ○ 背景の設定
  #--------------------------------------------------------------------------
  def background=(type)
    @background = type
    self.opacity = @background == 0 ? 255 : 0
    setup_back_ground if @background == 1
    @back_sprite.visible = false if @back_sprite && @background != 1
  end
  #--------------------------------------------------------------------------
  # ○ 背景のセットアップ
  #--------------------------------------------------------------------------
  def setup_back_ground
    @back_bitmap.dispose if @back_bitmap
    create_back_bitmap_ex
    @back_sprite = Sprite.new unless @back_sprite
    setup_back_sprite
  end
  #--------------------------------------------------------------------------
  # ○ 背景のビットマップ作成
  #--------------------------------------------------------------------------
  def create_back_bitmap_ex
    @back_bitmap = Bitmap.new(width, height)
    rect1 = Rect.new(0, 0, width, 12)
    rect2 = Rect.new(0, 12, width, height - 24)
    rect3 = Rect.new(0, height - 12, width, 12)
    @back_bitmap.gradient_fill_rect(rect1, back_color2, back_color1, true)
    @back_bitmap.fill_rect(rect2, back_color1)
    @back_bitmap.gradient_fill_rect(rect3, back_color1, back_color2, true)
  end
  #--------------------------------------------------------------------------
  # ○ 背景のスプライトの作成
  #--------------------------------------------------------------------------
  def setup_back_sprite
    @back_sprite.bitmap = @back_bitmap
    @back_sprite.z = z - 1
    @back_sprite.visible = false
  end
  #--------------------------------------------------------------------------
  # ○ 背景ビットマップの解放
  #--------------------------------------------------------------------------
  def dispose_back_bitmap
    super if @back_bitmap
  end
  #--------------------------------------------------------------------------
  # ○ 背景スプライトの解放
  #--------------------------------------------------------------------------
  def dispose_back_sprite
    super if @back_sprite
  end
  #--------------------------------------------------------------------------
  # ○ 背景スプライトの更新
  #--------------------------------------------------------------------------
  def update_back_sprite
    return unless @back_sprite && @background == 1
    @back_sprite.x = self.x
    @back_sprite.y = self.y
    @back_sprite.visible = true
    @back_sprite.opacity = openness
    @back_sprite.update
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウ背景の更新
  #--------------------------------------------------------------------------
  def update_background
    self.opacity = @background == 0 ? 255 : 0
  end
  #--------------------------------------------------------------------------
  # ○ フレーム更新
  #--------------------------------------------------------------------------
  def update
    return unless @event
    update_pos
    super
    update_close_count
    update_background
  end
  #--------------------------------------------------------------------------
  # ○ クローズカウントの更新
  #--------------------------------------------------------------------------
  def update_close_count
    return unless @close_count
    return if @close_count < 0
    @close_count -= 1
    auto_close if @close_count == 0
  end
  #--------------------------------------------------------------------------
  # ○ ポップアップスプライト位置の設定
  #--------------------------------------------------------------------------
  def set_popup_pos
    @popup_sprite.x = @event.screen_x
    @popup_sprite.y = self.y + popup_pos_y
    @popup_sprite.visible = open? && @background == 0
  end
  #--------------------------------------------------------------------------
  # ○ ポップアップビットマップの設定
  #--------------------------------------------------------------------------
  def set_popup_bitmap(kind)
    @popup_sprite.bitmap.clear
    @popup_sprite.bitmap.blt(0, 0, @popup_bitmap, POPUP_RECT[@position][kind])
  end
  #--------------------------------------------------------------------------
  # ○ ポップアップ種別の設定
  #--------------------------------------------------------------------------
  def popup_kind=(kind)
    set_popup_bitmap(1)
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウ位置の更新
  #--------------------------------------------------------------------------
  def update_pos
    self.x = @event.screen_x + @pos_x
    self.y = @event.screen_y + pos_y
    set_popup_pos
    set_name_window_pos if $imported["A1_Name_Window"]
  end
  #--------------------------------------------------------------------------
  # ○ ネームウィンドウの位置設定
  #--------------------------------------------------------------------------
  def set_name_window_pos
    return unless @name_windows[@name_window_key]
    @name_windows[@name_window_key].x = self.x + 24
    @name_windows[@name_window_key].y = name_window_y
    @name_windows[@name_window_key].z = self.z
    @name_windows[@name_window_key].set_name_sprite_pos
  end
  #--------------------------------------------------------------------------
  # ○ ネームウィンドウのy座標設定
  #--------------------------------------------------------------------------
  def name_window_y
    return self.y + self.height - 12 if @position == 2
    self.y - 16
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウx座標の取得
  #--------------------------------------------------------------------------
  def set_pos_x
    base = @event.screen_x - 64
    return @pos_x = (@screen_width - self.width) - (base + 64) if base + self.width > @screen_width
    @pos_x = -64
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウy座標の取得
  #--------------------------------------------------------------------------
  def pos_y
    return -116 if @position == 0
    return  16 if @position == 2
  end
  #--------------------------------------------------------------------------
  # ○ ポップアップy座標の取得
  #--------------------------------------------------------------------------
  def popup_pos_y
    return self.height - 32 if @position == 0
    return -32 if @position == 2
  end
  #--------------------------------------------------------------------------
  # ○ 自動で閉じる
  #--------------------------------------------------------------------------
  def auto_close
    close
    @close_count = nil
  end
  #--------------------------------------------------------------------------
  # ○ 解放
  #--------------------------------------------------------------------------
  def dispose
    @popup_sprite.bitmap.dispose
    @popup_sprite.dispose
    super
  end
  #--------------------------------------------------------------------------
  # ○ 制御文字の事前変換
  #--------------------------------------------------------------------------
  def convert_escape_characters(text)
    text
  end
  #--------------------------------------------------------------------------
  # ○ 背景ビットマップの作成
  #--------------------------------------------------------------------------
  def create_back_bitmap
  end
  #--------------------------------------------------------------------------
  # ○ 背景スプライトの作成
  #--------------------------------------------------------------------------
  def create_back_sprite
  end
  #--------------------------------------------------------------------------
  # ○ 全ウィンドウの作成
  #--------------------------------------------------------------------------
  def create_all_windows
  end
  #--------------------------------------------------------------------------
  # ○ 全ウィンドウの解放
  #--------------------------------------------------------------------------
  def dispose_all_windows
  end
  #--------------------------------------------------------------------------
  # ○ 全ウィンドウの更新
  #--------------------------------------------------------------------------
  def update_all_windows
  end
  #--------------------------------------------------------------------------
  # ○ 全ウィンドウが完全に閉じているか判定
  #--------------------------------------------------------------------------
  def all_close?
    close?
  end
  #--------------------------------------------------------------------------
  # ○ ファイバーの更新
  #--------------------------------------------------------------------------
  def update_fiber
  end
  #--------------------------------------------------------------------------
  # ○ 入力処理
  #--------------------------------------------------------------------------
  def process_input
    input_pause unless @pause_skip
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウ幅の取得
  #--------------------------------------------------------------------------
  def window_width
    return self.width unless self.disposed?
    Graphics.width
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウ高さの取得
  #--------------------------------------------------------------------------
  def window_height
    fitting_height(visible_line_number)
  end
  #--------------------------------------------------------------------------
  # ○ 表示行数の取得
  #--------------------------------------------------------------------------
  def visible_line_number
    return 2
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウ幅の設定
  #--------------------------------------------------------------------------
  def set_width(width)
    self.width         = width
  end
  #--------------------------------------------------------------------------
  # ○ テキストの設定
  #--------------------------------------------------------------------------
  def text=(text)
    @text = text
  end
  #--------------------------------------------------------------------------
  # ○ 全テキストの処理
  #--------------------------------------------------------------------------
  def process_all_text
    @input_wait = $game_temp.input_wait
    $game_temp.input_wait = true
    set_pos_x
    super
    @init_close_count = CLOSE_COUNT unless @init_close_count
    input_pause
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウを開き、完全に開くまで待つ
  #--------------------------------------------------------------------------
  def open_and_wait
    open
    Fiber.yield until open? if @input_wait
  end
  #--------------------------------------------------------------------------
  # ○ 入力待ち取得
  #--------------------------------------------------------------------------
  def input_wait
    @input_wait
  end
  #--------------------------------------------------------------------------
  # ○ 入力待ち取得
  #--------------------------------------------------------------------------
  def input_wait
    @input_wait
  end
  #--------------------------------------------------------------------------
  # ○ 入力待ち処理
  #--------------------------------------------------------------------------
  def input_pause
    reset_close_count
    super if @input_wait
    @input_wait = true if @parallel_release
    @parallel_release = false
    start_close_count
  end
  #--------------------------------------------------------------------------
  # ○ クローズカウントの開始
  #--------------------------------------------------------------------------
  def start_close_count
    @close_count = @init_close_count
    @init_close_count = nil
  end
  #--------------------------------------------------------------------------
  # ○ クローズカウントの設定
  #--------------------------------------------------------------------------
  def close_count=(count)
    @init_close_count = count
  end
  #--------------------------------------------------------------------------
  # ○ クローズカウントのリセット
  #--------------------------------------------------------------------------
  def reset_close_count
    @close_count      = nil
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウを閉じる
  #--------------------------------------------------------------------------
  def close
    reset_close_count
    super
  end
  #--------------------------------------------------------------------------
  # ○ 改行位置の取得
  #--------------------------------------------------------------------------
  def new_line_x
    $game_message.face_name.empty? ? 0 : 56
  end
  #--------------------------------------------------------------------------
  # ○ 制御文字の処理
  #     code : 制御文字の本体部分(「\C[1]」なら「C」)
  #     text : 描画処理中の文字列バッファ(必要なら破壊的に変更)
  #     pos  : 描画位置 {:x, :y, :new_x, :height}
  #--------------------------------------------------------------------------
  def process_escape_character(code, text, pos)
    case code.upcase
    when 'PR'
      @parallel_release = true
    else
      super
    end
  end
  #--------------------------------------------------------------------------
  # ○ ネームウィンドウの表示
  #--------------------------------------------------------------------------
  def show_name_window(face_name, face_index, x, size = 96)
    super
    set_name_window_pos
  end
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  ゲーム中の全てのウィンドウのスーパークラスです。
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ☆ 顔グラフィックの描画
  #     enabled : 有効フラグ。false のとき半透明で描画
  #--------------------------------------------------------------------------
  alias a1_child_message_window_wb_draw_face draw_face
  def draw_face(face_name, face_index, x, y, size = 96)
    return draw_face_half(face_name, face_index, x, y, size) if @my_child_window
    a1_child_message_window_wb_draw_face(face_name, face_index, x, y, size)
  end
  #--------------------------------------------------------------------------
  # ○ 顔グラフィックの描画(ハーフサイズ)
  #     enabled : 有効フラグ。false のとき半透明で描画
  #--------------------------------------------------------------------------
  def draw_face_half(face_name, face_index, x, y, enabled = true)
    draw_half_face(face_name, face_index, x, y, enabled) unless face_name.empty?
    show_name_window(face_name, face_index, x, 48) if $imported["A1_Name_Window"]
  end
  #--------------------------------------------------------------------------
  # ○ 顔グラフィックの描画(ハーフサイズ)
  #--------------------------------------------------------------------------
  def draw_half_face(face_name, face_index, x, y, enabled)
    bitmap = Cache.half_face(face_name)
    rect = Rect.new(face_index % 4 * 48, face_index / 4 * 48, 48, 48)
    contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  end
  #--------------------------------------------------------------------------
  # ☆ 制御文字の事前変換
  #    実際の描画を始める前に、原則として文字列に変わるものだけを置き換える。
  #    文字「\」はエスケープ文字(\e)に変換。
  #--------------------------------------------------------------------------
  alias a1_child_message_window_wb_convert_escape_characters convert_escape_characters
  def convert_escape_characters(text)
    result = a1_child_message_window_wb_convert_escape_characters(text)
    result.gsub!(/\eCC\[(\d+)\]/i)          { set_close_count($1.to_i) }
    result.gsub!(/\eKP/i)                   { set_popup_kind }
    result
  end
end
#==============================================================================
# ■ Game_Message
#------------------------------------------------------------------------------
#  文章や選択肢などを表示するメッセージウィンドウの状態を扱うクラスです。この
# クラスのインスタンスは $game_message で参照されます。
#==============================================================================

class Game_Message
  #--------------------------------------------------------------------------
  # ○ 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :close_message
  #--------------------------------------------------------------------------
  # ☆ オブジェクト初期化
  #--------------------------------------------------------------------------
  alias a1_child_message_window_gm_initialize initialize
  def initialize
    a1_child_message_window_gm_initialize
    @input_wait    = true
    @close_message = nil
  end
  #--------------------------------------------------------------------------
  # ○ 表示するテキストの設定
  #--------------------------------------------------------------------------
  def texts=(text)
    @texts = text
  end
end
#==============================================================================
# ■ Game_Temp
#------------------------------------------------------------------------------
#  セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン
# スタンスは $game_temp で参照されます。
#==============================================================================

class Game_Temp
  #--------------------------------------------------------------------------
  # ○ 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :input_wait
  attr_accessor :event_popup_id
  #--------------------------------------------------------------------------
  # ☆ オブジェクト初期化
  #--------------------------------------------------------------------------
  alias a1_child_message_gt_initialize initialize
  def initialize
    a1_child_message_gt_initialize
    @input_wait     = true
    @event_popup_id = nil
  end
end
#==============================================================================
# ■ Game_System
#------------------------------------------------------------------------------
#  システム周りのデータを扱うクラスです。セーブやメニューの禁止状態などを保存
# します。このクラスのインスタンスは $game_system で参照されます。
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # ○ 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :enable_child_msg
  #--------------------------------------------------------------------------
  # ☆ オブジェクト初期化
  #--------------------------------------------------------------------------
  alias a1_child_message_gs_initialize initialize
  def initialize
    a1_child_message_gs_initialize
    @enable_child_msg = A1_System::CnildMassageWindowConfig::DEFAULT_ENABLE_POPUP
  end
end
#==============================================================================
# ■ A1_System::CommonModule
#==============================================================================

class A1_System::CommonModule
  #--------------------------------------------------------------------------
  # ☆ 注釈コマンド定義
  #--------------------------------------------------------------------------
  alias a1_child_message_define_command define_command
  def define_command
    a1_child_message_define_command
    @cmd_108["並列吹き出し"]     = :sub_message
    @cmd_108["吹き出しクローズ"] = :close_popup
    @cmd_108["吹き出し使用"]     = :use_popup_message
    @cmd_108["イベント吹き出し"] = :event_popup_message
  end
end
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
#  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
# Game_Troop クラス、Game_Event クラスの内部で使用されます。
#==============================================================================

class Game_Interpreter
  #--------------------------------------------------------------------------
  # ○ 並列吹き出し
  #--------------------------------------------------------------------------
  def sub_message(params)
    $game_temp.input_wait = false
  end
  #--------------------------------------------------------------------------
  # ○ 吹き出しクローズ
  #--------------------------------------------------------------------------
  def close_popup(params)
    return close_popup_id(params[0]) if params[0].is_a?(Array)
    $game_message.close_message = params[0]
  end
  #--------------------------------------------------------------------------
  # ○ 吹き出しクローズ(ID)
  #--------------------------------------------------------------------------
  def close_popup_id(params)
    $game_message.close_message = "event_id_key_#{params[1].to_i}" if params[0] == "イベント"
  end
  #--------------------------------------------------------------------------
  # ○ 吹き出し使用
  #--------------------------------------------------------------------------
  def use_popup_message(params)
    $game_system.enable_child_msg = params[0] == "on" ? true : false
  end
  #--------------------------------------------------------------------------
  # ○ イベント吹き出し
  #--------------------------------------------------------------------------
  def event_popup_message(params)
    $game_temp.event_popup_id = params[0].to_i
  end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
#  マップ画面の処理を行うクラスです。
#==============================================================================

class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # ☆ 場所移動の処理
  #--------------------------------------------------------------------------
  alias a1_child_message_sm_perform_transfer perform_transfer
  def perform_transfer
    prev_map = $game_map.map_id
    a1_child_message_sm_perform_transfer
    @message_window.init_popup_message if prev_map != $game_map.map_id
  end
end
#==============================================================================
# ■ ネームウィンドウインポート時処理
#==============================================================================
if $imported["A1_Name_Window"]
#==============================================================================
# ■ Window_FaceName
#==============================================================================

class Window_FaceName < Window_Base
  #--------------------------------------------------------------------------
  # ○ ネームスプライトの位置設定
  #--------------------------------------------------------------------------
  def set_name_sprite_pos
    @name_sprite.x = self.x + self.width / 2
    @name_sprite.y = self.y + self.height / 2
  end
end;end
end[/pre]






A1 共通
[pre lang="ruby" line="1"]# ===========================================================================
# ◆ A1 Scripts ◆
#    A1共通処理(RGSS2/RGSS3共用)
#
# バージョン   : 4.50 (2012/01/26)
# 作者         : A1
# URL     : http://a1tktk.web.fc2.com/
# ---------------------------------------------------------------------------
# 更新履歴   :2011/11/11 Ver1.00 新規作成
#        :2011/12/22 Ver2.00 RGSS3用と同様の処理に変更
#        :2011/12/30 Ver2.10 RGSS3用メソッドを追加
#        :2011/12/30 Ver3.00 RGSS3用共通処理と統合
#        :2011/12/31 Ver3.10 マップチップサーチの仕様を変更
#        :2011/12/31 Ver3.10 拡張通行判定を追加
#        :2012/01/01 Ver3.11 クラス名の取得処理を追加
#              :2012/01/02 Ver3.20 配列を考慮したsplit処理を追加
#              :2012/01/02 Ver3.20 配列の全ての要素を整数にする処理を追加
#              :2012/01/02 Ver3.30 注釈の処理の仕様を変更
#              :2012/01/02 Ver3.40 「前のイベントコマンドの取得」を追加
#              :2012/01/03 Ver3.50 「フレーム更新」を追加
#              :2012/01/04 Ver3.60 「指定のウィンドウが開いている間ウェイト」追加
#              :2012/01/04 Ver3.70 RGSS2用処理見直し
#              :2012/01/05 Ver3.80 注釈文字列にエスケープコマンド対応
#              :2012/01/05 Ver3.80 多次元配列を考慮したsplit処理を追加
#              :2012/01/05 Ver3.80 注釈にスクリプト処理機能を追加
#              :2012/01/10 Ver3.90 文字縁取り描画を追加
#              :2012/01/11 Ver4.00 テキストビットマップのキャッシュを追加
#              :2012/01/13 Ver4.01 「タイルセットの変更」ができなくなる不具合を修正
#              :2012/01/14 Ver4.10 split処理を強化
#              :2012/01/14 Ver4.20 空白を含む注釈コマンドに対応
#              :2012/01/14 Ver4.21 split処理の不具合を修正
#              :2012/01/21 Ver4.30 メモの内容を取得する関数を追加
#              :2012/01/24 Ver4.40 メモの内容を取得する関数を追加
#              :2012/01/24 Ver4.50 メモの内容を取得する関数を追加
# ---------------------------------------------------------------------------
# 設置場所      
#  なるべく上の方
#
# 必要スクリプト
#    なし
#==============================================================================
$imported = {} if $imported == nil
$imported["A1_Common_Script"] = 4.50
#==============================================================================
# ■ Kernel
#==============================================================================
module Kernel
  #--------------------------------------------------------------------------
  # ○ RGSSのバージョン取得
  #--------------------------------------------------------------------------
  def rgss_version
    return 3 if defined? Graphics.play_movie
    return 2 if defined? Graphics.resize_screen
    return 1
  end
  #--------------------------------------------------------------------------
  # ○ コモンスクリプトのバージョン取得
  #--------------------------------------------------------------------------
  def common_version
    $imported["A1_Common_Script"]
  end
  #--------------------------------------------------------------------------
  # ○ コモンスクリプトのバージョンが古い
  #--------------------------------------------------------------------------
  def old_common_script(script_name, version)
    msgbox("#{script_name}にはA1共通スクリプトVer#{version}以上が必要です")
  end
end
#==============================================================================
# ■ A1_System
#==============================================================================
module A1_System
end
#==============================================================================
# ■ A1_System::CommonModule
#==============================================================================

class A1_System::CommonModule
  #--------------------------------------------------------------------------
  # ○ 定数
  #--------------------------------------------------------------------------
  TWOBYTE_LIST = {
                  " " => " ",
                  "=" => "=",
                  ":" => ":"
                  }
  #--------------------------------------------------------------------------
  # ○ オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    define_command
  end
  #--------------------------------------------------------------------------
  # ○ 変換対象の全角文字を半角に置換
  #--------------------------------------------------------------------------
  def replace_twobyte(str)
    for key in TWOBYTE_LIST.keys
      str.gsub!(key) {TWOBYTE_LIST[key]}
    end
    return str
  end
  #--------------------------------------------------------------------------
  # ○ マイナスが含まれている文字列を数値にする
  #--------------------------------------------------------------------------
  def minus_to_i(s)
    if s[0,0] == "-"
      s.gsub!("-","")
      return s.to_i * -1
    else
      return s.to_i
    end
  end
  #--------------------------------------------------------------------------
  # ○ ミリ秒単位の現在時間
  #--------------------------------------------------------------------------
  def now_usec
    now = Time.now
    hour = now.hour * 60 * 60
    min  = now.min * 60
    sec  = now.sec
    msec = (now.usec / 1000.0).round
    return (hour + min + sec) * 1000 + msec
  end
  #--------------------------------------------------------------------------
  # ○ イベントリストの作成
  #--------------------------------------------------------------------------
  def create_event_list(code, indent, parameters)
    list = RPG::EventCommand.new
    list.code       = code
    list.indent     = indent
    list.parameters = parameters
    return list
  end
  #--------------------------------------------------------------------------
  # ○ メソッド呼び出し
  #--------------------------------------------------------------------------
  def send_method(method_name)
    return send(method_name) if respond_to?(method_name)
  end
  #--------------------------------------------------------------------------
  # ○ オブジェクトの型を判断してStringならエンコード
  #--------------------------------------------------------------------------
  def encoding_string(obj)
    obj.force_encoding("UTF-8") if obj.is_a?(String)
    return obj
  end
  #--------------------------------------------------------------------------
  # ○ メモの内容から必要な情報を取得
  #--------------------------------------------------------------------------
  def note_data(note, key)
    result = []
    note.each_line {|line|
      next unless line =~ /<#{key}[ ]?(.*)>/
      return true if $1.empty?
      data = $a1_common.replace_twobyte($1).split(" ")
      for st in data
        result.push(st)
      end
    }
    return false if result.empty?
    return result
  end
  #--------------------------------------------------------------------------
  # ○ メモの内容からハッシュを作成
  #--------------------------------------------------------------------------
  def note_data_hash(note, key, data_default = nil, default = {}, ret = {})
    list = note_data_split(note, key)
    return default if list.empty?
    list.each {|data| ret[data[0]] = data[1] ? data[1] : data_default }
    return ret
  end
  #--------------------------------------------------------------------------
  # ○ メモの内容からカンマ区切りの多元配列を取得
  #--------------------------------------------------------------------------
  def note_data_split(note, key, default = [], ret = [])
    data = note_data(note, key)
    return default unless data.is_a?(Array)
    data.each {|str| ret.push(convert_integer_from_array(split_array(str)))}
    return ret
  end
  #--------------------------------------------------------------------------
  # ○ 配列の内容から数値があれば変換
  #--------------------------------------------------------------------------
  def convert_integer_from_array(data, ret = [])
    data.each {|str| ret.push(convert_integer(str))}
    return ret
  end
  #--------------------------------------------------------------------------
  # ○ 数値があれば変換
  #--------------------------------------------------------------------------
  def convert_integer(str)
    return $1.to_i if str =~ /(^[-]?[0-9]+$)/
    str.is_a?(Array) ? convert_integer_from_array(str) : str
  end
  #--------------------------------------------------------------------------
  # ○ メモの内容から単項目の数値を取得
  #--------------------------------------------------------------------------
  def note_data_one_value(note, key, default)
    data = note_data(note, key)
    return data[0].to_i if data.is_a?(Array)
    return default
  end
  #--------------------------------------------------------------------------
  # ○ メモの内容から単項目を取得
  #--------------------------------------------------------------------------
  def note_data_one(note, key, default)
    data = note_data(note, key)
    return data[0] if data.is_a?(Array)
    return default
  end
  #--------------------------------------------------------------------------
  # ○ メモの内容からカンマ区切りの文字列を取得
  #--------------------------------------------------------------------------
  def note_data_array_str(note, key, default)
    data = note_data(note, key)
    return data[0].split(",") if data.is_a?(Array)
    return default
  end
  #--------------------------------------------------------------------------
  # ○ メモの内容からカンマ区切りの数値を取得
  #--------------------------------------------------------------------------
  def note_data_array_value(note, key, default)
    data = note_data(note, key)
    return default unless data.is_a?(Array)
    return convert_integer_from_array(split_array(data[0]))
  end
  #--------------------------------------------------------------------------
  # ○ カンマ区切りの文字列メモを変換
  #--------------------------------------------------------------------------
  def note_data_array(note, key, type, default = nil, through = true)
    ret = []
    default.each {|dat| ret.push(dat)} if default != nil
   
    data = note_data(note, key)
    return ret unless data.is_a?(Array)
   
    data = data[0].split(",")
    for d in data
      next if ret.include?(d) if through
      ret.push(d.to_i) if type.is_a?(Integer)
      ret.push(d)      if type.is_a?(String)
    end
    return ret
  end
  #--------------------------------------------------------------------------
  # ○ ディレクトリの作成
  #--------------------------------------------------------------------------
  def make_directory(dir_name)
    Dir::mkdir(dir_name) unless FileTest.exist?(dir_name)
  end
  #--------------------------------------------------------------------------
  # ○ コマンドリスト
  #--------------------------------------------------------------------------
  def make_command(command, src = "", dect = "")
    src.gsub!("/","\\")
    dect.gsub!("/","\\")
    cmd = "#{command} \"#{src}\" \"#{dect}\""
    return cmd
  end
  #--------------------------------------------------------------------------
  # ○ 素材の拡張子を取得
  #--------------------------------------------------------------------------
  def material_ext(directory, file, direct = false)
    exts = []
    exts = [".png",".bmp",".jpg"]               if directory =~ /(.*)Graphics\/(.*)/
    exts = [".mid",".ogg",".wav",".mp3",".wma"] if directory =~ /(.*)Audio(.*)/
   
    find_file = sprintf("%s%s", directory, file) unless direct
    find_file = file if direct
   
    for ext in exts
      return ext if File.exist?(sprintf("%s%s", find_file, ext))
    end
    return nil
  end
  #--------------------------------------------------------------------------
  # ○ 素材が存在するかチェック
  #--------------------------------------------------------------------------
  def material_exist?(directory, file, direct = false)
    return false if material_ext(directory, file, direct) == nil
    return true
  end
  #--------------------------------------------------------------------------
  # ○ ファイルコピー
  #--------------------------------------------------------------------------
  def copy_file(src, dest)
    srcFile = File.open( src, "rb" )
    dstFile = File.open( dest, "wb" )
    dstFile.write( srcFile.read )
    srcFile.close
    dstFile.close
  end
  #--------------------------------------------------------------------------
  # ○ ファイルの存在を確認してファイルコピー
  #--------------------------------------------------------------------------
  def material_copy(src, dest, directory)
    ext = material_ext(directory, src, true)
    copy_file( src + ext, dest + ext ) if ext != nil
  end
  #--------------------------------------------------------------------------
  # ○ 配列からAudioを作成
  #--------------------------------------------------------------------------
  def set_audio(sound, kind)
    case kind
    when "BGM"; audio = RPG::BGM.new
    when "BGS"; audio = RPG::BGS.new
    when "ME";  audio = RPG::ME.new
    when "SE";  audio = RPG::SE.new
    end
    audio.name   = sound[0]
    audio.volume = sound[1]
    audio.pitch  = sound[2]
    return audio
  end
  #--------------------------------------------------------------------------
  # ○ 既に準拠識別子を持っているかチェック
  #--------------------------------------------------------------------------
  def chk_rtp(file_name, default)
    return "" if file_name =~ /^VX_.*/
    return "" if file_name =~ /^XP_.*/
    return "" if file_name =~ /^2000_.*/
    return "" if file_name =~ /^2003_.*/
    return default
  end
  #--------------------------------------------------------------------------
  # ○ 先頭の $ を切り出す
  #--------------------------------------------------------------------------
  def one_character(file_name)
    return file_name unless file_name[0] == "$"
    tmp = file_name.clone
    tmp[0] = ""
    return tmp
  end
  #--------------------------------------------------------------------------
  # ○ 配列を入れ替える
  #--------------------------------------------------------------------------
  def change_array(array, index1, index2)
    tmp = array[index1]
    array[index1] = array[index2]
    array[index2] = tmp
    return array
  end
  #--------------------------------------------------------------------------
  # ○ 移動ルートの作成
  #--------------------------------------------------------------------------
  def create_move_route(repeat, skippable, wait, list)
    move_route = RPG::MoveRoute.new
    move_route.repeat    = repeat
    move_route.skippable = skippable
    move_route.wait      = wait
    move_route.list      = list
    return move_route
  end
  #--------------------------------------------------------------------------
  # ○ 移動ルートコマンドの作成
  #--------------------------------------------------------------------------
  def create_move_command(code, parameters)
    list = RPG::MoveCommand.new
    list.code       = code
    list.parameters = parameters
    return list
  end
  #--------------------------------------------------------------------------
  # ○ インタプリタ起動用リストの作成
  #--------------------------------------------------------------------------
  def create_list(code, indent, parameters)
    list            = RPG::EventCommand.new
    list.code       = code
    list.indent     = indent
    list.parameters = parameters
    return list
  end
  #--------------------------------------------------------------------------
  # ○ クラス名の取得
  #--------------------------------------------------------------------------
  def class_name(class_instance)
    return class_instance.to_s.split(":")[0].gsub("#<","")
  end
  #--------------------------------------------------------------------------
  # ○ 配列を考慮したsplit
  #--------------------------------------------------------------------------
  def split_array(str)
    str = convert_escape_characters(str)
   
    ret       = []
    tmp_array = str.split(",")
   
    return strip_array_str(tmp_array) unless str.include?("[")
    tmp_str   = ""
    tmp_array.each {|s|
      if char_in_str(s, "[", "]") && tmp_str.empty?
        ret.push(s) unless s =~ /^\[/
        ret.push([s[1...s.size-1]]) if s =~ /^\[/
      else
        tmp_str = "#{tmp_str}#{s},"
        if char_in_str(tmp_str, "[", "]")
          unless tmp_str =~ /^\[/
            ret.push(tmp_str[0...tmp_str.size-1])
            tmp_str = ""
          else
            tmp_str = tmp_str[1...tmp_str.size-2]
            tmp_str = split_array(tmp_str) if tmp_str.include?("[")
            tmp_str = tmp_str.split(",") if tmp_str.include?(",")
            ret.push(tmp_str)   if tmp_str.is_a?(Array)
            ret.push([tmp_str]) if !tmp_str.is_a?(Array)
            tmp_str = ""
          end
        end
      end
    }
    return strip_array_str(ret)
  end
  #--------------------------------------------------------------------------
  # ○ 配列の中の文字列の先頭と末尾の空白を除去
  #--------------------------------------------------------------------------
  def strip_array_str(array, ret = [])
    array.each {|str| ret.push(strip_array_str(str)) if str.is_a?(Array); next if str.is_a?(Array); ret.push(str.strip) }
    return ret
  end
  #--------------------------------------------------------------------------
  # ○ 文字列の中に文字が何文字含まれているか調べて同数ならtrueを返す
  #--------------------------------------------------------------------------
  def char_in_str(str, c1, c2)
    num1 = 0
    num2 = 0
    (0...str.size).each {|i| num1 += 1 if str == c1; num2 += 1 if str == c2 }
    return num1 == num2
  end
  #--------------------------------------------------------------------------
  # ○ 制御文字の変換
  #--------------------------------------------------------------------------
  def convert_escape_characters(text)
    result = text.to_s.clone
    result.gsub!(/\\/)                           { "\e" }
    result.gsub!(/\e\e/)                         { "\\" }
    result.gsub!(/\eV\[(\d+)\]/i)                { $game_variables[$1.to_i] }
    result.gsub!(/\eV\[(\d+)\]/i)                { $game_variables[$1.to_i] }
    result.gsub!(/\eN\[(\d+)\]/i)                { actor_name($1.to_i) }
    result.gsub!(/\eP\[(\d+)\]/i)                { party_member_name($1.to_i) }
    result.gsub!(/\eG/i)                         { Vocab::currency_unit }
    loop { result = result.sub(/<s>(.+?)<\/s>/i) { eval($1) }; break unless $1 }
    result
  end
  #--------------------------------------------------------------------------
  # ○ アクター n 番の名前を取得
  #--------------------------------------------------------------------------
  def actor_name(n)
    actor = n >= 1 ? $game_actors[n] : nil
    actor ? actor.name : ""
  end
  #--------------------------------------------------------------------------
  # ○ パーティメンバー n 番の名前を取得
  #--------------------------------------------------------------------------
  def party_member_name(n)
    actor = n >= 1 ? $game_party.members[n - 1] : nil
    actor ? actor.name : ""
  end
  #--------------------------------------------------------------------------
  # ○ 配列を全て整数にする
  #--------------------------------------------------------------------------
  def params_to_i(params)
    ret = []
    params.each {|param| ret.push(param.to_i)}
    return ret
  end
  #--------------------------------------------------------------------------
  # ○ 注釈コマンド定義
  #--------------------------------------------------------------------------
  def define_command
    @cmd_108 = {}
  end
  #--------------------------------------------------------------------------
  # ○ 注釈コマンド定義取得
  #--------------------------------------------------------------------------
  def cmd_108
    @cmd_108
  end
  #--------------------------------------------------------------------------
  # ○ フレーム更新
  #--------------------------------------------------------------------------
  def update
  end
  #--------------------------------------------------------------------------
  # ○ 文字の幅と高さを取得
  #--------------------------------------------------------------------------
  def text_size(font, size, text)
    bitmap = Cache.system("")
    bitmap.font.name = font
    bitmap.font.size = size
    tw = bitmap.text_size(text).width
    th = bitmap.text_size(text).height
    bitmap.dispose
    return [tw, th]
  end
  #--------------------------------------------------------------------------
  # ○ 文字の幅を取得
  #--------------------------------------------------------------------------
  def text_width(font, text)
    texts = text.split("\n")
    @max_width = 0
    texts.each {|text|
      width = text_size(font.name, font.size, text)[0]
      @max_width = @max_width < width ? width : @max_width
    }
    return @max_width
  end
end
#==============================================================================
# ◆ RGSS3用処理
#==============================================================================
if rgss_version == 3
#==============================================================================
# ■ RPG::Tileset
#==============================================================================

class RPG::Tileset
  #--------------------------------------------------------------------------
  # ○ 拡張通行判定
  #--------------------------------------------------------------------------
  def ex_flags
    @ex_flags ||= Table.new(8192)
    return @ex_flags
  end
  #--------------------------------------------------------------------------
  # ○ 拡張通行判定初期化
  #--------------------------------------------------------------------------
  def init_ex_flags
    @ex_flags = Table.new(8192)
  end
end
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
#  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
# Game_Troop クラス、Game_Event クラスの内部で使用されます。
#==============================================================================

class Game_Interpreter
  #--------------------------------------------------------------------------
  # ☆ オブジェクト初期化
  #     depth : ネストの深さ
  #--------------------------------------------------------------------------
  alias a1_common_gi_rgss3_initialize initialize
  def initialize(depth = 0, sub_interpreter = false)
    @sub_interpreter = sub_interpreter
    a1_common_gi_rgss3_initialize(depth)
  end
  #--------------------------------------------------------------------------
  # ☆ メッセージ表示がビジー状態の間ウェイト
  #--------------------------------------------------------------------------
  alias a1_common_gi_wait_for_message wait_for_message
  def wait_for_message
    return if @sub_interpreter
    a1_common_gi_wait_for_message
  end
end
#==============================================================================
# ■ Window_Message
#------------------------------------------------------------------------------
#  文章表示に使うメッセージウィンドウです。
#==============================================================================

class Window_Message < Window_Base
  #--------------------------------------------------------------------------
  # ☆ 通常文字の処理
  #--------------------------------------------------------------------------
  alias a1_common_wm_process_normal_character process_normal_character
  def process_normal_character(c, pos)
    wait_for_one_character_before
    a1_common_wm_process_normal_character(c, pos)
  end
  #--------------------------------------------------------------------------
  # ○ 一文字出力前のウェイト
  #--------------------------------------------------------------------------
  def wait_for_one_character_before
  end
end
#==============================================================================
# ■ RPG::Map
#==============================================================================

class RPG::Map
  #--------------------------------------------------------------------------
  # ○ マップチップを調べるか判定する
  #--------------------------------------------------------------------------
  def search_map_chip?
    return true if $a1_common.note_data(self.note, "マップチップサーチ")
    return false
  end
end
#==============================================================================
# ■ Game_Map
#------------------------------------------------------------------------------
#  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
# このクラスのインスタンスは $game_map で参照されます。
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # ☆ セットアップ
  #--------------------------------------------------------------------------
  alias a1_common_gm_setup setup
  def setup(map_id)
    a1_common_gm_setup(map_id)
    setup_tileset
    map_chip_search if search_map_chip?
  end
  #--------------------------------------------------------------------------
  # ★ タイルセットの取得
  #--------------------------------------------------------------------------
  def tileset
    setup_tileset unless @tileset && @now_tileset_id == @tileset_id
    return @tileset
  end
  #--------------------------------------------------------------------------
  # ○ タイルセットのセットアップ
  #--------------------------------------------------------------------------
  def setup_tileset
    @tileset        = $data_tilesets[@tileset_id].clone
    @tileset.flags  = $data_tilesets[@tileset_id].flags.clone
    @now_tileset_id = @tileset_id
  end
  #--------------------------------------------------------------------------
  # ○ マップチップを調べるか判定する
  #--------------------------------------------------------------------------
  def search_map_chip?
    return @map.search_map_chip?
  end
  #--------------------------------------------------------------------------
  # ○ 指定座標の全レイヤーのフラグ判定(イベント含む)
  #--------------------------------------------------------------------------
  def all_tiles_flag?(x, y, bit)
    all_tiles(x, y).any? {|tile_id| tileset.flags[tile_id] & bit != 0 }
  end
  #--------------------------------------------------------------------------
  # ○ 指定座標の全レイヤーの拡張フラグ判定(イベント含む)
  #--------------------------------------------------------------------------
  def all_tiles_flag_ex?(x, y, bit)
    all_tiles(x, y).any? {|tile_id| tileset.ex_flags[tile_id] & bit != 0 }
  end
  #--------------------------------------------------------------------------
  # ○ 指定座標の全レイヤーの拡張フラグ判定
  #--------------------------------------------------------------------------
  def layered_tiles_flag_ex?(x, y, bit)
    layered_tiles(x, y).any? {|tile_id| tileset.ex_flags[tile_id] & bit != 0 }
  end
  #--------------------------------------------------------------------------
  # ○ 地形タグの取得(イベント含む)
  #--------------------------------------------------------------------------
  def terrain_tag_all_tailes(x, y)
    return 0 unless valid?(x, y)
    all_tiles(x, y).each do |tile_id|
      tag = tileset.flags[tile_id] >> 12
      return tag if tag > 0
    end
    return 0
  end
end
#==============================================================================
# ■ DataManager
#------------------------------------------------------------------------------
#  データベースとゲームオブジェクトを管理するモジュールです。ゲームで使用する
# ほぼ全てのグローバル変数はこのモジュールで初期化されます。
#==============================================================================

module DataManager
  #--------------------------------------------------------------------------
  # ○ エイリアス用特異メソッド
  #--------------------------------------------------------------------------
  class << self
    alias :a1_common_create_game_objects :create_game_objects
  end
  #--------------------------------------------------------------------------
  # ☆ 各種ゲームオブジェクトの作成
  #--------------------------------------------------------------------------
  def self.create_game_objects
    $a1_common ||= A1_System::CommonModule.new
    a1_common_create_game_objects
  end
end
#==============================================================================
# ■ Scene_Base
#------------------------------------------------------------------------------
#  ゲーム中の全てのシーンのスーパークラスです。
#==============================================================================

class Scene_Base
  #--------------------------------------------------------------------------
  # ☆ フレーム更新(基本)
  #--------------------------------------------------------------------------
  alias a1_common_sb_update_basic update_basic
  def update_basic
    a1_common_sb_update_basic
    $a1_common.update
  end
  #--------------------------------------------------------------------------
  # ○ 指定のウィンドウが開いている間ウェイト
  #--------------------------------------------------------------------------
  def wait_for_window_open(window)
    update_basic until window.openness == 0
  end
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  ゲーム中の全てのウィンドウのスーパークラスです。
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ★ 制御文字の事前変換
  #    実際の描画を始める前に、原則として文字列に変わるものだけを置き換える。
  #    文字「\」はエスケープ文字(\e)に変換。
  #--------------------------------------------------------------------------
  def convert_escape_characters(text)
    return $a1_common.convert_escape_characters(text)
  end
end
#==============================================================================
# ◆ RGSS2用処理
#==============================================================================
elsif rgss_version == 2
#==============================================================================
# ■ Window
#==============================================================================

class Window
  #--------------------------------------------------------------------------
  # ○ ウィンドウが開いている?
  #--------------------------------------------------------------------------
  def open?
    return self.openness == 255
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウが閉じている?
  #--------------------------------------------------------------------------
  def close?
    return self.openness == 0
  end
end
#==============================================================================
# ■ Cache
#------------------------------------------------------------------------------
#  各種グラフィックを読み込み、Bitmap オブジェクトを作成、保持するモジュール
# です。読み込みの高速化とメモリ節約のため、作成した Bitmap オブジェクトを内部
# のハッシュに保存し、同じビットマップが再度要求されたときに既存のオブジェクト
# を返すようになっています。
#==============================================================================

module Cache
  #--------------------------------------------------------------------------
  # ○ キャッシュ存在チェック
  #--------------------------------------------------------------------------
  def self.include?(key)
    @cache[key] && !@cache[key].disposed?
  end
end
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
#  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
# Game_Troop クラス、Game_Event クラスの内部で使用されます。
#==============================================================================

class Game_Interpreter
  #--------------------------------------------------------------------------
  # ○ 注釈
  #--------------------------------------------------------------------------
  def command_108
    @comments = [@params[0]]
    while next_event_code == 408
      @index += 1
      @comments.push(@list[@index].parameters[0])
    end
  end
  #--------------------------------------------------------------------------
  # ★ イベントコマンドの実行
  #--------------------------------------------------------------------------
  def execute_command
    return rgss3_execute_command unless @index >= @list.size-1
    command_end
    return true
  end
  #--------------------------------------------------------------------------
  # ○ RGSS3風「イベントコマンドの実行」
  #--------------------------------------------------------------------------
  def rgss3_execute_command
    command = @list[@index]
    @params = command.parameters
    @indent = command.indent
    method_name = "command_#{command.code}"
    send(method_name) if respond_to?(method_name)
  end
  #--------------------------------------------------------------------------
  # ○ 次のイベントコマンドのコードを取得
  #--------------------------------------------------------------------------
  def next_event_code
    @list[@index + 1].code
  end
end
#==============================================================================
# ■ Game_Map
#------------------------------------------------------------------------------
#  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
# このクラスのインスタンスは $game_map で参照されます。
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # ○ マップチップを調べるか判定する
  #--------------------------------------------------------------------------
  def search_map_chip?
    return $data_map_infos[@map_id].name =~ /\[サーチ\]/
  end
  #--------------------------------------------------------------------------
  # ○ 指定座標に存在するタイル扱いイベント(すり抜け以外)の配列取得
  #--------------------------------------------------------------------------
  def tile_events_xy(x, y)
    @tile_events.select {|event| event.pos_nt?(x, y) }
  end
  #--------------------------------------------------------------------------
  # ○ タイル扱いイベントの配列をリフレッシュ
  #--------------------------------------------------------------------------
  def refresh_tile_events
    @tile_events = @events.values.select {|event| event.tile? }
  end
end
#==============================================================================
# ■ Game_Character
#------------------------------------------------------------------------------
#  キャラクターを扱うクラスです。このクラスは Game_Player クラスと Game_Event
# クラスのスーパークラスとして使用されます。
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # ○ タイル判定
  #--------------------------------------------------------------------------
  def tile?
    @tile_id > 0 && @priority_type == 0
  end
end
#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
#  タイトル画面の処理を行うクラスです。
#==============================================================================

class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # ☆ データベースのロード
  #--------------------------------------------------------------------------
  alias a1_common_st_load_database load_database
  def load_database
    a1_common_st_load_database
    $data_map_infos = load_data("Data/MapInfos.rvdata")
  end
  #--------------------------------------------------------------------------
  # ☆ 各種ゲームオブジェクトの作成
  #--------------------------------------------------------------------------
  alias a1_common_st_create_game_objects create_game_objects
  def create_game_objects
    $a1_common ||= A1_System::CommonModule.new
    a1_common_st_create_game_objects
  end
end
#==============================================================================
# ◆ RGSS用処理
#==============================================================================
elsif rgss_version == 1
end
#==============================================================================
# ■ Cache
#------------------------------------------------------------------------------
#  各種グラフィックを読み込み、Bitmap オブジェクトを作成、保持するモジュール
# です。読み込みの高速化とメモリ節約のため、作成した Bitmap オブジェクトを内部
# のハッシュに保存し、同じビットマップが再度要求されたときに既存のオブジェクト
# を返すようになっています。
#==============================================================================

module Cache
  #--------------------------------------------------------------------------
  # ○ 拡大縮小したビットマップのロード
  #--------------------------------------------------------------------------
  def self.load_resize_bitmap(load_path, key, resize = nil)
    @cache ||= {}
    key = load_path if key == nil
    return @cache[key] if include?(key)
   
    @cache[key] = Bitmap.new(load_path)
    return @cache[key] if resize == nil
    return @cache[key] if @cache[key].width == resize[0] and @cache[key].height == resize[1]
   
    info = calc_size(resize, key)
    return resize_bitmap(@cache[key], info[0], info[1], key)
  end
  #--------------------------------------------------------------------------
  # ○ 拡大縮小した色相変化済みビットマップを作成/取得
  #--------------------------------------------------------------------------
  def self.load_resize_hue_changed_bitmap(load_path, path, hue, resize)
    key = [path, hue]
    return @cache[key] if include?(key)
   
    @cache[key] = load_resize_bitmap(load_path, path, resize).clone
    @cache[key].hue_change(hue)
    return @cache[key]
  end
  #--------------------------------------------------------------------------
  # ○ リサイズするサイズを取得
  #--------------------------------------------------------------------------
  def self.calc_size(resize, key)
    width  = resize[0]
    width  = @cache[key].width * width.abs if width < 0
    height = resize[1]
    height = @cache[key].height * height.abs if height < 0
    height = Integer(@cache[key].height * (width.to_f / @cache[key].width.to_f)) if height == 0
    return [width, height]
  end
  #--------------------------------------------------------------------------
  # ○ ビットマップの拡大縮小
  #--------------------------------------------------------------------------
  def self.resize_bitmap(bitmap, width, height, key)
    resize = Bitmap.new(width, height)
    resize.stretch_blt(resize.rect, bitmap, bitmap.rect)
    @cache[key] = resize
    return resize
  end
  #--------------------------------------------------------------------------
  # ○ テキストビットマップの取得
  #--------------------------------------------------------------------------
  def self.text_picture(text, font)
    load_text_bitmap(text, font)
  end
  #--------------------------------------------------------------------------
  # ○ フォントのキーを作成
  #--------------------------------------------------------------------------
  def self.make_font_key(text, font)
    [text, font.name, font.size, font.bold, font.italic, font.outline, font.shadow, font.color.to_s, font.out_color.to_s]
  end
  #--------------------------------------------------------------------------
  # ○ テキストビットマップの作成
  #--------------------------------------------------------------------------
  def self.load_text_bitmap(text, font)
    @cache ||= {}
    key = make_font_key(text, font)
    return @cache[key] if include?(key)
   
    # 計算用ダミービットマップ
    bitmap = Cache.system("")
    bitmap.font = font
    tw = bitmap.text_size(text).width + 8
   
    # ビットマップ作成
    bitmap = Bitmap.new(tw, bitmap.font.size + 4)
    bitmap.font = font
    bitmap.draw_text(0, 0, bitmap.width, bitmap.height, text, 1)
   
    @cache[key] = bitmap
    return @cache[key]
  end
end
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
#  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
# Game_Troop クラス、Game_Event クラスの内部で使用されます。
#==============================================================================

class Game_Interpreter
  #--------------------------------------------------------------------------
  # ○ 注釈
  #--------------------------------------------------------------------------
  alias a1_common_command_108 command_108
  def command_108
    a1_common_command_108
    proc_comment(@comments)
  end
  #--------------------------------------------------------------------------
  # ○ 注釈の処理
  #--------------------------------------------------------------------------
  def proc_comment(comments)
    param = ""
    comments.each {|comment| param += comment }
    params = param.sub(/^(\S+)/, "")
    command = $1
    comment_parameters = $a1_common.split_array(params) if params
    proc_comment_command(command, comment_parameters)
  end
  #--------------------------------------------------------------------------
  # ○ 注釈の実行
  #--------------------------------------------------------------------------
  def proc_comment_command(command, params)
    cmd_108 = $a1_common.cmd_108[command]
    method(cmd_108).call(params) if cmd_108 != nil
  end
  #--------------------------------------------------------------------------
  # ○ 前のイベントコマンドを取得
  #--------------------------------------------------------------------------
  def prev_event
    @list[@index - 1]
  end
end
#==============================================================================
# ■ Game_Map
#------------------------------------------------------------------------------
#  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
# このクラスのインスタンスは $game_map で参照されます。
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # ○ 全マップチップを調べる
  #--------------------------------------------------------------------------
  def map_chip_search
    tileset.init_ex_flags
    (0...@map.data.xsize).each {|x| map_chip_search_y(x) }
  end
  #--------------------------------------------------------------------------
  # ○ x座標にあるy座標のマップチップを調べる
  #--------------------------------------------------------------------------
  def map_chip_search_y(x)
    (0...@map.data.ysize).each {|y| map_pos_proc(x, y); map_chip_search_z(x, y) }
  end
  #--------------------------------------------------------------------------
  # ○ x,y座標にあるz座標のマップチップを調べる
  #--------------------------------------------------------------------------
  def map_chip_search_z(x, y)
    (0...@map.data.zsize).each {|z| map_chip_proc(x, y, z) }
    tile_events_xy(x, y).collect {|ev| tile_event_proc(ev.tile_id) }
  end
  #--------------------------------------------------------------------------
  # ○ 座標に対して処理を行う
  #--------------------------------------------------------------------------
  def map_pos_proc(x, y)
  end
  #--------------------------------------------------------------------------
  # ○ マップチップに対して処理を行う
  #--------------------------------------------------------------------------
  def map_chip_proc(x, y, z)
  end
  #--------------------------------------------------------------------------
  # ○ タイルのイベントに対して処理を行う
  #--------------------------------------------------------------------------
  def tile_event_proc(tile_id)
  end
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  ゲーム中の全てのウィンドウのスーパークラスです。
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ○ 入力を受け付けるか?
  #--------------------------------------------------------------------------
  def can_input?
    @can_input
  end
  #--------------------------------------------------------------------------
  # ○ 入力受け付け設定
  #--------------------------------------------------------------------------
  def can_input=(flag)
    @can_input = flag
  end
end
#==============================================================================
# ■ Bitmap
#==============================================================================

class Bitmap
  #--------------------------------------------------------------------------
  # ○ 文字縁取り描画
  #--------------------------------------------------------------------------
  def draw_text_f(x, y, width, height, str, align = 0, color = Color.new(64,32,128))
    shadow = self.font.shadow
    b_color = self.font.color.dup
    font.shadow = false
    font.color = color
    draw_text(x + 1, y, width, height, str, align)
    draw_text(x - 1, y, width, height, str, align)
    draw_text(x, y + 1, width, height, str, align)
    draw_text(x, y - 1, width, height, str, align)
    font.color = b_color
    draw_text(x, y, width, height, str, align)
    font.shadow = shadow
  end
  #--------------------------------------------------------------------------
  # ○ 文字縁取り描画の矩形を取得
  #--------------------------------------------------------------------------
  def draw_text_f_rect(r, str, align = 0, color = Color.new(64,32,128))
    draw_text_f(r.x, r.y, r.width, r.height, str, align = 0, color)
  end
end[/pre]


回复

使用道具 举报

梦石
0
星屑
5241
在线时间
760 小时
注册时间
2009-1-21
回帖
236
 楼主| 发表于 2012-7-14 18:17:05 | 显示全部楼层
wix3000 发表于 2012-7-14 16:26
他說的是他那份腳本的使用方法

不過你這份腳本的使用方法也寫得好像不是很清楚

所以說

イベント吹き出し event_id 5

這個 是 指定事件 與用 這個對話框


那下面的

[pre lang="ruby" line="1"]吹き出し使用 on|off
#
#       吹き出しの使用を切り替えます
#       on で吹き出し使用、off で吹き出し使用しなくなります
#
#
#   メッセージウィンドウコマンド
#
#     \CC[count] :クローズカウントを設定します(フレーム数)
#                  設定項目のデフォルト値より優先されます
#
#     \KP        :吹き出しのヒレが「考え中」になります
#
#     \PR        :並列吹き出し状態として表示した吹き出しの
#                  並列吹き出し状態をメッセージ終了後に解除します
#
#                  解除された場合、他の吹き出しと同時に閉じるようになります[/pre]

該怎麼用呢?!
我在對話框內  打上
\KP  之類的  他會出錯
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部