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

Project1

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

如何能自动连续对话而不用按回车键?

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
2 小时
注册时间
2008-4-30
帖子
266
跳转到指定楼层
1
发表于 2008-6-1 19:03:25 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

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

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

x
各位:

  我想在游戏里设置自动对话功能,即不用按任何键 角色间对话也能“你一句我一句”地自动继续,直至所有对话终结。  怎样能做到啊?

最好能给个实例
谢谢
此贴于 2008-6-6 0:27:53 被版主darkten提醒,请楼主看到后对本贴做出回应。
此贴于 2008-6-8 2:05:44 被版主darkten提醒,请楼主看到后对本贴做出回应。

Lv1.梦旅人

梦石
0
星屑
50
在线时间
2 小时
注册时间
2008-4-30
帖子
266
4
 楼主| 发表于 2008-6-1 20:07:01 | 只看该作者
二位楼上的方法我试了  不好用啊   脚本加进去后   输入符号只显示符号 不自动啊


谢谢  请再指教
版主对此帖的评论:『...我明明是在黑暗圣剑传说里面提取的,肯定不会有问题,你可能2个脚本一起用了吧。。』,积分『-0』。这些被扣积分的一半会用于对本帖正确答案的悬赏。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
27 小时
注册时间
2008-2-13
帖子
1740
3
发表于 2008-6-1 19:11:56 | 只看该作者
  1. # ----------------------------
  2. class Window_Message < Window_Selectable
  3. #\a[n] : n桢自动关闭

  4. #\b:  路标

  5. #\c[n] 8种颜色,\d or \c[0]还原

  6. #\d: 还原字体大小颜色高度成默认

  7. #\f[n] : 使用第n种字体

  8. #\g : 显示金钱

  9. #\h[n] : 改变字高度, \d or \h[32] 还原

  10. #\i[n] : Shows the icon and item name of the item with ID n
  11. #\j[n] : Puts n pixels of whitespace at the current position within the message. Useful if you want precise spacing rather than relying on the font's space length.
  12. #\k[n] : Shows the icon and skill name of the skill with ID n.
  13. #\w[n] : Shows the icon and weapon name of the weapon with ID n.
  14. #\m[n] : Shows the icon and armor name of the armor with ID n.

  15. #\n[n] : Shows the name of the hero with ID n.
  16. #\o[n] : The alpha of the window text is n for this message.
  17. #\r: Right-justifies the text on this line. Must be the first thing in the line.

  18. #\s[n] : 改变字体大小!

  19. #\v[n] : 显示变量n的值

  20. #\x: 中心对齐

  21. #\\ : Prints the "\" character.
  22.   
  23.   
  24.   
  25.   
  26.   
  27.   
  28.   
  29.   
  30.   
  31.   
  32.   
  33.   
  34.   
  35.   
  36.   attr_accessor :autoclosetime
  37.   attr_accessor :op
  38. # ----------------------------
  39.   def initialize
  40.     super(80, 304, 480, 160)
  41.     self.contents = Bitmap.new(width - 32, height - 32)
  42.     self.visible = false
  43.     self.z = 9998
  44.     @fade_in = false
  45.     @fade_out = false
  46.     @contents_showing = false
  47.     @cursor_width = 0
  48.     @autoclosetime = -1
  49.     @op = 255
  50.     @refreshflag = false
  51.     self.active = false
  52.     self.index = -1
  53.   end
  54. # ----------------------------
  55.   def dispose
  56.     terminate_message
  57.     $game_temp.message_window_showing = false
  58.     if @input_number_window != nil
  59.       @input_number_window.dispose
  60.     end
  61.     super
  62.   end
  63. # ----------------------------
  64.   def terminate_message
  65.     self.active = false
  66.     self.pause = false
  67.     self.index = -1
  68.     self.contents.clear
  69.     @contents_showing = false
  70.     if $game_temp.message_proc != nil
  71.       $game_temp.message_proc.call
  72.     end
  73.     $game_temp.message_text = nil
  74.     $game_temp.message_proc = nil
  75.     $game_temp.choice_start = 99
  76.     $game_temp.choice_max = 0
  77.     $game_temp.choice_cancel_type = 0
  78.     $game_temp.choice_proc = nil
  79.     $game_temp.num_input_start = 99
  80.     $game_temp.num_input_variable_id = 0
  81.     $game_temp.num_input_digits_max = 0
  82.     if @gold_window != nil
  83.       @gold_window.dispose
  84.       @gold_window = nil
  85.     end
  86.   end
  87. # ----------------------------
  88.   def refresh
  89.     self.contents.clear
  90.     self.contents.font.color = normal_color
  91.     self.contents.font.name = "黑体"
  92.     self.contents.font.size = 18
  93.     x = y = 0
  94.     @cursor_width = 0
  95.     @autoclosetime = -1
  96.     @refreshflag = true
  97.     lineheight = 32
  98.     active = ""
  99.     a = ""
  100.     centerflag = false
  101.     rightflag = false
  102.     bannerflag = false
  103.     if $game_temp.choice_start == 0
  104.       x = 8
  105.     end
  106.     if $game_temp.message_text != nil
  107.       text = $game_temp.message_text
  108.       begin
  109.       last_text = text.clone
  110.       text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  111.       end until text == last_text
  112.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  113.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  114.       end
  115.       text.gsub!(/\\\\/) { "\000" }
  116.       text.gsub!(/\\[Cc]\[([0123456789ABCDEFx]+)\]/) { "\001[#{$1}]" }
  117.       text.gsub!(/\\[Gg]/) { "\002" }
  118.       text.gsub!(/\\[Ii]\[([0-9]+)\]/) { "\003[#{$1}]" }
  119.       text.gsub!(/\\[Ff]\[([0-9]+)\]/) { "\004[#{$1}]" }
  120.       text.gsub!(/\\[Aa]\[([0-9]+)\]/) { "\005[#{$1}]" }
  121.       text.gsub!(/\\[Xx]/) { "\006" }
  122.       text.gsub!(/\\[Rr]/) { "\007" }
  123.       text.gsub!(/\\[Dd]/) { "\011" }
  124.       text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\023[#{$1}]" }
  125.       text.gsub!(/\\[Bb]/) { "\017" }
  126.       text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "\014[#{$1}]" }
  127.       text.gsub!(/\\[Mm]\[([0-9]+)\]/) { "\015[#{$1}]" }
  128.       text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\016[#{$1}]" }
  129.       text.gsub!(/\\[Jj]\[([0-9]+)\]/) { "\013[#{$1}]" }
  130.       text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\021[#{$1}]" }
  131.       text.gsub!(/\\[Kk]\[([0-9]+)\]/) { "\022[#{$1}]" }
  132.       while ((c = text.slice!(/./m)) != nil)
  133.         if c == "\000"
  134.           c = "\\"
  135.         end
  136.         if c == "\001"
  137.           text.sub!(/\[([0123456789ABCDEFx]+)\]/, "")
  138.           temp_color = $1
  139.           color = temp_color.to_i
  140.           leading_x = temp_color.to_s.slice!(/./m)
  141.           if leading_x == "x"
  142.             self.contents.font.color = hex_color(temp_color)
  143.             next
  144.           end
  145.           if color >= 0 and color <= 7
  146.             self.contents.font.color = text_color(color)
  147.           end
  148.           next
  149.         end

  150.         if c == "\002"
  151.           if @gold_window == nil
  152.             @gold_window = Window_Change.new
  153.             @gold_window.x = 330  
  154.             @gold_window.y = 40
  155.             @gold_window.opacity = self.opacity
  156.             @gold_window.back_opacity = self.back_opacity
  157.           end
  158.           next
  159.         end
  160.           if c == "\003"
  161.           text.sub!(/\[([0-9]+)\]/, "")
  162.           item_sub = $1.to_i
  163.           c = $data_items[item_sub].name
  164.           l = self.contents.text_size(c).width
  165.           draw_item_name($data_items[item_sub], x, y * 32 + 1)
  166.           x = x + l + 24
  167.           next
  168.         end
  169.          if c == "\004"
  170.           text.sub!(/\[([0-9]+)\]/, "")
  171.           fontize = $1.to_i
  172.           case fontize
  173.             when 1
  174.               self.contents.font.name = "黑体"
  175.             when 2
  176.               self.contents.font.name = "宋体"
  177.             when 3
  178.               self.contents.font.name = "宋体"
  179.             when 4
  180.               self.contents.font.name = "楷体_GB2312"
  181.           end
  182.           next
  183.         end
  184.          if c == "\005"
  185.           text.sub!(/\[([0-9]+)\]/, "")
  186.           @autoclosetime = $1.to_i
  187.           next
  188.         end
  189.         if c == "\006"
  190.           centerflag = true
  191.           next
  192.         end
  193.         if c == "\007"
  194.           rightflag = true
  195.           next
  196.         end
  197.         if c == "\011"
  198.           self.contents.font.name = "黑体"
  199.           self.contents.font.size = 18
  200.           self.contents.font.color = normal_color
  201.           lineheight = 32
  202.           next
  203.         end
  204.         if c == "\014"
  205.           text.sub!(/\[([0-9]+)\]/, "")
  206.           w_sub = $1.to_i
  207.           c = $data_weapons[w_sub].name
  208.           l = self.contents.text_size(c).width
  209.           bitmap = RPG::Cache.icon($data_weapons[w_sub].icon_name)
  210.           self.contents.blt(x+4, y * 32+ 4, bitmap, Rect.new(0, 0, 24, 24))
  211.           x += 28
  212.          
  213.           if $showing_main_message==1
  214.             self.contents.font.color = outline_color
  215.               self.contents.draw_text(4 + x-1+2, 32 * y+2, 40, 32, c)
  216.               self.contents.draw_text(4 + x+1+2, 32 * y+2, 40, 32, c)
  217.               self.contents.draw_text(4 + x+2, 32 * y+1+2, 40, 32, c)
  218.               self.contents.draw_text(4 + x+2, 32 * y-1+2, 40, 32, c)
  219.               #self.contents.draw_text(4 + x-1, 30 * y-1, 40, 32, c)
  220.               #self.contents.draw_text(4 + x-1, 30 * y+1, 40, 32, c)
  221.               #self.contents.draw_text(4 + x+1, 30 * y+1, 40, 32, c)
  222.               #self.contents.draw_text(4 + x+1, 30 * y-1, 40, 32, c)
  223.             self.contents.font.color = normal_color
  224.             self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
  225.           else
  226.             self.contents.draw_text(x+4, 32 * y, l+32, lineheight, c)
  227.           end
  228.           x = x + l
  229.           next
  230.         end
  231.           if c == "\015"
  232.           text.sub!(/\[([0-9]+)\]/, "")
  233.           a_sub = $1.to_i
  234.           c = $data_armors[a_sub].name
  235.           l = self.contents.text_size(c).width
  236.           bitmap = RPG::Cache.icon($data_armors[a_sub].icon_name)
  237.           self.contents.blt(x+4, y * 32+ 4, bitmap, Rect.new(0, 0, 24, 24))
  238.           x += 28         
  239.           self.contents.draw_text(x+4, 32 * y, l+32, lineheight, c)
  240.           x = x + l
  241.           next
  242.         end
  243.           if c == "\016"
  244.           text.sub!(/\[([0-9]+)\]/, "")
  245.           @op = $1.to_i
  246.           next
  247.         end
  248.          if c == "\017"
  249.           bannerflag = true
  250.           next
  251.         end
  252.         if c == "\018"
  253.           text.sub!(/\[([0-9]+)\]/, "")
  254.           jump = $1.to_i       
  255.           x += jump
  256.           next
  257.         end
  258.           if c == "\021"
  259.           text.sub!(/\[([0-9]+)\]/, "")
  260.           lineheight = $1.to_i
  261.           next
  262.         end
  263.         if c == "\022"
  264.           text.sub!(/\[([0-9]+)\]/, "")
  265.           skill_sub = $1.to_i
  266.           c = $data_skills[skill_sub].name
  267.           l = self.contents.text_size(c).width
  268.           bitmap = RPG::Cache.icon($data_skills[skill_sub].icon_name)
  269.           self.contents.blt(x+4, y * 32+ 4, bitmap, Rect.new(0, 0, 24, 24))
  270.           x += 28
  271.          
  272.             if $showing_main_message==1
  273.               self.contents.font.color = outline_color
  274.               self.contents.draw_text(4 + x-1+2, 32 * y+2, 40, 32, c)
  275.               self.contents.draw_text(4 + x+1+2, 32 * y+2, 40, 32, c)
  276.               self.contents.draw_text(4 + x+2, 32 * y+1+2, 40, 32, c)
  277.               self.contents.draw_text(4 + x+2, 32 * y-1+2, 40, 32, c)
  278.               #self.contents.draw_text(4 + x-1, 30 * y-1, 40, 32, c)
  279.               #self.contents.draw_text(4 + x-1, 30 * y+1, 40, 32, c)
  280.               #self.contents.draw_text(4 + x+1, 30 * y+1, 40, 32, c)
  281.               #self.contents.draw_text(4 + x+1, 30 * y-1, 40, 32, c)
  282.               self.contents.font.color = normal_color
  283.               self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
  284.             else
  285.               self.contents.draw_text(x+4, 32 * y, l+32, lineheight, c)
  286.             end
  287.           x = x + l
  288.           next
  289.         end
  290.          if c == "\023"
  291.           text.sub!(/\[([0-9]+)\]/, "")
  292.           bigness = $1.to_i
  293.           self.contents.font.size = bigness
  294.           next
  295.         end
  296.         if c == "\n"
  297.           if centerflag == true
  298.             x = 448 - x
  299.             x = x / 2
  300.             
  301.             if $showing_main_message==1
  302.               self.contents.font.color = outline_color
  303.               self.contents.draw_text(4 + x-1+2, 32 * y+2, 40, 32, c)
  304.               self.contents.draw_text(4 + x+1+2, 32 * y+2, 40, 32, c)
  305.               self.contents.draw_text(4 + x+2, 32 * y+1+2, 40, 32, c)
  306.               self.contents.draw_text(4 + x+2, 32 * y-1+2, 40, 32, c)
  307.               self.contents.font.color = normal_color
  308.               self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
  309.             else
  310.               self.contents.draw_text(x, 32 * y, 448-x, lineheight, a)
  311.             end
  312.           end
  313.           if rightflag == true
  314.             x = 448 - x
  315.             
  316.             if $showing_main_message==1
  317.               self.contents.font.color = outline_color
  318.               self.contents.draw_text(4 + x-1+2, 32 * y+2, 40, 32, c)
  319.               self.contents.draw_text(4 + x+1+2, 32 * y+2, 40, 32, c)
  320.               self.contents.draw_text(4 + x+2, 32 * y+1+2, 40, 32, c)
  321.               self.contents.draw_text(4 + x+2, 32 * y-1+2, 40, 32, c)
  322.               self.contents.font.color = normal_color
  323.               self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
  324.             else
  325.               self.contents.draw_text(x, 32 * y, 448-x, lineheight, a)
  326.             end
  327.           end
  328.           if bannerflag == true
  329.             x = 448 - x
  330.             x = x / 2
  331.             
  332.             if $showing_main_message==1
  333.               self.contents.font.color = outline_color
  334.               self.contents.draw_text(4 + x-1+2, 32 * y+2, 40, 32, c)
  335.               self.contents.draw_text(4 + x+1+2, 32 * y+2, 40, 32, c)
  336.               self.contents.draw_text(4 + x+2, 32 * y+1+2, 40, 32, c)
  337.               self.contents.draw_text(4 + x+2, 32 * y-1+2, 40, 32, c)
  338.               self.contents.font.color = normal_color
  339.               self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
  340.             else
  341.               self.contents.draw_text(x, 44, 448-x, lineheight, a)
  342.             end
  343.           end
  344.           a = ""
  345.           centerflag = false
  346.           rightflag = false
  347.           bannerflag = false
  348.           if y >= $game_temp.choice_start
  349.             @cursor_width = [@cursor_width, x].max
  350.           end
  351.           y += 1
  352.           x = 0
  353.           if y >= $game_temp.choice_start
  354.             x = 8
  355.           end
  356.           next
  357.         end
  358.         if centerflag == false && rightflag == false && bannerflag == false
  359.          
  360.           if $showing_main_message==1
  361.             if $msg == 400
  362.               #self.contents.font.color = normal_color
  363.               case y
  364.               when 0
  365.                 self.contents.draw_text(4+x,0,40,32,c)
  366.               when 1
  367.                 self.contents.draw_text(4+x+self.contents.font.size*22,0,40,32,c)
  368.               when 2
  369.                 self.contents.draw_text(4+x,32,40,32,c)
  370.               when 3
  371.                 self.contents.draw_text(4+x+self.contents.font.size*22,32,40,32,c)
  372.               end   
  373.             elsif $msg == 401
  374.               #self.contents.font.color = normal_color
  375.               self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
  376.             else              
  377.               self.contents.font.color = outline_color
  378.               self.contents.draw_text(4 + x-1+2, 32 * y+2, 40, 32, c)
  379.               self.contents.draw_text(4 + x+1+2, 32 * y+2, 40, 32, c)
  380.               self.contents.draw_text(4 + x+2, 32 * y+1+2, 40, 32, c)
  381.               self.contents.draw_text(4 + x+2, 32 * y-1+2, 40, 32, c)
  382.               self.contents.font.color = normal_color
  383.               self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
  384.             end
  385.           else
  386.             self.contents.draw_text(4 + x, 32 * y, 40, lineheight, c)
  387.           end
  388.         x += self.contents.text_size(c).width
  389.       else
  390.         a += c
  391.         x += self.contents.text_size(c).width
  392.         end
  393.       end
  394.     end
  395.     if $game_temp.choice_max > 0
  396.       @item_max = $game_temp.choice_max
  397.       self.active = true
  398.       self.index = 0
  399.     end
  400.     if $game_temp.num_input_variable_id > 0
  401.       digits_max = $game_temp.num_input_digits_max
  402.       number = $game_variables[$game_temp.num_input_variable_id]
  403.       @input_number_window = Window_InputNumber.new(digits_max)
  404.       @input_number_window.number = number
  405.       @input_number_window.x = self.x + 8
  406.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  407.     end
  408.   end
  409. # ----------------------------
  410.   def reset_window   
  411.     self.back_opacity = 220
  412.     self.width = 430
  413.     self.height = 160
  414.     if $game_system.message_frame == 0
  415.       self.opacity = 255
  416.     else
  417.       self.opacity = 0
  418.     end   
  419.     if $game_temp.in_battle #比较高的位置,使用到三角,共3行
  420.       case $msg
  421.       when 0
  422.         self.y = 16
  423.         self.height = 128
  424.         self.x =130
  425.         self.width=348
  426.         self.contents = Bitmap.new(width - 32, height - 32)
  427.       when 111 #上、一行,到三角
  428.         self.y = 16
  429.         self.x = 130
  430.         self.width = 348
  431.         self.height = 62
  432.         self.contents = Bitmap.new(width - 32, height - 32)   
  433.       when 121
  434.         self.y = 16
  435.         self.x = 130
  436.         self.width = 348
  437.         self.height = 96
  438.         self.contents = Bitmap.new(width - 32, height - 32)  
  439.       when 131
  440.         self.y = 16
  441.         self.height = 128
  442.         self.x =130
  443.         self.width=348
  444.         self.contents = Bitmap.new(width - 32, height - 32)
  445.       when 141
  446.         self.y = 16
  447.         self.x = 130
  448.         self.width = 348
  449.         self.height = 160
  450.         self.contents = Bitmap.new(width - 32, height - 32)
  451.       end
  452.       
  453.     else
  454.       case $game_system.message_position
  455.       
  456.       when 0  #顶部对话,使用到三角
  457.       self.y = 16
  458.       self.height = 128
  459.       self.x =130
  460.       self.width=348
  461.       self.contents = Bitmap.new(width - 32, height - 32)
  462.         
  463.       when 1  #中等高度对话,使用到三角那里,用完别忘恢复到=2
  464.         self.y = 160
  465.         self.x = 130
  466.         self.width = 348
  467.         self.contents = Bitmap.new(width - 32, height - 32)
  468.                
  469.       when 2  
  470.         case $msg
  471.         when 0  #常规配角对话框,三角文字
  472.         self.y = 304
  473.         self.height = 160
  474.         self.x =130
  475.         self.width=351
  476.         self.contents = Bitmap.new(width - 32, height - 32)
  477.         when 111 #上、一行,到三角
  478.         self.y = 16
  479.         self.x = 130
  480.         self.width = 351
  481.         self.height = 62
  482.         self.contents = Bitmap.new(width - 32, height - 32)   
  483.         when 121
  484.         self.y = 16
  485.         self.x = 130
  486.         self.width = 351
  487.         self.height = 96
  488.         self.contents = Bitmap.new(width - 32, height - 32)   
  489.         when 131
  490.         self.y = 16
  491.         self.x = 130
  492.         self.width = 351
  493.         self.height = 128
  494.         self.contents = Bitmap.new(width - 32, height - 32)   
  495.         when 141
  496.         self.y = 16
  497.         self.x = 130
  498.         self.width = 351
  499.         self.height = 160
  500.         self.contents = Bitmap.new(width - 32, height - 32)
  501.         when 211 #中、一行,到三角
  502.         self.y = 160
  503.         self.x = 130
  504.         self.width = 351
  505.         self.height = 62
  506.         self.contents = Bitmap.new(width - 32, height - 32)   
  507.         when 221
  508.         self.y = 160
  509.         self.x = 130
  510.         self.width = 348
  511.         self.height = 96
  512.         self.contents = Bitmap.new(width - 32, height - 32)   
  513.         when 231
  514.         self.y = 160
  515.         self.x = 130
  516.         self.width = 351
  517.         self.height = 128
  518.         self.contents = Bitmap.new(width - 32, height - 32)   
  519.         when 241
  520.         self.y = 160
  521.         self.x = 130
  522.         self.width = 351
  523.         self.height = 160
  524.         self.contents = Bitmap.new(width - 32, height - 32)
  525.         when 311 #下、一行,到三角
  526.         self.y = 304
  527.         self.x = 130
  528.         self.width = 351
  529.         self.height = 62
  530.         self.contents = Bitmap.new(width - 32, height - 32)   
  531.         when 321
  532.         self.y = 304
  533.         self.x = 130
  534.         self.width = 351
  535.         self.height = 96
  536.         self.contents = Bitmap.new(width - 32, height - 32)   
  537.         when 331
  538.         self.y = 304
  539.         self.x = 130
  540.         self.width = 351
  541.         self.height = 128
  542.         self.contents = Bitmap.new(width - 32, height - 32)   
  543.         when 341
  544.         self.y = 304
  545.         self.x = 130
  546.         self.width = 351
  547.         self.height = 160
  548.         self.contents = Bitmap.new(width - 32, height - 32)
  549.         when 110 #上、一行,全部文字
  550.         self.y = 16
  551.         self.x = 100
  552.         self.width = 432
  553.         self.height = 62
  554.         self.contents = Bitmap.new(width - 32, height - 32)   
  555.         when 120
  556.         self.y = 16
  557.         self.x = 100
  558.         self.width = 432
  559.         self.height = 96
  560.         self.contents = Bitmap.new(width - 32, height - 32)   
  561.         when 130
  562.         self.y = 16
  563.         self.x = 100
  564.         self.width = 432
  565.         self.height = 128
  566.         self.contents = Bitmap.new(width - 32, height - 32)   
  567.         when 140
  568.         self.y = 16
  569.         self.x = 100
  570.         self.width = 432
  571.         self.height = 160
  572.         self.contents = Bitmap.new(width - 32, height - 32)
  573.         when 210 #中、一行,全部文字
  574.         self.y = 160
  575.         self.x = 100
  576.         self.width = 432
  577.         self.height = 62
  578.         self.contents = Bitmap.new(width - 32, height - 32)   
  579.         when 220
  580.         self.y = 160
  581.         self.x = 100
  582.         self.width = 432
  583.         self.height = 96
  584.         self.contents = Bitmap.new(width - 32, height - 32)   
  585.         when 230
  586.         self.y = 160
  587.         self.x = 100
  588.         self.width = 432
  589.         self.height = 128
  590.         self.contents = Bitmap.new(width - 32, height - 32)   
  591.         when 240
  592.         self.y = 160
  593.         self.x = 100
  594.         self.width = 432
  595.         self.height = 160
  596.         self.contents = Bitmap.new(width - 32, height - 32)
  597.         when 310 #下、一行,全部文字
  598.         self.y = 304
  599.         self.x = 130
  600.         self.width = 432
  601.         self.height = 62
  602.         self.contents = Bitmap.new(width - 32, height - 32)   
  603.         when 320
  604.         self.y = 304
  605.         self.x = 100
  606.         self.width = 432
  607.         self.height = 96
  608.         self.contents = Bitmap.new(width - 32, height - 32)   
  609.         when 330
  610.         self.y = 304
  611.         self.x = 100
  612.         self.width = 432
  613.         self.height = 128
  614.         self.contents = Bitmap.new(width - 32, height - 32)   
  615.         when 340
  616.         self.y = 304
  617.         self.x = 100
  618.         self.width = 432
  619.         self.height = 160
  620.         self.contents = Bitmap.new(width - 32, height - 32)
  621.         when 400
  622.           self.y = 390
  623.           self.x = 0
  624.           self.width = 631
  625.           self.height = 120
  626.           self.opacity = 0
  627.           self.contents = Bitmap.new(width - 32, height - 32)  
  628.         when 401
  629.           self.y = 390
  630.           self.x = 110
  631.           self.width = 500
  632.           self.height = 160
  633.           self.opacity = 0
  634.           self.contents = Bitmap.new(width - 32, height - 32)  
  635.         end
  636.       when 3  #中等高度,使用到三角那里,共3行
  637.         self.y = 160
  638.         self.x = 130
  639.         self.width = 348
  640.         self.height = 128
  641.         self.contents = Bitmap.new(width - 32, height - 32)   
  642.         
  643.       when 4  #中等高度,使用到三角那里,共2行
  644.         self.y = 160
  645.         self.x = 130
  646.         self.width = 348
  647.         self.height = 96
  648.         self.contents = Bitmap.new(width - 32, height - 32)   
  649.         
  650.       when 5  #中等高度,使用到三角那里,共1行
  651.         self.y = 160
  652.         self.x = 130
  653.         self.width = 348
  654.         self.height = 62
  655.         self.contents = Bitmap.new(width - 32, height - 32)  
  656.         
  657.       when 1001  #使用对话框1号!
  658.         self.x=175
  659.         self.y=306
  660.         self.width = 440
  661.         self.height = 160
  662.         self.opacity=0
  663.         self.back_opacity=0
  664.         self.contents = Bitmap.new(width - 32, height - 32)
  665.       end
  666.     end
  667.     if $game_switches[55]
  668.       self.x = 100
  669.       self.width = 432
  670.       self.y = 100
  671.       self.height = 288
  672.       self.contents = Bitmap.new(width - 32, height - 32)
  673.     end
  674.   end
  675. # ----------------------------  
  676.   def update
  677.     super
  678.     if @refreshflag && @fade_in == false
  679.       self.contents_opacity = @op
  680.      end
  681.     if @autoclosetime == 0
  682.     @autoclosetime = -1
  683.      terminate_message
  684.    end
  685.     if @autoclosetime >= 1
  686.     @autoclosetime -= 1
  687.     end
  688.     if @fade_in
  689.       self.contents_opacity += 24
  690.       if @input_number_window != nil
  691.         @input_number_window.contents_opacity += 24
  692.       end
  693.       if self.contents_opacity >= @op
  694.         @fade_in = false
  695.       end
  696.       return
  697.     end
  698.     if @input_number_window != nil
  699.       @input_number_window.update
  700.       if Input.trigger?(Input::C)
  701.         $game_system.se_play($data_system.decision_se)
  702.         $game_variables[$game_temp.num_input_variable_id] =
  703.           @input_number_window.number
  704.         $game_map.need_refresh = true
  705.         @input_number_window.dispose
  706.         @input_number_window = nil
  707.         terminate_message
  708.       end
  709.       return
  710.     end
  711.     if @contents_showing
  712.       if $game_temp.choice_max == 0
  713.         self.pause = true
  714.       end
  715.       if Input.trigger?(Input::B)
  716.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  717.           $game_system.se_play($data_system.cancel_se)
  718.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  719.           terminate_message
  720.         end
  721.       end
  722.       if Input.trigger?(Input::C)
  723.         if $game_temp.choice_max > 0
  724.           $game_system.se_play($data_system.decision_se)
  725.           $game_temp.choice_proc.call(self.index)
  726.         end
  727.         @op = 255
  728.         terminate_message
  729.       end
  730.       return
  731.     end
  732.     if @fade_out == false and $game_temp.message_text != nil
  733.       @contents_showing = true
  734.       $game_temp.message_window_showing = true
  735.       reset_window
  736.       refresh
  737.       Graphics.frame_reset
  738.       self.visible = true
  739.       self.contents_opacity = 0
  740.       if @input_number_window != nil
  741.         @input_number_window.contents_opacity = 0
  742.       end
  743.       @fade_in = true
  744.       return
  745.     end
  746.     if self.visible
  747.       @fade_out = true
  748.       self.opacity -= 48
  749.       if self.opacity == 0
  750.         self.visible = false
  751.         @fade_out = false
  752.         $game_temp.message_window_showing = false
  753.       end
  754.       return
  755.     end
  756.   end
  757. # ----------------------------
  758.   def update_cursor_rect
  759.     if @index >= 0
  760.       n = $game_temp.choice_start + @index
  761.       self.cursor_rect.set(8, n * 32, @cursor_width, 32)
  762.     else
  763.       self.cursor_rect.empty
  764.     end
  765.   end
  766. end
复制代码


把脚本插入到Main之前,然后在事件---------显示文章中,在话的末尾输入\a[20]就代表20桢(即1秒)后,转换下次对话,[]之间的数字可以更换
好吧,果然换个签名就没人认识我了。我承认我被时间埋没了
回复 支持 反对

使用道具 举报

Lv2.观梦者

神隐的主犯

梦石
0
星屑
373
在线时间
271 小时
注册时间
2008-2-22
帖子
7691

贵宾

2
发表于 2008-6-1 19:09:38 | 只看该作者
使用脚本;

  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

  4. #——说明

  5. #默认为一个字一个字的方式,如果需要一次全部显示,
  6. #请在游戏中使用脚本:$game_system.typing = true
  7.       
  8. #默认对话字没有声音,如果需要声音,
  9. #请在游戏中使用脚本:$game_system.soundname_on_speak = "这里输入文件名"
  10.   #我唯一一个见过“胡乱配音”的游戏是天使帝国2代,该游戏说话的时候每个字符随机发一个外星语音

  11. # 其他在对话中可以使用的功能:
  12.   
  13. # \n[1]:显示1号角色的姓名

  14. # \name[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名

  15. # \p[1]:对话框出现在1号事件的上方
  16. # \p[0]:主人公上方出现对话框
  17. #——————————————————使用\p功能后可以自动调整对话框大小

  18. # \\:显示"\"这个符号

  19. # \v[1] :显示变量1

  20. # \v[a1] :显示防具1

  21. # \v[w1] :显示武器1

  22. # \v[i1] :显示物品1

  23. # \v[s1] :显示特技1

  24. # \c[1-8]:更改颜色

  25. # \g:显示金钱窗口

  26. # \a[SE文件名]:对话的时候播放SE

  27. # \s[1-19]:更改弹字的速度

  28. # \.   :停顿一刹那(1、2帧)
  29. # \|   :停顿片刻(20帧)

  30. # \>   :文字不用打字方式
  31. # \<   :文字使用打字方式

  32. # \!   :等待玩家按回车再继续
  33. # \~   :文字直接消失

  34. # \I   :下一行从这个位置开始

  35. # \o[123]:文字透明度改为123,模拟将死之人(汗)

  36. # \h[12]:改用12号字

  37. # \b[50]:空50象素

  38. # \K[今天天气不错]:在出现“今天天气不错”这几个字的时候播放$game_system.soundname_on_speak设置的音效

  39. # \L[001]:在左边显示图片“Graphics/半身像/001”
  40. # \R[001]:在右边显示图片“Graphics/半身像/001”

  41. # \Lk:清除左边的图像
  42. # \Rk:清除右边的图像

  43. #==============================================================================
  44. # ■ Game_System
  45. #------------------------------------------------------------------------------
  46. #  处理系统附属数据的类。也可执行诸如 BGM 管理之类的功能。本类的实例请参考
  47. # $game_system 。
  48. #==============================================================================

  49. class Game_System
  50.   attr_accessor :typing
  51.   attr_accessor :soundname_on_speak
  52.   alias carol3_ini initialize
  53.   def initialize
  54.     carol3_ini
  55.     @typing = true
  56.     @soundname_on_speak = nil
  57.   end
  58. end
  59. $加密 = true
  60. #==============================================================================
  61. # ■ Window_Message
  62. #------------------------------------------------------------------------------
  63. class Window_Message < Window_Selectable
  64.   #--------------------------------------------------------------------------
  65.   # ● 初始化状态
  66.   #--------------------------------------------------------------------------
  67.   def initialize
  68.     super(80, 304, 480, 160)
  69.     self.contents = Bitmap.new(width - 32, height - 32)
  70.     self.visible = false
  71.     self.z = 9998
  72.     @fade_in = false
  73.     @fade_out = false
  74.     @contents_showing = false
  75.     @cursor_width = 0
  76.     self.active = false
  77.     self.index = -1
  78.     if $game_system.soundname_on_speak == nil then
  79.       $game_system.soundname_on_speak = ""
  80.     end
  81.     @opacity_text_buf = Bitmap.new(32, 32)
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● 释放
  85.   #--------------------------------------------------------------------------
  86.   def dispose
  87.     terminate_message
  88.     $game_temp.message_window_showing = false
  89.     if @input_number_window != nil
  90.       @input_number_window.dispose
  91.     end
  92.     super
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ● 处理信息结束
  96.   #--------------------------------------------------------------------------
  97.   def terminate_message
  98.     self.active = false
  99.     self.pause = false
  100.     self.index = -1
  101.     self.contents.clear
  102.     # 清除显示中标志
  103.     @contents_showing = false
  104.     # 呼叫信息调用
  105.     if $game_temp.message_proc != nil
  106.       $game_temp.message_proc.call
  107.     end
  108.     # 清除文章、选择项、输入数值的相关变量
  109.     $game_temp.message_text = nil
  110.     $game_temp.message_proc = nil
  111.     $game_temp.choice_start = 99
  112.     $game_temp.choice_max = 0
  113.     $game_temp.choice_cancel_type = 0
  114.     $game_temp.choice_proc = nil
  115.     $game_temp.num_input_start = 99
  116.     $game_temp.num_input_variable_id = 0
  117.     $game_temp.num_input_digits_max = 0
  118.     # 开放金钱窗口
  119.     if @gold_window != nil
  120.       @gold_window.dispose
  121.       @gold_window = nil
  122.     end
  123.     if @name_window_frame != nil
  124.       @name_window_frame.dispose
  125.       @name_window_frame = nil
  126.     end
  127.     if @name_window_text != nil
  128.       @name_window_text.dispose
  129.       @name_window_text = nil
  130.     end
  131.     if @right_picture != nil and @right_keep == true
  132.       @right_picture.dispose
  133.     end   
  134.     if @left_picture != nil and @left_keep == true
  135.       @left_picture.dispose
  136.     end
  137.   end
  138.   def refresh
  139.     # 初期化
  140.     self.contents.clear
  141.     self.contents.font.color = normal_color
  142.     self.contents.font.size = Font.default_size
  143.     @x = @y = @max_x = @max_y = @indent = @lines = 0
  144.     @left_keep = @right_keep = false
  145.     @face_indent = 0
  146.     @opacity = 255
  147.     @cursor_width = 0
  148.     @write_speed = 0
  149.     @write_wait = 0
  150.     @mid_stop = false
  151.     @face_file = nil
  152.     @popchar = -2
  153.     if $game_temp.choice_start == 0
  154.       @x = 8
  155.     end
  156.     if $game_temp.message_text != nil
  157.       @now_text = $game_temp.message_text
  158.       #——头像设置
  159.       if (/\\[Ff]\[(.+?)\]/.match(@now_text))!=nil then
  160.         @face_file = $1 + ".png"
  161.         @x = @face_indent = 128
  162.         if FileTest.exist?("Graphics/pictures/" + $1 + ".png")
  163.           self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  164.         end
  165.         @now_text.gsub!(/\\[Ff]\[(.*?)\]/) { "" }
  166.       end
  167.       #——左半身像设置
  168.       if (/\\[Ll]\[(.+?)\]/.match(@now_text))!=nil then
  169.         @face =  $1
  170.         if $加密 == true
  171.           if @left_picture != nil
  172.             @left_picture.dispose
  173.           end
  174.           @left_picture = Sprite.new
  175.           @left_picture.bitmap = Bitmap.new("Graphics/半身像/#{@face}")
  176.           @left_picture.y = 480-@left_picture.bitmap.height
  177.           @left_picture.x = 0
  178.           @left_picture.mirror = true
  179.           @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  180.         else         
  181.           if FileTest.exist?("Graphics/HEAD/#{@face}")
  182.             if @left_picture != nil
  183.               @left_picture.dispose
  184.             end
  185.             @left_picture = Sprite.new
  186.             @left_picture.bitmap = Bitmap.new("Graphics/半身像/#{@face}")
  187.             @left_picture.y = 480-@left_picture.bitmap.height
  188.             @left_picture.x = 0
  189.             @left_picture.mirror = true
  190.             @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  191.           end
  192.         end        
  193.       end
  194.       #——右半身像设置
  195.       if (/\\[Rr]\[(.+?)\]/.match(@now_text))!=nil then
  196.         @face =  $1
  197.         if $加密 == true
  198.           if @right_picture != nil
  199.             @right_picture.dispose
  200.           end
  201.           @right_picture = Sprite.new
  202.           @right_picture.bitmap = Bitmap.new("Graphics/半身像/#{@face}")
  203.           @right_picture.y = 480-@right_picture.bitmap.height
  204.           @right_picture.x = 640-@right_picture.bitmap.width
  205.           @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  206.         else
  207.           if FileTest.exist?("Graphics/battlers/#{@face}")
  208.             if @right_picture != nil
  209.               @right_picture.dispose
  210.             end
  211.             @right_picture = Sprite.new
  212.             @right_picture.bitmap = Bitmap.new("Graphics/半身像/#{@face}")
  213.             @right_picture.y = 480-@right_picture.bitmap.height
  214.             @right_picture.x = 640-@right_picture.bitmap.width
  215.             @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  216.           end
  217.         end
  218.       end
  219.       if (/\\[Rr]k/.match(@now_text)) != nil
  220.         @right_keep = true
  221.         @now_text.sub!(/\\[Rr]k/) { "" }
  222.       end
  223.       if (/\\[Ll]k/.match(@now_text)) != nil
  224.         @left_keep = true
  225.         @now_text.sub!(/\\[Ll]k/) { "" }
  226.       end
  227.       # 显示人物姓名
  228.       name_window_set = false
  229.       if (/\\[Nn]ame\[(.+?)\]/.match(@now_text)) != nil
  230.         name_window_set = true
  231.         name_text = $1
  232.         @now_text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" }
  233.       end
  234.       
  235.       # 文字位置的判定
  236.       if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
  237.         @popchar = $1.to_i
  238.         if @popchar == -1
  239.           @x = @indent = 48
  240.           @y = 4
  241.         end
  242.         @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  243.       end
  244.       
  245.       # 开始
  246.       begin
  247.         last_text = @now_text.clone
  248.         @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  249.       end until @now_text == last_text
  250.       @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  251.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  252.     end
  253.     @now_text.gsub!(/\\\\/) { "\000" }
  254.     @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  255.     @now_text.gsub!(/\\[Gg]/) { "\002" }
  256.     @now_text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\003[#{$1}]" }
  257.     @now_text.gsub!(/\\[Aa]\[(.*?)\]/) { "\004[#{$1}]" }
  258.     @now_text.gsub!(/\\[.]/) { "\005" }
  259.     @now_text.gsub!(/\\[|]/) { "\006" }

  260.     @now_text.gsub!(/\\[>]/) { "\016" }
  261.     @now_text.gsub!(/\\[<]/) { "\017" }
  262.     @now_text.gsub!(/\\[!]/) { "\020" }
  263.     @now_text.gsub!(/\\[~]/) { "\021" }
  264.    
  265.     @now_text.gsub!(/\\[Ii]/) { "\023" }
  266.     @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  267.     @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  268.     @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  269.     @now_text.gsub!(/\\[Kk]\[(.*?)\]/) { "\027[#{$1}]" }
  270.     if @popchar >= 0
  271.       @text_save = @now_text.clone
  272.       @max_x = 0
  273.       @max_y = 4
  274.       for i in 0..3
  275.         line = @now_text.split(/\n/)[3-i]
  276.         @max_y -= 1 if line == nil and @max_y <= 4-i
  277.         next if line == nil
  278.         cx = contents.text_size(line).width
  279.         @max_x = cx if cx > @max_x
  280.       end
  281.       self.width = @max_x + 48 + @face_indent
  282.       self.height = (@max_y - 1) * 32 + 64
  283.     else
  284.       @max_x = self.width - 32 - @face_indent
  285.     end
  286.     reset_window
  287.       if name_window_set
  288.         off_x = 0
  289.         off_y = -40
  290.         space = 2
  291.         x = self.x + off_x - space / 2
  292.         y = self.y + off_y - space / 2
  293.         w = self.contents.text_size(name_text).width + 26 + space
  294.         h = 40 + space
  295.         @name_window_frame = Window_Frame.new(x, y, w, h)
  296.         @name_window_frame.z = self.z + 1
  297.         x = self.x + off_x + 4
  298.         y = self.y + off_y
  299.         @name_window_text = Air_Text.new(x+4, y+6, name_text)
  300.         @name_window_text.z = self.z + 2
  301.       end
  302.     end
  303.     reset_window
  304.     if $game_temp.choice_max > 0
  305.       @item_max = $game_temp.choice_max
  306.       self.active = true
  307.       self.index = 0
  308.     end
  309.     if $game_temp.num_input_variable_id > 0
  310.       digits_max = $game_temp.num_input_digits_max
  311.       number = $game_variables[$game_temp.num_input_variable_id]
  312.       @input_number_window = Window_InputNumber.new(digits_max)
  313.       @input_number_window.number = number
  314.       @input_number_window.x = self.x + 8
  315.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  316.     end
  317.   end
  318.   #--------------------------------------------------------------------------
  319.   # ● 更新
  320.   #--------------------------------------------------------------------------
  321.   def update
  322.     super
  323.     if @fade_in
  324.       self.contents_opacity += 24
  325.       if @input_number_window != nil
  326.         @input_number_window.contents_opacity += 24
  327.       end
  328.       if self.contents_opacity == 255
  329.         @fade_in = false
  330.       end
  331.       return
  332.     end
  333.     @now_text = nil if @now_text == ""
  334.    
  335.     if @now_text != nil and @mid_stop == false
  336.       if @write_wait > 0
  337.         @write_wait -= 1
  338.         return
  339.       end
  340.       text_not_skip = $game_system.typing
  341.       while true
  342.         @max_x = @x if @max_x < @x
  343.         @max_y = @y if @max_y < @y
  344.         if (c = @now_text.slice!(/./m)) != nil
  345.           if c == "\000"
  346.             c = "\\"
  347.           end
  348.           if c == "\001"
  349.             @now_text.sub!(/\[([0-9]+)\]/, "")
  350.             color = $1.to_i
  351.             if color >= 0 and color <= 7
  352.               self.contents.font.color = text_color(color)
  353.             end
  354.             c = ""
  355.           end
  356.           if c == "\002"
  357.             if @gold_window == nil and @popchar <= 0
  358.               @gold_window = Window_Gold.new
  359.               @gold_window.x = 560 - @gold_window.width
  360.               if $game_temp.in_battle
  361.                 @gold_window.y = 192
  362.               else
  363.                 @gold_window.y = self.y >= 128 ? 32 : 384
  364.               end
  365.               @gold_window.opacity = self.opacity
  366.               @gold_window.back_opacity = self.back_opacity
  367.             end
  368.             c = ""
  369.           end
  370.           if c == "\003"
  371.             @now_text.sub!(/\[([0-9]+)\]/, "")
  372.             speed = $1.to_i
  373.             if speed >= 0 and speed <= 19
  374.               @write_speed = speed
  375.             end
  376.             c = ""
  377.           end
  378.           if c == "\004"
  379.             @now_text.sub!(/\[(.*?)\]/, "")
  380.             buftxt = $1.dup.to_s
  381.             if buftxt.match(/\//) == nil and buftxt != "" then
  382.               $game_system.soundname_on_speak = "Audio/SE/" + buftxt
  383.             else
  384.               $game_system.soundname_on_speak = buftxt.dup
  385.             end
  386.             c = ""
  387.           elsif c == "\004"
  388.             c = ""
  389.           end
  390.           if c == "\005"
  391.             @write_wait += 5
  392.             c = ""
  393.           end
  394.           if c == "\006"
  395.             @write_wait += 80
  396.             c = ""
  397.           end
  398.           if c == "\016"
  399.             text_not_skip = false
  400.             c = ""
  401.           end
  402.           if c == "\017"
  403.             text_not_skip = true
  404.             c = ""
  405.           end
  406.           if c == "\020"
  407.             @mid_stop = true
  408.             c = ""
  409.           end
  410.           if c == "\021"
  411.             terminate_message
  412.             return
  413.           end
  414.           if c == "\023"
  415.             @indent = @x
  416.             c = ""
  417.           end
  418.           if c == "\024"
  419.             @now_text.sub!(/\[([0-9]+)\]/, "")
  420.             @opacity = $1.to_i
  421.             c = ""
  422.           end
  423.           if c == "\025"
  424.             @now_text.sub!(/\[([0-9]+)\]/, "")
  425.             self.contents.font.size = [[$1.to_i, 6].max, 32].min
  426.             c = ""
  427.           end
  428.           if c == "\026"
  429.             @now_text.sub!(/\[([0-9]+)\]/, "")
  430.             @x += $1.to_i
  431.             c = ""
  432.           end
  433.           if c == "\027"
  434.             @now_text.sub!(/\[(.*?)\]/, "")
  435.             @x += ruby_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), $1, @opacity)
  436.             if $game_system.soundname_on_speak != ""
  437.               Audio.se_play($game_system.soundname_on_speak)
  438.             end
  439.             c = ""
  440.           end
  441.           if c == "\030"
  442.             @now_text.sub!(/\[(.*?)\]/, "")
  443.             self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  444.            if $game_system.soundname_on_speak != ""
  445.               Audio.se_play($game_system.soundname_on_speak)
  446.             end
  447.             @x += 24
  448.             c = ""
  449.           end
  450.           if c == "\n"
  451.             if @lines >= $game_temp.choice_start
  452.               @cursor_width = [@cursor_width, @max_x - @face_indent].max
  453.             end
  454.             @lines += 1
  455.             @y += 1
  456.             @x = 0 + @indent + @face_indent
  457.             if @lines >= $game_temp.choice_start
  458.               @x = 8 + @indent + @face_indent
  459.             end
  460.             c = ""
  461.           end
  462.           if c != ""
  463.             # 文字描画
  464.             @x += opacity_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), c, @opacity)
  465.             if $game_system.soundname_on_speak != "" then
  466.             Audio.se_play($game_system.soundname_on_speak)
  467.             end
  468.           end
  469.           if Input.press?(Input::B)
  470.             text_not_skip = false
  471.           end
  472.         else
  473.           text_not_skip = true
  474.           break
  475.         end
  476.         # 終了判定
  477.         if text_not_skip
  478.           break
  479.         end
  480.       end
  481.       @write_wait += @write_speed
  482.       return
  483.     end
  484.     if @input_number_window != nil
  485.       @input_number_window.update
  486.       # 決定
  487.       if Input.trigger?(Input::C)
  488.         $game_system.se_play($data_system.decision_se)
  489.         $game_variables[$game_temp.num_input_variable_id] =
  490.         @input_number_window.number
  491.         $game_map.need_refresh = true
  492.         @input_number_window.dispose
  493.         @input_number_window = nil
  494.         terminate_message
  495.       end
  496.       return
  497.     end
  498.     if @contents_showing
  499.       if $game_temp.choice_max == 0
  500.         self.pause = true
  501.       end
  502.       # 取消
  503.       if Input.trigger?(Input::B)
  504.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  505.           $game_system.se_play($data_system.cancel_se)
  506.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  507.           terminate_message
  508.         end
  509.       end
  510.       # 決定
  511.       if Input.trigger?(Input::C)
  512.         if $game_temp.choice_max > 0
  513.           $game_system.se_play($data_system.decision_se)
  514.           $game_temp.choice_proc.call(self.index)
  515.         end
  516.         if @mid_stop
  517.           @mid_stop = false
  518.           return
  519.         else
  520.           terminate_message
  521.         end
  522.       end
  523.       return
  524.     end
  525.     if @fade_out == false and $game_temp.message_text != nil
  526.       @contents_showing = true
  527.       $game_temp.message_window_showing = true
  528.       refresh
  529.       Graphics.frame_reset
  530.       self.visible = true
  531.       self.contents_opacity = 0
  532.     if @input_number_window != nil
  533.       @input_number_window.contents_opacity = 0
  534.     end
  535.       @fade_in = true
  536.       return
  537.     end
  538.     if self.visible
  539.       @fade_out = true
  540.       self.opacity -= 48
  541.       if self.opacity == 0
  542.         self.visible = false
  543.         @fade_out = false
  544.         $game_temp.message_window_showing = false
  545.       end
  546.       return
  547.     end
  548.   end
  549.   #--------------------------------------------------------------------------
  550.   # ● 获得字符
  551.   #--------------------------------------------------------------------------
  552.   def get_character(parameter)
  553.     case parameter
  554.     when 0
  555.       return $game_player
  556.     else
  557.       events = $game_map.events
  558.       return events == nil ? nil : events[parameter]
  559.     end
  560.   end
  561.   #--------------------------------------------------------------------------
  562.   # ● ウィンドウの位置と不透明度の設定
  563.   #--------------------------------------------------------------------------
  564.   def reset_window
  565.     # 判定
  566.     if @popchar >= 0
  567.       events = $game_map.events
  568.       if events != nil
  569.         character = get_character(@popchar)
  570.         x = [[character.screen_x - 0 - self.width / 2, 4].max, 636 - self.width].min
  571.         y = [[character.screen_y - 48 - self.height, 4].max, 476 - self.height].min
  572.         self.x = x
  573.         self.y = y
  574.       end
  575.     elsif @popchar == -1
  576.       self.x = -4
  577.       self.y = -4
  578.       self.width = 648
  579.       self.height = 488
  580.     else
  581.       if $game_temp.in_battle
  582.         self.y = 16
  583.       else
  584.         case $game_system.message_position
  585.         when 0 # 上
  586.           self.y = 16
  587.         when 1 # 中
  588.           self.y = 160
  589.         when 2 # 下
  590.           self.y = 304
  591.         end
  592.         self.x = 80
  593.         if @face_file == nil
  594.           self.width = 480
  595.         else
  596.           self.width = 600
  597.           self.x -= 60
  598.         end
  599.         self.height = 160
  600.       end
  601.     end
  602.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  603.     if @face_file != nil
  604.       self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  605.     end
  606.     if @popchar == -1
  607.       self.opacity = 255
  608.       self.back_opacity = 0
  609.     elsif $game_system.message_frame == 0
  610.       self.opacity = 255
  611.       self.back_opacity = 200
  612.     else
  613.       self.opacity = 0
  614.       self.back_opacity = 200
  615.     end
  616.   end
  617.   #--------------------------------------------------------------------------
  618.   # ● line_height
  619.   #--------------------------------------------------------------------------
  620.   # 返回値:行高
  621.   #--------------------------------------------------------------------------
  622.   def line_height
  623.     return 32
  624.     if self.contents.font.size >= 20 and self.contents.font.size <= 24
  625.       return 32
  626.     else
  627.       return self.contents.font.size * 15 / 10
  628.     end
  629.   end
  630.   #--------------------------------------------------------------------------
  631.   # ● 透過文字描画
  632.   #--------------------------------------------------------------------------
  633.   # target :描画対象。Bitmapクラスを指定。
  634.   # x :x座標
  635.   # y :y座標
  636.   # str  :描画文字列
  637.   # opacity:透過率(0~255)
  638.   # 返回値 :文字幅(@x増加値)。
  639.   #--------------------------------------------------------------------------
  640.   def opacity_draw_text(target, x, y, str,opacity)
  641.     height = target.font.size
  642.     width = target.text_size(str).width
  643.     opacity = [[opacity, 0].max, 255].min
  644.     if opacity == 255
  645.       target.draw_text(x, y, width, height, str)
  646.       return width
  647.     else
  648.       if @opacity_text_buf.width < width or @opacity_text_buf.height < height
  649.         @opacity_text_buf.dispose
  650.         @opacity_text_buf = Bitmap.new(width, height)
  651.       else
  652.         @opacity_text_buf.clear
  653.       end
  654.       @opacity_text_buf.font.size = target.font.size
  655.       @opacity_text_buf.draw_text(0, 0, width, height, str)
  656.       target.blt(x, y, @opacity_text_buf, Rect.new(0, 0, width, height), opacity)
  657.     return width
  658.     end
  659.   end
  660.   def ruby_draw_text(target, x, y, str,opacity)
  661.     sizeback = target.font.size
  662.     target.font.size * 3 / 2 > 32 ? rubysize = 32 - target.font.size : rubysize = target.font.size / 2
  663.     rubysize = [rubysize, 6].max
  664.    
  665.     opacity = [[opacity, 0].max, 255].min
  666.     split_s = str.split(/,/)
  667.    
  668.     split_s[0] == nil ? split_s[0] = "" : nil
  669.     split_s[1] == nil ? split_s[1] = "" : nil
  670.    
  671.     height = sizeback + rubysize
  672.     width = target.text_size(split_s[0]).width
  673.    
  674.     target.font.size = rubysize
  675.     ruby_width = target.text_size(split_s[1]).width
  676.     target.font.size = sizeback
  677.    
  678.     buf_width = [target.text_size(split_s[0]).width, ruby_width].max
  679.    
  680.     width - ruby_width != 0 ? sub_x = (width - ruby_width) / 2 : sub_x = 0
  681.    
  682.     if opacity == 255
  683.       target.font.size = rubysize
  684.       target.draw_text(x + sub_x, y - target.font.size, target.text_size(split_s[1]).width, target.font.size, split_s[1])
  685.       target.font.size = sizeback
  686.       target.draw_text(x, y, width, target.font.size, split_s[0])
  687.       return width
  688.     else
  689.       if @opacity_text_buf.width < buf_width or @opacity_text_buf.height < height
  690.         @opacity_text_buf.dispose
  691.         @opacity_text_buf = Bitmap.new(buf_width, height)
  692.       else
  693.         @opacity_text_buf.clear
  694.       end
  695.       @opacity_text_buf.font.size = rubysize
  696.       @opacity_text_buf.draw_text(0 , 0, buf_width, rubysize, split_s[1], 1)
  697.       @opacity_text_buf.font.size = sizeback
  698.       @opacity_text_buf.draw_text(0 , rubysize, buf_width, sizeback, split_s[0], 1)
  699.       if sub_x >= 0
  700.         target.blt(x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  701.       else
  702.         target.blt(x + sub_x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  703.       end
  704.       return width
  705.     end
  706.   end
  707.   #--------------------------------------------------------------------------
  708.   # ● \V 变换
  709.   #--------------------------------------------------------------------------
  710.   def convart_value(option, index)
  711.     option == nil ? option = "" : nil
  712.     option.downcase!
  713.     case option
  714.       when "i"
  715.         unless $data_items[index].name == nil
  716.           r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  717.         end
  718.       when "w"
  719.         unless $data_weapons[index].name == nil
  720.           r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  721.         end
  722.       when "a"
  723.         unless $data_armors[index].name == nil
  724.           r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  725.         end
  726.       when "s"
  727.         unless $data_skills[index].name == nil
  728.           r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  729.         end
  730.       else
  731.       r = $game_variables[index]
  732.     end
  733.     r == nil ? r = "" : nil
  734.     return r
  735.   end
  736.   #--------------------------------------------------------------------------
  737.   # ● 解放
  738.   #--------------------------------------------------------------------------
  739.   def dispose
  740.     terminate_message
  741.     if @gaiji_cache != nil
  742.       unless @gaiji_cache.disposed?
  743.         @gaiji_cache.dispose
  744.       end
  745.     end
  746.     unless @opacity_text_buf.disposed?
  747.       @opacity_text_buf.dispose
  748.     end
  749.     $game_temp.message_window_showing = false
  750.     if @input_number_window != nil
  751.       @input_number_window.dispose
  752.     end
  753.     super
  754.   end
  755.   #--------------------------------------------------------------------------
  756.   # ● 矩形更新
  757.   #--------------------------------------------------------------------------
  758.   def update_cursor_rect
  759.     if @index >= 0
  760.       n = $game_temp.choice_start + @index
  761.       self.cursor_rect.set(4 + @indent + @face_indent, n * 32 + 4, @cursor_width, 32)
  762.     else
  763.       self.cursor_rect.empty
  764.     end
  765.   end
  766. end
  767. #==============================================================================
  768. # ■ Window_Frame (枠だけで中身の無いウィンドウ)
  769. #==============================================================================
  770. class Window_Frame < Window_Base
  771.   #--------------------------------------------------------------------------
  772.   # ● オブジェクト初期化
  773.   #--------------------------------------------------------------------------
  774.   def initialize(x, y, width, height)
  775.     super(x, y, width, height)
  776.     self.contents = nil
  777.     self.back_opacity = 200
  778.   end
  779.   #--------------------------------------------------------------------------
  780.   # ● 解放
  781.   #--------------------------------------------------------------------------
  782.   def dispose
  783.     super
  784.     end
  785.   end
  786. #==============================================================================
  787. # ■ Air_Text (何も無いところに文字描写 = 枠の無い瞬間表示メッセージウィンドウ)
  788. #==============================================================================
  789. class Air_Text < Window_Base
  790.   #--------------------------------------------------------------------------
  791.   # ● オブジェクト初期化
  792.   #--------------------------------------------------------------------------
  793.   def initialize(x, y, designate_text)
  794.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  795.     self.opacity = 0
  796.     self.back_opacity = 0
  797.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  798.     w = self.contents.width
  799.     h = self.contents.height
  800.     self.contents.draw_text(0, 0, w, h, designate_text)
  801.   end
  802.   #--------------------------------------------------------------------------
  803.   # ● 解放
  804.   #--------------------------------------------------------------------------
  805.   def dispose
  806.     self.contents.clear
  807.     super
  808.   end
  809. end


  810. #==============================================================================
  811. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  812. #==============================================================================


复制代码



# \~   :文字直接消失

《天空之城 —— 破碎的命运》
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-8-3 02:53

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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