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

Project1

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

[已经过期] 用了对话框加强脚本后,文字颜色改不了

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
20 小时
注册时间
2013-7-21
帖子
11
跳转到指定楼层
1
发表于 2014-1-21 13:46:32 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 evol621 于 2014-1-21 13:48 编辑

求助!!!
没有加其他脚本,把这个脚本插入到main之前后,再文章里用\c[1-8],文字不变色了?!
请教有没有人能解决这个问题?让这个变色功能可以正常使用

或者推荐几个功能类似更好用的对话框脚本……


RUBY 代码复制
  1. 真·对话框加强脚本的完美精简版
  2.  
  3.  
  4. 发表日期:2006-1-12   
  5.  
  6. 作者Ikki
  7.  
  8.  
  9. # ————————————————————————————————————
  10. # 本脚本来自[url]www.66rpg.com[/url],转载请保留此信息
  11. # ————————————————————————————————————
  12. #——说明
  13. #默认为一个字一个字的方式,如果需要一次全部显示,
  14. #请在游戏中使用脚本:$game_system.typing = true
  15. # 其他在对话中可以使用的功能:
  16. # \n[1]:显示1号角色的姓名
  17. # \name[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名
  18. # \name[\n[1]]:显示1号主角的姓名方框
  19. # \p[1]:对话框出现在1号事件的上方
  20. # \p[0]:主人公上方出现对话框
  21. #——————————————————使用\p功能后可以自动调整对话框大小
  22. # \>   :文字不用打字方式
  23. # \<   :文字使用打字方式
  24. # \\:显示"\"这个符号
  25. # \c[1-8]:更改颜色
  26. # \g:显示金钱窗口
  27. # \t: 显示游戏时间窗口
  28. # \v[7]:显示7号变量的值
  29. # \v[a7]:显示7号防具的名称
  30. # \v[s7]:显示7号特技的名称
  31. # \v[w7]:显示7号武器的名称
  32. # \v[i7]:显示7号道具的名称
  33. # \I   :下一行从这个位置开始
  34. # \o[123]:文字透明度改为123,模拟将死之人(汗)
  35. # \h[12]:改用12号字
  36. # \b[50]:空50象素
  37. # \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  38. # \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”
  39. # \Lk:清除左边的图像
  40. # \Rk:清除右边的图像
  41. # \A:头像及姓名框靠左排列
  42. # \a:头像及姓名框靠右排列
  43. # \M[60]:等待60帧文字直接消失
  44. # \MS[1-8]:更改文字背景颜色
  45. # \ME:恢复文字背景颜色
  46. #颜色自定义设定范围0-255
  47. #使用方法:在文章前输入如下脚本定义颜色
  48. #          $color0 = 数值
  49. #          $color1 = 数值
  50. #          $color2 = 数值
  51. #\name参数的颜色自定义设定范围0-255
  52. #使用方法:在文章前输入如下脚本定义颜色
  53. #          $ncolor0 = 数值
  54. #          $ncolor1 = 数值
  55. #          $ncolor2 = 数值
  56. # \!   :等待玩家按回车再继续
  57. #$speed :文字的打字速度设置用的,数字越大速度越慢。
  58. #============================
  59. class Game_System
  60. attr_accessor :typing
  61. alias carol3_ini initialize
  62. def initialize
  63. carol3_ini
  64. @typing = true
  65. end
  66. end
  67. #=================================#==============================================================================
  68. # ■ Window_Message
  69. #------------------------------------------------------------------------------
  70. class Window_Message < Window_Selectable
  71.   #颜色自定义用的全局变量定义
  72.   $color0 = 255
  73.   $color1 = 255
  74.   $color2 = 255
  75.   #颜色自定义用的全局变量定义
  76.  
  77.   #说话速度设置用的全局变量
  78.  
  79.   $speed = 1
  80.  
  81. #--------------------------------------------------------------------------
  82. # ● 初始化状态
  83. #--------------------------------------------------------------------------
  84. def initialize
  85.   super(80, 304, 480, 160)
  86.   self.contents = Bitmap.new(width - 32, height - 32)
  87.   self.visible = false
  88.   self.z = 9998
  89.   @fade_in = false
  90.   @fade_out = false
  91.   @contents_showing = false
  92.   @cursor_width = 0
  93. # Start
  94.   @bflag = false
  95. # End
  96.   @autoclosetime = -1
  97.   self.active = false
  98.   self.index = -1
  99.   @opacity_text_buf = Bitmap.new(32, 32)
  100. end
  101. #--------------------------------------------------------------------------
  102. # ● 释放
  103. #--------------------------------------------------------------------------
  104. def dispose
  105.   terminate_message
  106.   $game_temp.message_window_showing = false
  107.   if @input_number_window != nil
  108.     @input_number_window.dispose
  109.   end
  110.   super
  111. end
  112. #--------------------------------------------------------------------------
  113. # ● 处理信息结束
  114. #--------------------------------------------------------------------------
  115. def terminate_message
  116.   self.active = false
  117.   self.pause = false
  118.   self.index = -1
  119.   self.contents.clear
  120.   # 清除显示中标志
  121.   @contents_showing = false
  122.   # 呼叫信息调用
  123.   if $game_temp.message_proc != nil
  124.     $game_temp.message_proc.call
  125.   end
  126.   # 清除文章、选择项、输入数值的相关变量
  127.   $game_temp.message_text = nil
  128.   $game_temp.message_proc = nil
  129.   $game_temp.choice_start = 99
  130.   $game_temp.choice_max = 0
  131.   $game_temp.choice_cancel_type = 0
  132.   $game_temp.choice_proc = nil
  133.   $game_temp.num_input_start = 99
  134.   $game_temp.num_input_variable_id = 0
  135.   $game_temp.num_input_digits_max = 0
  136.   # 开放金钱窗口
  137.   if @gold_window != nil
  138.     @gold_window.dispose
  139.     @gold_window = nil
  140.   end
  141. #Start
  142.   # ピクチャ廃棄処理
  143.   begin
  144. #      if @spgra.disposed? == false
  145.       @spgra.dispose
  146. #      end
  147. #      if @backgraphic.disposed? == false
  148.       @backgraphic.dispose
  149. #      end
  150.   rescue
  151. #      print "ピクチャが読み込めていません!"
  152.   end
  153. #End
  154.   # 开放时间窗口
  155.   if @playtime_window != nil
  156.     @playtime_window.dispose
  157.     @playtime_window = nil
  158.   end
  159.   if @name_window_frame != nil
  160.     @name_window_frame.dispose
  161.     @name_window_frame = nil
  162.   end
  163.   if @name_window_text != nil
  164.     @name_window_text.dispose
  165.     @name_window_text = nil
  166.   end
  167.   if @right_picture != nil and @right_keep == true
  168.     @right_picture.dispose
  169.   end   
  170.   if @left_picture != nil and @left_keep == true
  171.     @left_picture.dispose
  172.   end
  173.   @face_bitmap = nil
  174. end
  175. def refresh
  176.   # 初期化
  177.   self.contents.clear
  178.   self.contents.font.color = normal_color
  179.   self.contents.font.size = Font.default_size
  180.   @x = @y = @max_x = @max_y = @indent = @lines = 0
  181.   @left_keep = @right_keep = false
  182.   @face_indent = 0
  183.   [url=home.php?mod=space&uid=316553]@opacity[/url] = 255
  184.   @cursor_width = 0
  185.   @autoclosetime = -1
  186.   @write_speed = $speed
  187.   @write_wait = 0
  188.   @mid_stop = false
  189.   face = nil
  190.   @popchar = -2
  191.   @alignment = true
  192.   if $game_temp.choice_start == 0
  193.     @x = 8
  194.   end
  195.   if $game_temp.message_text != nil
  196.     @now_text = $game_temp.message_text
  197.     #——对齐设置
  198.     if (/\\([Aa])/.match(@now_text))!=nil then
  199.       if $1 == "A"
  200.         @alignment = true
  201.       else
  202.         @alignment = false
  203.       end
  204.       @now_text.gsub!(/\\([Aa])/) { "" }
  205.     end
  206.     #——头像设置
  207.      if (/\\([Ff])\[(.+?)\]/.match(@now_text))!=nil then
  208.        [url=home.php?mod=space&uid=84331]@face[/url] = $2 + "_f.png"
  209.        if $1 == "f" and $game_actors[$2.to_i] != nil
  210.          face = $game_actors[$2.to_i].battler_name + "_f.png"
  211.        end
  212.        if FileTest.exist?("Graphics/Pictures/#{face}")
  213.          @face_bitmap = Bitmap.new("Graphics/Pictures/#{face}")
  214.          if @alignment
  215.            @x = @face_indent = 128
  216.            self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  217.          else
  218.            self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  219.              Rect.new(0, 0, 96, 96))
  220.          end
  221.        else
  222.          face = nil
  223.          @face_bitmap = nil
  224.        end
  225.        @now_text.gsub!(/\\([Ff])\[(.*?)\]/) { "" }
  226.      end
  227.     #——左半身像设置
  228.     if (/\\[Ll]\[(.+?)\]/.match(@now_text))!=nil then
  229.       [url=home.php?mod=space&uid=84331]@face[/url] = "66rpg_" + $1 + "_h.png"
  230.       if $加密 == true
  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 = [email]480-@left_picture.bitmap.height[/email]
  237.         @left_picture.x = 0
  238.         @left_picture.mirror = true
  239.         @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  240.       else         
  241.         if FileTest.exist?("Graphics/battlers/#{@face}")
  242.           if @left_picture != nil
  243.             @left_picture.dispose
  244.           end
  245.           @left_picture = Sprite.new
  246.           @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  247.           @left_picture.y = [email]480-@left_picture.bitmap.height[/email]
  248.           @left_picture.x = 0
  249.           @left_picture.mirror = true
  250.           @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  251.         end
  252.       end        
  253.     end
  254.     #——右半身像设置
  255.     if (/\\[Rr]\[(.+?)\]/.match(@now_text))!=nil then
  256.       @face = "66rpg_" + $1 + "_h.png"
  257.       if $加密 == true
  258.         if @right_picture != nil
  259.           @right_picture.dispose
  260.         end
  261.         @right_picture = Sprite.new
  262.         @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  263.         @right_picture.y = [email]480-@right_picture.bitmap.height[/email]
  264.         @right_picture.x = [email]640-@right_picture.bitmap.width[/email]
  265.         @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  266.       else
  267.         if FileTest.exist?("Graphics/battlers/#{@face}")
  268.           if @right_picture != nil
  269.             @right_picture.dispose
  270.           end
  271.           @right_picture = Sprite.new
  272.           @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  273.           @right_picture.y = [email]480-@right_picture.bitmap.height[/email]
  274.           @right_picture.x = [email]640-@right_picture.bitmap.width[/email]
  275.           @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  276.         end
  277.       end
  278.     end
  279.     if (/\\[Rr]k/.match(@now_text)) != nil
  280.       @right_keep = true
  281.       @now_text.sub!(/\\[Rr]k/) { "" }
  282.     end
  283.     if (/\\[Ll]k/.match(@now_text)) != nil
  284.       @left_keep = true
  285.       @now_text.sub!(/\\[Ll]k/) { "" }
  286.     end
  287.     # 替换人物姓名
  288.     @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  289.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  290.     end
  291.     # 显示人物姓名
  292.     name_window_set = false
  293.     if (/\\[Nn][Aa][Mm][Ee](.*?)\[(.+?)\]/.match(@now_text)) != nil
  294.       name_window_set = true
  295.       name_text = $2
  296.       @now_text.sub!(/\\[Nn][Aa][Mm][Ee](.*?)\[(.*?)\]/) { "" }
  297.     end
  298.     # 文字位置的判定
  299.     if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
  300.       @popchar = $1.to_i
  301.       if @popchar == -1
  302.         @x = @indent = 48
  303.         @y = 4
  304.       end
  305.       @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  306.     end
  307.  
  308.     # 开始
  309.     begin
  310.       last_text = @now_text.clone
  311.       @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  312.     end until @now_text == last_text
  313.   @now_text.gsub!(/\\\\/) { "\000" }
  314.   @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  315.   @now_text.gsub!(/\\[Gg]/) { "\002" }
  316.   @now_text.gsub!(/\\[Tt]/) { "\004" }
  317.   @now_text.gsub!(/\\[Mm]\[([0-9]+)\]/) { "\050[#{$1}]" }
  318.   @now_text.gsub!(/\\[Ii]/) { "\023" }
  319.   @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  320.   @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  321.   @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  322.   @now_text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\027[#{$1}]" }
  323.   @now_text.gsub!(/\\[!]/) { "\020" }
  324. @now_text.gsub!(/\\[>]/) { "\016" }
  325. @now_text.gsub!(/\\[<]/) { "\017" }
  326.  
  327. # Start
  328. # ◎
  329.     # "\\MS" を "\052" に、 "\\ME" を "\053" に変更
  330.     @now_text.gsub!(/\\[Mm][Ss]\[([0-9]+)\]/) { "\052[#{$1}]" }
  331.     @now_text.gsub!(/\\[Mm][Ee]/) { "\053" }
  332. # ◎
  333. # End
  334.   if @popchar >= 0
  335.     @text_save = @now_text.clone
  336.     @max_x = 0
  337.     @max_y = 4
  338.     for i in 0..3
  339.       line = @now_text.split(/\n/)[3-i]
  340.       @max_y -= 1 if line == nil and @max_y <= 4-i
  341.       next if line == nil
  342.       cx = contents.text_size(line).width
  343.       @max_x = cx if cx > @max_x
  344.     end
  345.     self.width = @max_x + 48 + @face_indent
  346.     self.height = (@max_y - 1) * 32 + 64
  347.   else
  348.     @max_x = self.width - 32 - @face_indent
  349.   end
  350.   reset_window
  351.     if name_window_set
  352.       off_x = 0
  353.       off_y = -40
  354.       space = 2
  355.       w = self.contents.text_size(name_text).width + 26 + space
  356.       x = @alignment ? self.x + off_x - space / 2 : self.x + off_x - space / 2 + self.width - w
  357.       y = self.y + off_y - space / 2
  358.       h = 40 + space
  359.       @name_window_frame = Window_Frame.new(x, y, w, h)
  360.       @name_window_frame.z = self.z + 1
  361.       x = @alignment ? self.x + off_x - space / 2 + 4 : self.x + off_x - space / 2 + 4 + self.width - w
  362.       y = self.y + off_y - space / 2
  363.       @name_window_text = Air_Text.new(x+4, y+6, name_text)
  364.       @name_window_text.z = self.z + 2
  365.     end
  366.   end
  367.   reset_window
  368.   if $game_temp.choice_max > 0
  369.     @item_max = $game_temp.choice_max
  370.     self.active = true
  371.     self.index = 0
  372.   end
  373.   if $game_temp.num_input_variable_id > 0
  374.     digits_max = $game_temp.num_input_digits_max
  375.     number = $game_variables[$game_temp.num_input_variable_id]
  376.     @input_number_window = Window_InputNumber.new(digits_max)
  377.     @input_number_window.number = number
  378.     @input_number_window.x = self.x + 8
  379.     @input_number_window.y = self.y + $game_temp.num_input_start * 32
  380.   end
  381. end
  382. #--------------------------------------------------------------------------
  383. # ● 更新
  384. #--------------------------------------------------------------------------
  385. def update
  386.   super
  387.  
  388.  
  389.     #颜色自定义设定范围0-255
  390.     self.contents.font.color = Color.new($color0, $color1, $color2)
  391.     #颜色自定义设定范围0-255
  392.  
  393.  
  394.     if @autoclosetime == 0
  395.     @autoclosetime = -1
  396.     terminate_message
  397. end
  398.   if @autoclosetime >= 1
  399.     @autoclosetime -= 1
  400.   end
  401.   if @fade_in
  402.     self.contents_opacity += 24
  403.     if @input_number_window != nil
  404.       @input_number_window.contents_opacity += 24
  405.     end
  406.     if self.contents_opacity == 255
  407.       @fade_in = false
  408.     end
  409.     return
  410.   end
  411.   @now_text = nil if @now_text == ""
  412.  
  413.   if @now_text != nil and @mid_stop == false
  414.     if @write_wait > 0
  415.       @write_wait -= 1
  416.       return
  417.     end
  418.     text_not_skip = $game_system.typing
  419.     while true
  420.       @max_x = @x if @max_x < @x
  421.       @max_y = @y if @max_y < @y
  422.       if (c = @now_text.slice!(/./m)) != nil
  423.         if c == "\000"
  424.           c = "\\"
  425.         end
  426.         if c == "\001"
  427.           @now_text.sub!(/\[([0-9]+)\]/, "")
  428.           color = $1.to_i
  429.           if color >= 0 and color <= 7
  430.             self.contents.font.color = text_color(color)
  431.           end
  432.           c = ""
  433.         end
  434.         if c == "\002"
  435.           if @gold_window == nil and @popchar <= 0
  436.             @gold_window = Window_Gold.new
  437.             @gold_window.x = 560 - @gold_window.width
  438.             if $game_temp.in_battle
  439.               @gold_window.y = 192
  440.             else
  441.               @gold_window.y = self.y >= 128 ? 32 : 384
  442.             end
  443.             @gold_window.opacity = self.opacity
  444.             @gold_window.back_opacity = self.back_opacity
  445.           end
  446.           c = ""
  447.         end
  448.       if c == "\004"
  449.         if @playtime_window == nil and @popchar <=0
  450.           @playtime_window = Window_PlayTime.new
  451.           @playtime_window.x = 80
  452.           if $game_temp.in_battle
  453.             @playtime_window.y = 192
  454.           else
  455.             @playtime_window.y = self.y >= 128 ? 32 : 384
  456.           end
  457.           @playtime_window.opacity = self.opacity
  458.           @playtime_window.back_opacity = self.back_opacity
  459.         end
  460.       end
  461.        if c == "\016"
  462.          text_not_skip = false
  463.          c = ""
  464.        end
  465.        if c == "\017"
  466.          text_not_skip = true
  467.          c = ""
  468.        end
  469.        if c == "\020"
  470.          @mid_stop = true
  471.          c = ""
  472.        end        
  473.         if c == "\023"
  474.           @indent = @x
  475.           c = ""
  476.         end
  477.         if c == "\024"
  478.           @now_text.sub!(/\[([0-9]+)\]/, "")
  479.           @opacity = $1.to_i
  480.           c = ""
  481.         end
  482.         if c == "\025"
  483.           @now_text.sub!(/\[([0-9]+)\]/, "")
  484.           self.contents.font.size = [[$1.to_i, 6].max, 32].min
  485.           c = ""
  486.         end
  487.         if c == "\026"
  488.           @now_text.sub!(/\[([0-9]+)\]/, "")
  489.           @x += $1.to_i
  490.           c = ""
  491.         end
  492.       if c == "\027"
  493.         @now_text.sub!(/\[([0-9]+)\]/, "")
  494.         @x += $1.to_i * self.contents.font.size / 2
  495.         next
  496.       end
  497.         if c == "\030"
  498.           @now_text.sub!(/\[(.*?)\]/, "")
  499.           self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  500.           @x += 24
  501.           c = ""
  502.         end
  503.         if c == "\050"
  504.         @now_text.sub!(/\[([0-9]+)\]/, "")
  505.         @autoclosetime = $1.to_i
  506.         next
  507.       end
  508. # Start
  509. # ◎
  510.       # \MSの場合
  511.       if c == "\052"
  512.         @now_text.sub!(/\[([0-9]+)\]/, "")
  513.         bcolor = $1.to_i
  514.         @bflag = true
  515.       end
  516.       # \MEの場合
  517.       if c == "\053"
  518.         @bflag = false
  519.         bcolor = 0
  520.       end
  521. # ◎
  522. # End
  523. # Start
  524. # ◎
  525.       if @bflag == true
  526.         if bcolor >= 0 and bcolor <= 7
  527.           bsize = self.contents.text_size(c).width
  528.           self.contents.fill_rect(4 + @x, 32 * @y, bsize, 32, text_color(bcolor))
  529.         end
  530.       end
  531. # ◎
  532. # End
  533.         if c == "\n"
  534.           if @lines >= $game_temp.choice_start
  535.             @cursor_width = [@cursor_width, @max_x - @face_indent].max
  536.           end
  537.           @lines += 1
  538.           @y += 1
  539.           @x = 0 + @indent + @face_indent
  540.           if @lines >= $game_temp.choice_start
  541.             @x = 8 + @indent + @face_indent
  542.           end
  543.           c = ""
  544.         end
  545.         if c != ""
  546.           # 文字描画
  547.           @x += opacity_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), c, @opacity)
  548.         end
  549.         if Input.press?(Input::B)
  550.           text_not_skip = false
  551.         end
  552.       else
  553.         text_not_skip = true
  554.         break
  555.       end
  556.       # 終了判定
  557.       if text_not_skip
  558.         break
  559.       end
  560.     end
  561.     @write_wait += @write_speed
  562.     return
  563.   end
  564.   if @input_number_window != nil
  565.     @input_number_window.update
  566.     # 決定
  567.     if Input.trigger?(Input::C)
  568.       $game_system.se_play($data_system.decision_se)
  569.       $game_variables[$game_temp.num_input_variable_id] =
  570.       @input_number_window.number
  571.       $game_map.need_refresh = true
  572.       @input_number_window.dispose
  573.       @input_number_window = nil
  574.       terminate_message
  575.     end
  576.     return
  577.   end
  578.   if @contents_showing
  579.     if $game_temp.choice_max == 0
  580.       self.pause = true
  581.     end
  582.     # 取消
  583.     if Input.trigger?(Input::B)
  584.       if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  585.         $game_system.se_play($data_system.cancel_se)
  586.         $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  587.         terminate_message
  588.       end
  589.     end
  590.     # 決定
  591.     if Input.trigger?(Input::C)
  592.       if $game_temp.choice_max > 0
  593.         $game_system.se_play($data_system.decision_se)
  594.         $game_temp.choice_proc.call(self.index)
  595.       end
  596.       if @mid_stop
  597.         @mid_stop = false
  598.         return
  599.       else
  600.         terminate_message
  601.       end
  602.     end
  603.     return
  604.   end
  605.   if @fade_out == false and $game_temp.message_text != nil
  606.     @contents_showing = true
  607.     $game_temp.message_window_showing = true
  608.     refresh
  609.     Graphics.frame_reset
  610.     self.visible = true
  611.     self.contents_opacity = 0
  612.   if @input_number_window != nil
  613.     @input_number_window.contents_opacity = 0
  614.   end
  615.     @fade_in = true
  616.     return
  617.   end
  618.   if self.visible
  619.     @fade_out = true
  620.     self.opacity -= 48
  621.     if self.opacity == 0
  622.       self.visible = false
  623.       @fade_out = false
  624.       $game_temp.message_window_showing = false
  625.     end
  626.     return
  627.   end
  628. end
  629. #--------------------------------------------------------------------------
  630. # ● 获得字符
  631. #--------------------------------------------------------------------------
  632. def get_character(parameter)
  633.   case parameter
  634.   when 0
  635.     return $game_player
  636.   else
  637.     events = $game_map.events
  638.     return events == nil ? nil : events[parameter]
  639.   end
  640. end
  641. #--------------------------------------------------------------------------
  642. # ● ウィンドウの位置と不透明度の設定
  643. #--------------------------------------------------------------------------
  644. def reset_window
  645.   # 判定
  646.   if @popchar >= 0
  647.     events = $game_map.events
  648.     if events != nil
  649.       character = get_character(@popchar)
  650.       x = [[character.screen_x - 0 - self.width / 2, 4].max, 636 - self.width].min
  651.       y = [[character.screen_y - 48 - self.height, 4].max, 476 - self.height].min
  652.       self.x = x
  653.       self.y = y
  654.     end
  655.   elsif @popchar == -1
  656.     self.x = -4
  657.     self.y = -4
  658.     self.width = 648
  659.     self.height = 488
  660.   else
  661.     if $game_temp.in_battle
  662.        self.y = 48
  663.     else
  664.       case $game_system.message_position
  665.       when 0 # 上
  666.         self.y = 16
  667.       when 1 # 中
  668.         self.y = 160
  669.       when 2 # 下
  670.         self.y = 304
  671.       end
  672.       self.x = 80
  673.        if @face_bitmap == nil
  674.          self.width = 480
  675.        else
  676.          self.width = 600
  677.          self.x -= 60
  678.        end
  679.        self.height = 160
  680.      end
  681.    end
  682.   self.contents = Bitmap.new(self.width - 32, self.height - 32)
  683.    if @face_bitmap != nil
  684.      if @alignment
  685.        self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  686.      else
  687.        self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  688.          Rect.new(0, 0, 96, 96))
  689.      end
  690.    end
  691.    if @popchar == -1
  692.     self.opacity = 255
  693.     self.back_opacity = 0
  694.   elsif $game_system.message_frame == 0
  695.     self.opacity = 255
  696.     self.back_opacity = 100
  697.   else
  698.     self.opacity = 0
  699.     self.back_opacity = 100
  700.   end
  701. end
  702. #--------------------------------------------------------------------------
  703. # ● line_height
  704. #--------------------------------------------------------------------------
  705. # 返回値:行高
  706. #--------------------------------------------------------------------------
  707. def line_height
  708.   return 32
  709.   if self.contents.font.size >= 20 and self.contents.font.size <= 24
  710.     return 32
  711.   else
  712.     return self.contents.font.size * 15 / 10
  713.   end
  714. end
  715. #--------------------------------------------------------------------------
  716. # ● \V 变换
  717. #--------------------------------------------------------------------------
  718. def convart_value(option, index)
  719.   option == nil ? option = "" : nil
  720.   option.downcase!
  721.   case option
  722.     when "i"
  723.       unless $data_items[index].name == nil
  724.         r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  725.       end
  726.     when "w"
  727.       unless $data_weapons[index].name == nil
  728.         r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  729.       end
  730.     when "a"
  731.       unless $data_armors[index].name == nil
  732.         r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  733.       end
  734.     when "s"
  735.       unless $data_skills[index].name == nil
  736.         r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  737.       end
  738.     else
  739.     r = $game_variables[index]
  740.   end
  741.   r == nil ? r = "" : nil
  742.   return r
  743. end
  744. #--------------------------------------------------------------------------
  745. # ● 透過文字描画
  746. #--------------------------------------------------------------------------
  747. # target :描画対象。Bitmapクラスを指定。
  748. # x :x座標
  749. # y :y座標
  750. # str  :描画文字列
  751. # opacity:透過率(0~255)
  752. # 返回値 :文字幅(@x増加値)。
  753. #--------------------------------------------------------------------------
  754. def opacity_draw_text(target, x, y, str,opacity)
  755.   height = target.font.size
  756.   width = target.text_size(str).width
  757.   opacity = [[opacity, 0].max, 255].min
  758.   if opacity == 255
  759.     target.draw_text(x, y, width, height, str)
  760.     return width
  761.   else
  762.     if @opacity_text_buf.width < width or @opacity_text_buf.height < height
  763.       @opacity_text_buf.dispose
  764.       @opacity_text_buf = Bitmap.new(width, height)
  765.     else
  766.       @opacity_text_buf.clear
  767.     end
  768.     @opacity_text_buf.font.size = target.font.size
  769.     @opacity_text_buf.draw_text(0, 0, width, height, str)
  770.     target.blt(x, y, @opacity_text_buf, Rect.new(0, 0, width, height), opacity)
  771.   return width
  772.   end
  773. end
  774. def ruby_draw_text(target, x, y, str,opacity)
  775.   sizeback = target.font.size
  776.   target.font.size * 3 / 2 > 32 ? rubysize = 32 - target.font.size : rubysize = target.font.size / 2
  777.   rubysize = [rubysize, 6].max
  778.  
  779.   opacity = [[opacity, 0].max, 255].min
  780.   split_s = str.split(/,/)
  781.  
  782.   split_s[0] == nil ? split_s[0] = "" : nil
  783.   split_s[1] == nil ? split_s[1] = "" : nil
  784.  
  785.   height = sizeback + rubysize
  786.   width = target.text_size(split_s[0]).width
  787.  
  788.   target.font.size = rubysize
  789.   ruby_width = target.text_size(split_s[1]).width
  790.   target.font.size = sizeback
  791.  
  792.   buf_width = [target.text_size(split_s[0]).width, ruby_width].max
  793.  
  794.   width - ruby_width != 0 ? sub_x = (width - ruby_width) / 2 : sub_x = 0
  795.  
  796.   if opacity == 255
  797.     target.font.size = rubysize
  798.     target.draw_text(x + sub_x, y - target.font.size, target.text_size(split_s[1]).width, target.font.size, split_s[1])
  799.     target.font.size = sizeback
  800.     target.draw_text(x, y, width, target.font.size, split_s[0])
  801.     return width
  802.   else
  803.     if @opacity_text_buf.width < buf_width or @opacity_text_buf.height < height
  804.       @opacity_text_buf.dispose
  805.       @opacity_text_buf = Bitmap.new(buf_width, height)
  806.     else
  807.       @opacity_text_buf.clear
  808.     end
  809.     @opacity_text_buf.font.size = rubysize
  810.     @opacity_text_buf.draw_text(0 , 0, buf_width, rubysize, split_s[1], 1)
  811.     @opacity_text_buf.font.size = sizeback
  812.     @opacity_text_buf.draw_text(0 , rubysize, buf_width, sizeback, split_s[0], 1)
  813.     if sub_x >= 0
  814.       target.blt(x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  815.     else
  816.       target.blt(x + sub_x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  817.     end
  818.     return width
  819.   end
  820. end
  821. #--------------------------------------------------------------------------
  822. # ● 解放
  823. #--------------------------------------------------------------------------
  824. def dispose
  825.   terminate_message
  826.   if @gaiji_cache != nil
  827.     unless @gaiji_cache.disposed?
  828.       @gaiji_cache.dispose
  829.     end
  830.   end
  831.   unless @opacity_text_buf.disposed?
  832.     @opacity_text_buf.dispose
  833.   end
  834.   $game_temp.message_window_showing = false
  835.   if @input_number_window != nil
  836.     @input_number_window.dispose
  837.   end
  838.   super
  839. end
  840. #--------------------------------------------------------------------------
  841. # ● 矩形更新
  842. #--------------------------------------------------------------------------
  843. def update_cursor_rect
  844.   if @index >= 0
  845.     n = $game_temp.choice_start + @index
  846.     self.cursor_rect.set(4 + @indent + @face_indent, n * 32 + 4, @cursor_width, 32)
  847.   else
  848.     self.cursor_rect.empty
  849.   end
  850. end
  851. end
  852. #==============================================================================
  853. # ■ Window_Frame (枠だけで中身の無いウィンドウ)
  854. #==============================================================================
  855. class Window_Frame < Window_Base
  856. #--------------------------------------------------------------------------
  857. # ● オブジェクト初期化
  858. #--------------------------------------------------------------------------
  859. def initialize(x, y, width, height)
  860.   super(x, y, width, height)
  861.   self.contents = nil
  862.   self.back_opacity = 100
  863. end
  864. #--------------------------------------------------------------------------
  865. # ● 解放
  866. #--------------------------------------------------------------------------
  867. def dispose
  868.   super
  869.   end
  870. end
  871. #==============================================================================
  872. # ■ Air_Text (何も無いところに文字描写 = 枠の無い瞬間表示メッセージウィンドウ)
  873. #==============================================================================
  874. class Air_Text < Window_Base
  875.  
  876.   #参数的颜色自定义设定范围0-255
  877.   $ncolor0 = 255
  878.   $ncolor1 = 255
  879.   $ncolor2 = 255
  880.   #参数的颜色自定义设定范围0-255
  881.  
  882. #--------------------------------------------------------------------------
  883. # ● オブジェクト初期化
  884. #--------------------------------------------------------------------------
  885. def initialize(x, y, designate_text)
  886.   super(x-16, y-16, 32 + designate_text.size * 12, 56)
  887.   self.opacity = 0
  888.   self.back_opacity = 0
  889.   self.contents = Bitmap.new(self.width - 32, self.height - 32)
  890.   w = self.contents.width
  891.   h = self.contents.height
  892.  
  893.     #颜色自定义设定范围0-255
  894.     self.contents.font.color = Color.new($ncolor0, $ncolor1, $ncolor2)
  895.     #颜色自定义设定范围0-255
  896.  
  897.  
  898. #    self.contents.font.color = text_color(color)
  899.   self.contents.draw_text(0, 0, w, h, designate_text)
  900. end
  901. #--------------------------------------------------------------------------
  902. # ● 解放
  903. #--------------------------------------------------------------------------
  904. def dispose
  905.   self.contents.clear
  906.   super
  907. end
  908. end

Lv5.捕梦者 (版主)

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

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

2
发表于 2014-1-21 18:39:42 | 只看该作者
  1. #颜色自定义设定范围0-255
  2. #使用方法:在文章前输入如下脚本定义颜色
  3. #          $color0 = 数值
  4. #          $color1 = 数值
  5. #          $color2 = 数值
  6. #\name参数的颜色自定义设定范围0-255
  7. #使用方法:在文章前输入如下脚本定义颜色
  8. #          $ncolor0 = 数值
  9. #          $ncolor1 = 数值
  10. #          $ncolor2 = 数值
复制代码
文件变色的功能只是复杂了而已

评分

参与人数 1星屑 +90 收起 理由
myownroc + 90 我很赞同

查看全部评分

大家好,这里是晨露的说。请多多指教。
刚入门RM软件制作,请大家多多帮助我哦。
落雪君的欢乐像素教程,欢迎查阅。

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
20 小时
注册时间
2013-7-21
帖子
11
3
 楼主| 发表于 2014-1-22 12:36:17 | 只看该作者
美丽晨露 发表于 2014-1-21 18:39
文件变色的功能只是复杂了而已

哦哦,那就是说\c[]不管用了?还是不懂改文字颜色的方法。。SORRY我是脚本盲。。。
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (版主)

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

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

4
发表于 2014-1-22 18:23:16 | 只看该作者

以上设置
大家好,这里是晨露的说。请多多指教。
刚入门RM软件制作,请大家多多帮助我哦。
落雪君的欢乐像素教程,欢迎查阅。

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 17:34

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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