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

Project1

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

[已经过期] 如何在显示文章的过程中进行其他的操作

 关闭 [复制链接]

Lv1.梦旅人

看不到我

梦石
0
星屑
50
在线时间
229 小时
注册时间
2005-11-6
帖子
1741

贵宾

跳转到指定楼层
1
发表于 2011-1-10 09:56:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
显示文章“1234567890”,因为使用了“真·对话加强”脚本,所以有打字的效果,期望当显示完“1”后,打开开关1,当显示完“3”后改变某个变量。
曾想过在显示文章的过程中并期另外一个事件,但是这样做很消耗资源而且扩展性很差,各位有什么更佳的方法吗?

点评

哈希?或者数组?  发表于 2011-1-10 10:22

Lv4.逐梦者

梦石
0
星屑
7946
在线时间
1182 小时
注册时间
2007-7-29
帖子
2055
2
发表于 2011-1-13 20:59:08 | 只看该作者
直接在对话框脚本里改吧,虽然可能很乱,可是比较简单,加个开关什么的在事件里也算好控制了。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

旅之愚者

梦石
0
星屑
240
在线时间
812 小时
注册时间
2007-7-28
帖子
2148

贵宾

3
发表于 2011-1-13 23:00:16 | 只看该作者
回复 小湖 的帖子

球真*对话脚本,站内搜索了下,似乎只有一个失效的链接了

回复 支持 反对

使用道具 举报

Lv5.捕梦者 (管理员)

老黄鸡

梦石
0
星屑
39816
在线时间
7488 小时
注册时间
2009-7-6
帖子
13484

开拓者贵宾

4
发表于 2011-1-14 08:11:51 | 只看该作者
回复 小湖 的帖子

小湖大人把这个对话脚本贴出来吧,可能可以在显示文字的地方做出判断再剔除标识文字.

点评

如果很长就贴地址吧  发表于 2011-1-14 08:12
RGDirect - DirectX驱动的RGSS,点我了解.
RM全系列成套系统定制请联系QQ1213237796
不接受对其他插件维护的委托
回复 支持 反对

使用道具 举报

Lv1.梦旅人

看不到我

梦石
0
星屑
50
在线时间
229 小时
注册时间
2005-11-6
帖子
1741

贵宾

5
 楼主| 发表于 2011-1-14 09:05:20 | 只看该作者
补充脚本:
  1. # ————————————————————————————————————
  2. # 本脚本来自www.66rpg.com,转载请保留此信息
  3. # ————————————————————————————————————
  4. #——说明
  5. #默认为一个字一个字的方式,如果需要一次全部显示,
  6. #请在游戏中使用脚本:$game_system.typing = true
  7. # 其他在对话中可以使用的功能:

  8. # \n[1]:显示1号角色的姓名
  9. # \name[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名
  10. # \name[\n[1]]:显示1号主角的姓名方框
  11. # \p[1]:对话框出现在1号事件的上方
  12. # \p[0]:主人公上方出现对话框
  13. #——————————————————使用\p功能后可以自动调整对话框大小
  14. # \>   :文字不用打字方式
  15. # \<   :文字使用打字方式
  16. # \\:显示"\"这个符号
  17. # \c[1-8]:更改颜色
  18. # \g:显示金钱窗口
  19. # \t: 显示游戏时间窗口
  20. # \v[7]:显示7号变量的值
  21. # \v[a7]:显示7号防具的名称
  22. # \v[s7]:显示7号特技的名称
  23. # \v[w7]:显示7号武器的名称
  24. # \v[i7]:显示7号道具的名称
  25. # \I   :下一行从这个位置开始
  26. # \o[123]:文字透明度改为123,模拟将死之人(汗)
  27. # \h[12]:改用12号字
  28. # \b[50]:空50象素
  29. # \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  30. # \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”
  31. # \Lk:清除左边的图像
  32. # \Rk:清除右边的图像
  33. # \A:头像及姓名框靠左排列
  34. # \a:头像及姓名框靠右排列
  35. # \M[60]:等待60帧文字直接消失
  36. # \MS[1-8]:更改文字背景颜色
  37. # \ME:恢复文字背景颜色
  38. #颜色自定义设定范围0-255
  39. #使用方法:在文章前输入如下脚本定义颜色
  40. #          $color0 = 数值
  41. #          $color1 = 数值
  42. #          $color2 = 数值
  43. #\name参数的颜色自定义设定范围0-255
  44. #使用方法:在文章前输入如下脚本定义颜色
  45. #          $ncolor0 = 数值
  46. #          $ncolor1 = 数值
  47. #          $ncolor2 = 数值
  48. # \!   :等待玩家按回车再继续
  49. #$speed :文字的打字速度设置用的,数字越大速度越慢。

  50. #============================
  51. class Game_System
  52. attr_accessor :typing
  53. alias carol3_ini initialize
  54. def initialize
  55. carol3_ini
  56. @typing = true
  57. end
  58. end
  59. #=================================#==============================================================================
  60. # ■ Window_Message
  61. #------------------------------------------------------------------------------
  62. class Window_Message < Window_Selectable
  63.   #颜色自定义用的全局变量定义
  64.   $color0 = 255
  65.   $color1 = 255
  66.   $color2 = 255
  67.   #颜色自定义用的全局变量定义

  68.   #说话速度设置用的全局变量

  69.   $speed = 1

  70. #--------------------------------------------------------------------------
  71. # ● 初始化状态
  72. #--------------------------------------------------------------------------
  73. def initialize
  74.   super(80, 304, 480, 160)
  75.   self.contents = Bitmap.new(width - 32, height - 32)
  76.   self.visible = false
  77.   self.z = 9998
  78.   @fade_in = false
  79.   @fade_out = false
  80.   @contents_showing = false
  81.   @cursor_width = 0
  82. # Start
  83.   @bflag = false
  84. # End
  85.   @autoclosetime = -1
  86.   self.active = false
  87.   self.index = -1
  88.   @opacity_text_buf = Bitmap.new(32, 32)
  89. end
  90. #--------------------------------------------------------------------------
  91. # ● 释放
  92. #--------------------------------------------------------------------------
  93. def dispose
  94.   terminate_message
  95.   $game_temp.message_window_showing = false
  96.   if @input_number_window != nil
  97.     @input_number_window.dispose
  98.   end
  99.   super
  100. end
  101. #--------------------------------------------------------------------------
  102. # ● 处理信息结束
  103. #--------------------------------------------------------------------------
  104. def terminate_message
  105.   self.active = false
  106.   self.pause = false
  107.   self.index = -1
  108.   self.contents.clear
  109.   # 清除显示中标志
  110.   @contents_showing = false
  111.   # 呼叫信息调用
  112.   if $game_temp.message_proc != nil
  113.     $game_temp.message_proc.call
  114.   end
  115.   # 清除文章、选择项、输入数值的相关变量
  116.   $game_temp.message_text = nil
  117.   $game_temp.message_proc = nil
  118.   $game_temp.choice_start = 99
  119.   $game_temp.choice_max = 0
  120.   $game_temp.choice_cancel_type = 0
  121.   $game_temp.choice_proc = nil
  122.   $game_temp.num_input_start = 99
  123.   $game_temp.num_input_variable_id = 0
  124.   $game_temp.num_input_digits_max = 0
  125.   # 开放金钱窗口
  126.   if @gold_window != nil
  127.     @gold_window.dispose
  128.     @gold_window = nil
  129.   end
  130. #Start
  131.   # ピクチャ廃弃処理
  132.   begin
  133. #      if @spgra.disposed? == false
  134.       @spgra.dispose
  135. #      end
  136. #      if @backgraphic.disposed? == false
  137.       @backgraphic.dispose
  138. #      end
  139.   rescue
  140. #      print "ピクチャが読み込めていません!"
  141.   end
  142. #End
  143.   # 开放时间窗口
  144.   if @playtime_window != nil
  145.     @playtime_window.dispose
  146.     @playtime_window = nil
  147.   end
  148.   if @name_window_frame != nil
  149.     @name_window_frame.dispose
  150.     @name_window_frame = nil
  151.   end
  152.   if @name_window_text != nil
  153.     @name_window_text.dispose
  154.     @name_window_text = nil
  155.   end
  156.   if @right_picture != nil and @right_keep == true
  157.     @right_picture.dispose
  158.   end   
  159.   if @left_picture != nil and @left_keep == true
  160.     @left_picture.dispose
  161.   end
  162.   @face_bitmap = nil
  163. end
  164. def refresh
  165.   # 初期化
  166.   self.contents.clear
  167.   self.contents.font.color = normal_color
  168.   self.contents.font.size = Font.default_size
  169.   @x = @y = @max_x = @max_y = @indent = @lines = 0
  170.   @left_keep = @right_keep = false
  171.   @face_indent = 0
  172.   @opacity = 255
  173.   @cursor_width = 0
  174.   @autoclosetime = -1
  175.   @write_speed = $speed
  176.   @write_wait = 0
  177.   @mid_stop = false
  178.   face = nil
  179.   @popchar = -2
  180.   @alignment = true
  181.   if $game_temp.choice_start == 0
  182.     @x = 8
  183.   end
  184.   if $game_temp.message_text != nil
  185.     @now_text = $game_temp.message_text
  186.     #——对齐设置
  187.     if (/\\([Aa])/.match(@now_text))!=nil then
  188.       if $1 == "A"
  189.         @alignment = true
  190.       else
  191.         @alignment = false
  192.       end
  193.       @now_text.gsub!(/\\([Aa])/) { "" }
  194.     end
  195.     #——头像设置
  196.      if (/\\([Ff])\[(.+?)\]/.match(@now_text))!=nil then
  197.        @face = $2 + "_f.png"
  198.        if $1 == "f" and $game_actors[$2.to_i] != nil
  199.          @face = $game_actors[$2.to_i].battler_name + "_f.png"
  200.        end
  201.        if FileTest.exist?("Graphics/Pictures/#{@face}")
  202.          @face_bitmap = Bitmap.new("Graphics/Pictures/#{@face}")
  203.          if @alignment
  204.            @x = @face_indent = 128
  205.            self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  206.          else
  207.            self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  208.              Rect.new(0, 0, 96, 96))
  209.          end
  210.        else
  211.          @face = nil
  212.          @face_bitmap = nil
  213.        end
  214.        @now_text.gsub!(/\\([Ff])\[(.*?)\]/) { "" }
  215.      end
  216.     #——左半身像设置
  217.     if (/\\[Ll]\[(.+?)\]/.match(@now_text))!=nil then
  218.       @face = "66rpg_" + $1 + "_h.png"
  219.       if $加密 == true
  220.         if @left_picture != nil
  221.           @left_picture.dispose
  222.         end
  223.         @left_picture = Sprite.new
  224.         @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  225.         @left_picture.y = 480-@left_picture.bitmap.height
  226.         @left_picture.x = 0
  227.         @left_picture.mirror = true
  228.         @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  229.       else         
  230.         if FileTest.exist?("Graphics/battlers/#{@face}")
  231.           if @left_picture != nil
  232.             @left_picture.dispose
  233.           end
  234.           @left_picture = Sprite.new
  235.           @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  236.           @left_picture.y = 480-@left_picture.bitmap.height
  237.           @left_picture.x = 0
  238.           @left_picture.mirror = true
  239.           @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  240.         end
  241.       end      
  242.     end
  243.     #——右半身像设置
  244.     if (/\\[Rr]\[(.+?)\]/.match(@now_text))!=nil then
  245.       @face = "66rpg_" + $1 + "_h.png"
  246.       if $加密 == true
  247.         if @right_picture != nil
  248.           @right_picture.dispose
  249.         end
  250.         @right_picture = Sprite.new
  251.         @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  252.         @right_picture.y = 480-@right_picture.bitmap.height
  253.         @right_picture.x = 640-@right_picture.bitmap.width
  254.         @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  255.       else
  256.         if FileTest.exist?("Graphics/battlers/#{@face}")
  257.           if @right_picture != nil
  258.             @right_picture.dispose
  259.           end
  260.           @right_picture = Sprite.new
  261.           @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  262.           @right_picture.y = 480-@right_picture.bitmap.height
  263.           @right_picture.x = 640-@right_picture.bitmap.width
  264.           @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  265.         end
  266.       end
  267.     end
  268.     if (/\\[Rr]k/.match(@now_text)) != nil
  269.       @right_keep = true
  270.       @now_text.sub!(/\\[Rr]k/) { "" }
  271.     end
  272.     if (/\\[Ll]k/.match(@now_text)) != nil
  273.       @left_keep = true
  274.       @now_text.sub!(/\\[Ll]k/) { "" }
  275.     end
  276.     # 替换人物姓名
  277.     @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  278.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  279.     end
  280.     # 显示人物姓名
  281.     name_window_set = false
  282.     if (/\\[Nn][Aa][Mm][Ee](.*?)\[(.+?)\]/.match(@now_text)) != nil
  283.       name_window_set = true
  284.       name_text = $2
  285.       @now_text.sub!(/\\[Nn][Aa][Mm][Ee](.*?)\[(.*?)\]/) { "" }
  286.     end
  287.     # 文字位置的判定
  288.     if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
  289.       @popchar = $1.to_i
  290.       if @popchar == -1
  291.         @x = @indent = 48
  292.         @y = 4
  293.       end
  294.       @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  295.     end
  296.    
  297.     # 开始
  298.     begin
  299.       last_text = @now_text.clone
  300.       @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  301.     end until @now_text == last_text
  302.   @now_text.gsub!(/\\\\/) { "\000" }
  303.   @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  304.   @now_text.gsub!(/\\[Gg]/) { "\002" }
  305.   @now_text.gsub!(/\\[Tt]/) { "\004" }
  306.   @now_text.gsub!(/\\[Mm]\[([0-9]+)\]/) { "\050[#{$1}]" }
  307.   @now_text.gsub!(/\\[Ii]/) { "\023" }
  308.   @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  309.   @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  310.   @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  311.   @now_text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\027[#{$1}]" }
  312.   @now_text.gsub!(/\\[!]/) { "\020" }
  313. @now_text.gsub!(/\\[>]/) { "\016" }
  314. @now_text.gsub!(/\\[<]/) { "\017" }

  315. # Start
  316. # ◎
  317.     # "\\MS" を "\052" に、 "\\ME" を "\053" に変更
  318.     @now_text.gsub!(/\\[Mm][Ss]\[([0-9]+)\]/) { "\052[#{$1}]" }
  319.     @now_text.gsub!(/\\[Mm][Ee]/) { "\053" }
  320. # ◎
  321. # End

  322.   if @popchar >= 0
  323.     @text_save = @now_text.clone
  324.     @max_x = 0
  325.     @max_y = 4
  326.     for i in 0..3
  327.       line = @now_text.split(/\n/)[3-i]
  328.       @max_y -= 1 if line == nil and @max_y <= 4-i
  329.       next if line == nil
  330.       cx = contents.text_size(line).width
  331.       @max_x = cx if cx > @max_x
  332.     end
  333.     self.width = @max_x + 48 + @face_indent
  334.     self.height = (@max_y - 1) * 32 + 64
  335.   else
  336.     @max_x = self.width - 32 - @face_indent
  337.   end
  338.   reset_window
  339.     if name_window_set
  340.       off_x = 0
  341.       off_y = -40
  342.       space = 2
  343.       w = self.contents.text_size(name_text).width + 26 + space
  344.       x = @alignment ? self.x + off_x - space / 2 : self.x + off_x - space / 2 + self.width - w
  345.       y = self.y + off_y - space / 2
  346.       h = 40 + space
  347.       @name_window_frame = Window_Frame.new(x, y, w, h)
  348.       @name_window_frame.z = self.z + 1
  349.       x = @alignment ? self.x + off_x - space / 2 + 4 : self.x + off_x - space / 2 + 4 + self.width - w
  350.       y = self.y + off_y - space / 2
  351.       @name_window_text = Air_Text.new(x+4, y+6, name_text)
  352.       @name_window_text.z = self.z + 2
  353.     end
  354.   end
  355.   reset_window
  356.   if $game_temp.choice_max > 0
  357.     @item_max = $game_temp.choice_max
  358.     self.active = true
  359.     self.index = 0
  360.   end
  361.   if $game_temp.num_input_variable_id > 0
  362.     digits_max = $game_temp.num_input_digits_max
  363.     number = $game_variables[$game_temp.num_input_variable_id]
  364.     @input_number_window = Window_InputNumber.new(digits_max)
  365.     @input_number_window.number = number
  366.     @input_number_window.x = self.x + 8
  367.     @input_number_window.y = self.y + $game_temp.num_input_start * 32
  368.   end
  369. end
  370. #--------------------------------------------------------------------------
  371. # ● 更新
  372. #--------------------------------------------------------------------------
  373. def update
  374.   super


  375.     #颜色自定义设定范围0-255
  376.     self.contents.font.color = Color.new($color0, $color1, $color2)
  377.     #颜色自定义设定范围0-255
  378.    
  379.    
  380.     if @autoclosetime == 0
  381.     @autoclosetime = -1
  382.     terminate_message
  383. end
  384.   if @autoclosetime >= 1
  385.     @autoclosetime -= 1
  386.   end
  387.   if @fade_in
  388.     self.contents_opacity += 24
  389.     if @input_number_window != nil
  390.       @input_number_window.contents_opacity += 24
  391.     end
  392.     if self.contents_opacity == 255
  393.       @fade_in = false
  394.     end
  395.     return
  396.   end
  397.   @now_text = nil if @now_text == ""

  398.   if @now_text != nil and @mid_stop == false
  399.     if @write_wait > 0
  400.       @write_wait -= 1
  401.       return
  402.     end
  403.     text_not_skip = $game_system.typing
  404.     while true
  405.       @max_x = @x if @max_x < @x
  406.       @max_y = @y if @max_y < @y
  407.       if (c = @now_text.slice!(/./m)) != nil
  408.         if c == "\000"
  409.           c = "\\"
  410.         end
  411.         if c == "\001"
  412.           @now_text.sub!(/\[([0-9]+)\]/, "")
  413.           color = $1.to_i
  414.           if color >= 0 and color <= 7
  415.             self.contents.font.color = text_color(color)
  416.           end
  417.           c = ""
  418.         end
  419.         if c == "\002"
  420.           if @gold_window == nil and @popchar <= 0
  421.             @gold_window = Window_Gold.new
  422.             @gold_window.x = 560 - @gold_window.width
  423.             if $game_temp.in_battle
  424.               @gold_window.y = 192
  425.             else
  426.               @gold_window.y = self.y >= 128 ? 32 : 384
  427.             end
  428.             @gold_window.opacity = self.opacity
  429.             @gold_window.back_opacity = self.back_opacity
  430.           end
  431.           c = ""
  432.         end
  433.       if c == "\004"
  434.         if @playtime_window == nil and @popchar <=0
  435.           @playtime_window = Window_PlayTime.new
  436.           @playtime_window.x = 80
  437.           if $game_temp.in_battle
  438.             @playtime_window.y = 192
  439.           else
  440.             @playtime_window.y = self.y >= 128 ? 32 : 384
  441.           end
  442.           @playtime_window.opacity = self.opacity
  443.           @playtime_window.back_opacity = self.back_opacity
  444.         end
  445.       end
  446.        if c == "\016"
  447.          text_not_skip = false
  448.          c = ""
  449.        end
  450.        if c == "\017"
  451.          text_not_skip = true
  452.          c = ""
  453.        end
  454.        if c == "\020"
  455.          @mid_stop = true
  456.          c = ""
  457.        end      
  458.         if c == "\023"
  459.           @indent = @x
  460.           c = ""
  461.         end
  462.         if c == "\024"
  463.           @now_text.sub!(/\[([0-9]+)\]/, "")
  464.           @opacity = $1.to_i
  465.           c = ""
  466.         end
  467.         if c == "\025"
  468.           @now_text.sub!(/\[([0-9]+)\]/, "")
  469.           self.contents.font.size = [[$1.to_i, 6].max, 32].min
  470.           c = ""
  471.         end
  472.         if c == "\026"
  473.           @now_text.sub!(/\[([0-9]+)\]/, "")
  474.           @x += $1.to_i
  475.           c = ""
  476.         end
  477.       if c == "\027"
  478.         @now_text.sub!(/\[([0-9]+)\]/, "")
  479.         @x += $1.to_i * self.contents.font.size / 2
  480.         next
  481.       end
  482.         if c == "\030"
  483.           @now_text.sub!(/\[(.*?)\]/, "")
  484.           self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  485.           @x += 24
  486.           c = ""
  487.         end
  488.         if c == "\050"
  489.         @now_text.sub!(/\[([0-9]+)\]/, "")
  490.         @autoclosetime = $1.to_i
  491.         next
  492.       end
  493. # Start
  494. # ◎
  495.       # \MSの场合
  496.       if c == "\052"
  497.         @now_text.sub!(/\[([0-9]+)\]/, "")
  498.         bcolor = $1.to_i
  499.         @bflag = true
  500.       end
  501.       # \MEの场合
  502.       if c == "\053"
  503.         @bflag = false
  504.         bcolor = 0
  505.       end
  506. # ◎
  507. # End
  508. # Start
  509. # ◎
  510.       if @bflag == true
  511.         if bcolor >= 0 and bcolor <= 7
  512.           bsize = self.contents.text_size(c).width
  513.           self.contents.fill_rect(4 + @x, 32 * @y, bsize, 32, text_color(bcolor))
  514.         end
  515.       end
  516. # ◎
  517. # End
  518.         if c == "\n"
  519.           if @lines >= $game_temp.choice_start
  520.             @cursor_width = [@cursor_width, @max_x - @face_indent].max
  521.           end
  522.           @lines += 1
  523.           @y += 1
  524.           @x = 0 + @indent + @face_indent
  525.           if @lines >= $game_temp.choice_start
  526.             @x = 8 + @indent + @face_indent
  527.           end
  528.           c = ""
  529.         end
  530.         if c != ""
  531.           # 文字描画
  532.           @x += opacity_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), c, @opacity)
  533.         end
  534.         if Input.press?(Input::B)
  535.           text_not_skip = false
  536.         end
  537.       else
  538.         text_not_skip = true
  539.         break
  540.       end
  541.       # 终了判定
  542.       if text_not_skip
  543.         break
  544.       end
  545.     end
  546.     @write_wait += @write_speed
  547.     return
  548.   end
  549.   if @input_number_window != nil
  550.     @input_number_window.update
  551.     # 决定
  552.     if Input.trigger?(Input::C)
  553.       $game_system.se_play($data_system.decision_se)
  554.       $game_variables[$game_temp.num_input_variable_id] =
  555.       @input_number_window.number
  556.       $game_map.need_refresh = true
  557.       @input_number_window.dispose
  558.       @input_number_window = nil
  559.       terminate_message
  560.     end
  561.     return
  562.   end
  563.   if @contents_showing
  564.     if $game_temp.choice_max == 0
  565.       self.pause = true
  566.     end
  567.     # 取消
  568.     if Input.trigger?(Input::B)
  569.       if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  570.         $game_system.se_play($data_system.cancel_se)
  571.         $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  572.         terminate_message
  573.       end
  574.     end
  575.     # 决定
  576.     if Input.trigger?(Input::C)
  577.       if $game_temp.choice_max > 0
  578.         $game_system.se_play($data_system.decision_se)
  579.         $game_temp.choice_proc.call(self.index)
  580.       end
  581.       if @mid_stop
  582.         @mid_stop = false
  583.         return
  584.       else
  585.         terminate_message
  586.       end
  587.     end
  588.     return
  589.   end
  590.   if @fade_out == false and $game_temp.message_text != nil
  591.     @contents_showing = true
  592.     $game_temp.message_window_showing = true
  593.     refresh
  594.     Graphics.frame_reset
  595.     self.visible = true
  596.     self.contents_opacity = 0
  597.   if @input_number_window != nil
  598.     @input_number_window.contents_opacity = 0
  599.   end
  600.     @fade_in = true
  601.     return
  602.   end
  603.   if self.visible
  604.     @fade_out = true
  605.     self.opacity -= 48
  606.     if self.opacity == 0
  607.       self.visible = false
  608.       @fade_out = false
  609.       $game_temp.message_window_showing = false
  610.     end
  611.     return
  612.   end
  613. end
  614. #--------------------------------------------------------------------------
  615. # ● 获得字符
  616. #--------------------------------------------------------------------------
  617. def get_character(parameter)
  618.   case parameter
  619.   when 0
  620.     return $game_player
  621.   else
  622.     events = $game_map.events
  623.     return events == nil ? nil : events[parameter]
  624.   end
  625. end
  626. #--------------------------------------------------------------------------
  627. # ● ウィンドウの位置と不透明度の设定
  628. #--------------------------------------------------------------------------
  629. def reset_window
  630.   # 判定
  631.   if @popchar >= 0
  632.     events = $game_map.events
  633.     if events != nil
  634.       character = get_character(@popchar)
  635.       x = [[character.screen_x - 0 - self.width / 2, 4].max, 636 - self.width].min
  636.       y = [[character.screen_y - 48 - self.height, 4].max, 476 - self.height].min
  637.       self.x = x
  638.       self.y = y
  639.     end
  640.   elsif @popchar == -1
  641.     self.x = -4
  642.     self.y = -4
  643.     self.width = 648
  644.     self.height = 488
  645.   else
  646.     if $game_temp.in_battle
  647.        self.y = 48
  648.     else
  649.       case $game_system.message_position
  650.       when 0 # 上
  651.         self.y = 16
  652.       when 1 # 中
  653.         self.y = 160
  654.       when 2 # 下
  655.         self.y = 304
  656.       end
  657.       self.x = 80
  658.        if @face_bitmap == nil
  659.          self.width = 480
  660.        else
  661.          self.width = 600
  662.          self.x -= 60
  663.        end
  664.        self.height = 160
  665.      end
  666.    end
  667.   self.contents = Bitmap.new(self.width - 32, self.height - 32)
  668.    if @face_bitmap != nil
  669.      if @alignment
  670.        self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  671.      else
  672.        self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  673.          Rect.new(0, 0, 96, 96))
  674.      end
  675.    end
  676.    if @popchar == -1
  677.     self.opacity = 255
  678.     self.back_opacity = 0
  679.   elsif $game_system.message_frame == 0
  680.     self.opacity = 255
  681.     self.back_opacity = 100
  682.   else
  683.     self.opacity = 0
  684.     self.back_opacity = 100
  685.   end
  686. end
  687. #--------------------------------------------------------------------------
  688. # ● line_height
  689. #--------------------------------------------------------------------------
  690. # 返回値:行高
  691. #--------------------------------------------------------------------------
  692. def line_height
  693.   return 32
  694.   if self.contents.font.size >= 20 and self.contents.font.size <= 24
  695.     return 32
  696.   else
  697.     return self.contents.font.size * 15 / 10
  698.   end
  699. end
  700. #--------------------------------------------------------------------------
  701. # ● \V 变换
  702. #--------------------------------------------------------------------------
  703. def convart_value(option, index)
  704.   option == nil ? option = "" : nil
  705.   option.downcase!
  706.   case option
  707.     when "i"
  708.       unless $data_items[index].name == nil
  709.         r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  710.       end
  711.     when "w"
  712.       unless $data_weapons[index].name == nil
  713.         r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  714.       end
  715.     when "a"
  716.       unless $data_armors[index].name == nil
  717.         r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  718.       end
  719.     when "s"
  720.       unless $data_skills[index].name == nil
  721.         r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  722.       end
  723.     else
  724.     r = $game_variables[index]
  725.   end
  726.   r == nil ? r = "" : nil
  727.   return r
  728. end
  729. #--------------------------------------------------------------------------
  730. # ● 透过文字描画
  731. #--------------------------------------------------------------------------
  732. # target :描画対象。Bitmapクラスを指定。
  733. # x :x座标
  734. # y :y座标
  735. # str  :描画文字列
  736. # opacity:透过率(0~255)
  737. # 返回値 :文字幅(@x増加値)。
  738. #--------------------------------------------------------------------------
  739. def opacity_draw_text(target, x, y, str,opacity)
  740.   height = target.font.size
  741.   width = target.text_size(str).width
  742.   opacity = [[opacity, 0].max, 255].min
  743.   if opacity == 255
  744.     target.draw_text(x, y, width, height, str)
  745.     return width
  746.   else
  747.     if @opacity_text_buf.width < width or @opacity_text_buf.height < height
  748.       @opacity_text_buf.dispose
  749.       @opacity_text_buf = Bitmap.new(width, height)
  750.     else
  751.       @opacity_text_buf.clear
  752.     end
  753.     @opacity_text_buf.font.size = target.font.size
  754.     @opacity_text_buf.draw_text(0, 0, width, height, str)
  755.     target.blt(x, y, @opacity_text_buf, Rect.new(0, 0, width, height), opacity)
  756.   return width
  757.   end
  758. end
  759. def ruby_draw_text(target, x, y, str,opacity)
  760.   sizeback = target.font.size
  761.   target.font.size * 3 / 2 > 32 ? rubysize = 32 - target.font.size : rubysize = target.font.size / 2
  762.   rubysize = [rubysize, 6].max

  763.   opacity = [[opacity, 0].max, 255].min
  764.   split_s = str.split(/,/)

  765.   split_s[0] == nil ? split_s[0] = "" : nil
  766.   split_s[1] == nil ? split_s[1] = "" : nil

  767.   height = sizeback + rubysize
  768.   width = target.text_size(split_s[0]).width

  769.   target.font.size = rubysize
  770.   ruby_width = target.text_size(split_s[1]).width
  771.   target.font.size = sizeback

  772.   buf_width = [target.text_size(split_s[0]).width, ruby_width].max

  773.   width - ruby_width != 0 ? sub_x = (width - ruby_width) / 2 : sub_x = 0

  774.   if opacity == 255
  775.     target.font.size = rubysize
  776.     target.draw_text(x + sub_x, y - target.font.size, target.text_size(split_s[1]).width, target.font.size, split_s[1])
  777.     target.font.size = sizeback
  778.     target.draw_text(x, y, width, target.font.size, split_s[0])
  779.     return width
  780.   else
  781.     if @opacity_text_buf.width < buf_width or @opacity_text_buf.height < height
  782.       @opacity_text_buf.dispose
  783.       @opacity_text_buf = Bitmap.new(buf_width, height)
  784.     else
  785.       @opacity_text_buf.clear
  786.     end
  787.     @opacity_text_buf.font.size = rubysize
  788.     @opacity_text_buf.draw_text(0 , 0, buf_width, rubysize, split_s[1], 1)
  789.     @opacity_text_buf.font.size = sizeback
  790.     @opacity_text_buf.draw_text(0 , rubysize, buf_width, sizeback, split_s[0], 1)
  791.     if sub_x >= 0
  792.       target.blt(x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  793.     else
  794.       target.blt(x + sub_x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  795.     end
  796.     return width
  797.   end
  798. end
  799. #--------------------------------------------------------------------------
  800. # ● 解放
  801. #--------------------------------------------------------------------------
  802. def dispose
  803.   terminate_message
  804.   if @gaiji_cache != nil
  805.     unless @gaiji_cache.disposed?
  806.       @gaiji_cache.dispose
  807.     end
  808.   end
  809.   unless @opacity_text_buf.disposed?
  810.     @opacity_text_buf.dispose
  811.   end
  812.   $game_temp.message_window_showing = false
  813.   if @input_number_window != nil
  814.     @input_number_window.dispose
  815.   end
  816.   super
  817. end
  818. #--------------------------------------------------------------------------
  819. # ● 矩形更新
  820. #--------------------------------------------------------------------------
  821. def update_cursor_rect
  822.   if @index >= 0
  823.     n = $game_temp.choice_start + @index
  824.     self.cursor_rect.set(4 + @indent + @face_indent, n * 32 + 4, @cursor_width, 32)
  825.   else
  826.     self.cursor_rect.empty
  827.   end
  828. end
  829. end
  830. #==============================================================================
  831. # ■ Window_Frame (枠だけで中身の无いウィンドウ)
  832. #==============================================================================
  833. class Window_Frame < Window_Base
  834. #--------------------------------------------------------------------------
  835. # ● オブジェクト初期化
  836. #--------------------------------------------------------------------------
  837. def initialize(x, y, width, height)
  838.   super(x, y, width, height)
  839.   self.contents = nil
  840.   self.back_opacity = 100
  841. end
  842. #--------------------------------------------------------------------------
  843. # ● 解放
  844. #--------------------------------------------------------------------------
  845. def dispose
  846.   super
  847.   end
  848. end
  849. #==============================================================================
  850. # ■ Air_Text (何も无いところに文字描写 = 枠の无い瞬间表示メッセージウィンドウ)
  851. #==============================================================================
  852. class Air_Text < Window_Base


  853.   #参数的颜色自定义设定范围0-255
  854.   $ncolor0 = 255
  855.   $ncolor1 = 255
  856.   $ncolor2 = 255
  857.   #参数的颜色自定义设定范围0-255

  858. #--------------------------------------------------------------------------
  859. # ● オブジェクト初期化
  860. #--------------------------------------------------------------------------
  861. def initialize(x, y, designate_text)
  862.   super(x-16, y-16, 32 + designate_text.size * 12, 56)
  863.   self.opacity = 0
  864.   self.back_opacity = 0
  865.   self.contents = Bitmap.new(self.width - 32, self.height - 32)
  866.   w = self.contents.width
  867.   h = self.contents.height


  868.     #颜色自定义设定范围0-255
  869.     self.contents.font.color = Color.new($ncolor0, $ncolor1, $ncolor2)
  870.     #颜色自定义设定范围0-255

  871.    
  872.    
  873. #    self.contents.font.color = text_color(color)
  874.   self.contents.draw_text(0, 0, w, h, designate_text)
  875. end
  876. #--------------------------------------------------------------------------
  877. # ● 解放
  878. #--------------------------------------------------------------------------
  879. def dispose
  880.   self.contents.clear
  881.   super
  882. end
  883. end
复制代码

点评

都尝试修改过,把注释也删了,照样出错,还是等您回家再发正常的吧  发表于 2011-1-14 09:32
现在在公司,没法看我工程里的脚本……这个从网上找来的,我用的是这个,很不会是复制的时候注释行换行了?  发表于 2011-1-14 09:23
脚本完全无效,并且在初始化里P的时候提示第一行错误,无法解决  发表于 2011-1-14 09:21
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7946
在线时间
1182 小时
注册时间
2007-7-29
帖子
2055
6
发表于 2011-1-14 10:31:36 | 只看该作者
本帖最后由 enghao_lim 于 2011-1-14 10:32 编辑

估计fux2你用opera,在opera底下复制代码有可能发生神马时间,就是第一行第一个字多了个"\0",明白了吧,所以error。


enghao_lim于2011-1-14 10:33补充以下内容:
其实小湖要的是同步执行另外的事件嘛,与变换打字好像没什么关系...

点评

喵LIM英明,我在群里也是这么猜的~  发表于 2011-1-14 11:02
(==0) 汗颜...  发表于 2011-1-14 10:38
果断自删一楼~  发表于 2011-1-14 10:37
年深日久记忆错误  发表于 2011-1-14 10:35
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
131 小时
注册时间
2010-6-24
帖子
623
7
发表于 2011-1-14 10:46:29 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-4 18:45

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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