Project1

标题: 呼出对话框脚本问题? [打印本页]

作者: a994520851    时间: 2013-12-31 19:04
标题: 呼出对话框脚本问题?
对话超过第二行时就会有小方块???????

9LFZ[W_LJ3S19OO$[%H}[47.jpg (91.09 KB, 下载次数: 13)

9LFZ[W_LJ3S19OO$[%H}[47.jpg

4V_F6]OC$AVCB203Z529%8G.jpg (124.92 KB, 下载次数: 11)

4V_F6]OC$AVCB203Z529%8G.jpg

作者: 美丽晨露    时间: 2013-12-31 19:18

在Fuki对话框脚本里找到
self.contents.draw_text(4+@dx, (font_size+10)*@dy, font_size, font_size, c)

把它换成
      if c == "\001" or c == "\002" or c == "\003" or c == "\n"
        c = ""
      else
        self.contents.draw_text(4+@dx, (font_size+10)*@dy, font_size, font_size, c)
      end

作者: chd114    时间: 2013-12-31 21:19
因为你的脚本不是最新版本= =所以有一个显示方块的BUG
作者: a994520851    时间: 2013-12-31 22:14
美丽晨露 发表于 2013-12-31 19:18
在Fuki对话框脚本里找到
self.contents.draw_text(4+@dx, (font_size+10)*@dy, font_size, font_size, c)
...

十分感谢!!!
作者: a994520851    时间: 2013-12-31 22:17
chd114 发表于 2013-12-31 21:19
因为你的脚本不是最新版本= =所以有一个显示方块的BUG

如果可以的话能把最新版地址发给我吗?
作者: chd114    时间: 2013-12-31 22:27
a994520851 发表于 2013-12-31 22:17
如果可以的话能把最新版地址发给我吗?

我这里没用这种···我用的是这个
  1. =begin
  2. [XP+VX]扩充Bitmap的draw_text 多种控制符支持

  3. by 薄凉看客
  4. 感谢 fux2 的帮助!

  5. 使用方法
  6. blkk_text(rect, str, align)
  7. blkk_text(x, y, width, height, str, align)

  8. 若str不是字符串对象,则会先调用 to_s 方法转换成字符串

  9. str所支持的控制符:
  10. !N[n] 显示ID为n的角色名
  11. !V[n] 显示n号变量值
  12. !C[n] 文字颜色改变(draw_color可自定义颜色)
  13. !I[n] 显示n号物品的图标
  14. !W[n] 显示n号武器的图标
  15. !A[n] 显示n号防具的图标
  16. !换行 手动换行
  17. !S[n] 使用n号字体大小

  18. =end

  19. # 即无视draw_text的参数width和height
  20. # width = 字符本身的宽度 height = 32
  21. $忽略默认宽高 = false

  22. # 彩色底 控制条件 建议命令窗口中使用
  23. $color_floor = false

  24. class Bitmap
  25.   alias text_old draw_text unless method_defined? :text_old
  26.   def draw_text(*arg)
  27.     if arg[0].is_a?(Rect)
  28.       color_coo = self.font.color.clone
  29.       self.font.color = Color.new(0, 0, 0)
  30.       rect_x = arg[0].x
  31.       rect_y = arg[0].y
  32.       rect_width = arg[0].width
  33.       rect_height = arg[0].height
  34.       rect = Rect.new(rect_x, rect_y, rect_width, rect_height)
  35.       for i in 1..4
  36.         rect.set(rect_x + 1, rect_y, rect_width, rect_height) if i == 1
  37.         rect.set(rect_x - 1, rect_y, rect_width, rect_height) if i == 2
  38.         rect.set(rect_x, rect_y + 1, rect_width, rect_height) if i == 3
  39.         rect.set(rect_x, rect_y - 1, rect_width, rect_height) if i == 4
  40.         text_old(rect, arg[1], arg[2] == nil ? 0 : arg[2])
  41.       end
  42.       self.font.color = color_coo
  43.       rect.set(rect_x, rect_y, rect_width, rect_height)
  44.       text_old(rect, arg[1], arg[2] == nil ? 0 : arg[2])
  45.     else
  46.       color_coo = self.font.color.clone
  47.       self.font.color = Color.new(0, 0, 0)
  48.       text_old(
  49.       arg[0] + 1, arg[1], arg[2], arg[3], arg[4], arg[5] == nil ? 0 : arg[5])
  50.       text_old(
  51.       arg[0] - 1, arg[1], arg[2], arg[3], arg[4], arg[5] == nil ? 0 : arg[5])
  52.       text_old(
  53.       arg[0], arg[1] + 1, arg[2], arg[3], arg[4], arg[5] == nil ? 0 : arg[5])
  54.       text_old(
  55.       arg[0], arg[1] - 1, arg[2], arg[3], arg[4], arg[5] == nil ? 0 : arg[5])
  56.       self.font.color = color_coo
  57.       text_old(
  58.       arg[0], arg[1], arg[2], arg[3], arg[4], arg[5] == nil ? 0 : arg[5])
  59.     end
  60.   end
  61.   def blkk_text(*arg)
  62.     if arg[0].is_a?(Rect)
  63.       rect_x = arg[0].x
  64.       rect_y = arg[0].y
  65.       rect_width = arg[0].width
  66.       rect_height = arg[0].height
  67.       rect = Rect.new(rect_x, rect_y, rect_width, rect_height)
  68.       text = arg[1]
  69.       align = arg[2] == nil ? 0 : arg[2]
  70.     else
  71.       x,y,width,height,text = arg[0],arg[1],arg[2],arg[3],arg[4]
  72.       align = arg[5] == nil ? 0 : arg[5]
  73.     end
  74.     while self.text_size(text).width > self.width
  75.       self.font.size -= 1
  76.     end
  77.     size_copy = self.font.size
  78.     color_coo = self.font.color.clone
  79.     if $color_floor
  80.       ca = [[255, 128][rand(2)], [255, 128][rand(2)], [255, 128][rand(2)]]
  81.       for s in 0...width
  82.         self.fill_rect(x + s, y, 1, height, Color.new(
  83.         ca[0], ca[1], ca[2], 255 - s * 320 / width))
  84.       end
  85.     end
  86.     copy_text = text.clone
  87.     i_rect = Rect.new(0, 0, 24, 24)
  88.     begin
  89.       text = copy_text
  90.       text.gsub!(/\![V]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  91.     end until copy_text == text
  92.     text.gsub!(/\![N]\[([0-9]+)\]/) do
  93.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  94.     end
  95.     text.gsub!(/\\\\/) { "\000" }
  96.     text.gsub!(/\![C]\[([0-9]+)\]/) { "\001[#{$1}]" }
  97.     text.gsub!(/\![I]\[([0-9]+)\]/) { "\002[#{$1}]" }
  98.     text.gsub!(/\![W]\[([0-9]+)\]/) { "\003[#{$1}]" }
  99.     text.gsub!(/\![A]\[([0-9]+)\]/) { "\004[#{$1}]" }
  100.     text.gsub!(/\![S]\[([0-9]+)\]/) { "\005[#{$1}]" }
  101.     while ((c = text.slice!(/./m)) != nil)
  102.       if c == "\000"
  103.         c = "\\"
  104.       end
  105.       if c == "\001"
  106.         text.sub!(/\[([0-9]+)\]/, "")
  107.         color_coo = draw_color($1.to_i)
  108.         next
  109.       end
  110.       if c == "\002"
  111.         text.sub!(/\[([0-9]+)\]/, "")
  112.         unless arg[0].is_a?(Rect)
  113.           self.blt(
  114.           x, y + 3, RPG::Cache.icon($data_items[$1.to_i].icon_name), i_rect)
  115.           x += 24
  116.         else
  117.           self.blt(
  118.           rect_x, rect_y + 3, RPG::Cache.icon(
  119.           $data_items[$1.to_i].icon_name), i_rect)
  120.           rect_x += 24
  121.         end
  122.         next
  123.       end
  124.       if c == "\003"
  125.         text.sub!(/\[([0-9]+)\]/, "")
  126.         unless arg[0].is_a?(Rect)
  127.           self.blt(
  128.           x, y + 3, RPG::Cache.icon(
  129.           $data_items[$1.to_i].icon_name), i_rect)
  130.           x += 24
  131.         else
  132.           self.blt(
  133.           rect_x, rect_y + 3, RPG::Cache.icon(
  134.           $data_weapons[$1.to_i].icon_name), i_rect)
  135.           rect_x += 24
  136.         end
  137.         next
  138.       end
  139.       if c == "\004"
  140.         text.sub!(/\[([0-9]+)\]/, "")
  141.         unless arg[0].is_a?(Rect)
  142.           self.blt(
  143.           x, y + 3, RPG::Cache.icon(
  144.           $data_items[$1.to_i].icon_name), i_rect)
  145.           x += 24
  146.         else
  147.           self.blt(
  148.           rect_x, rect_y + 3, RPG::Cache.icon(
  149.           $data_armors[$1.to_i].icon_name), i_rect)
  150.           rect_x += 24
  151.         end
  152.         next
  153.       end
  154.       if c == "\005"
  155.         text.sub!(/\[([0-9]+)\]/, "")
  156.         self.font.size = $1.to_i
  157.         next
  158.       end
  159.       self.font.color = Color.new(0, 0, 0)
  160.       if $忽略默认宽高
  161.         self.font.color = color_coo
  162.         if arg[0].is_a?(Rect)
  163.           draw_text(rect.set(
  164.           rect_x, rect_y, self.text_size(c).width, 32), c, align)
  165.           rect_x += self.text_size(c).width
  166.         else
  167.           draw_text(x, y, self.text_size(c).width, 32, c, align)
  168.           x += self.text_size(c).width
  169.         end
  170.       else
  171.         self.font.color = color_coo
  172.         if arg[0].is_a?(Rect)
  173.           draw_text(rect.set(
  174.           rect_x, rect_y, rect_width, rect_height), c, align)
  175.           rect_x += self.text_size(c).width
  176.         else
  177.           draw_text(x, y, width, height, c, align)
  178.           x += self.text_size(c).width
  179.         end
  180.       end
  181.     end
  182.     self.font.size = size_copy
  183.   end
  184.   def draw_color(n)
  185.     return Color.new(255, 255, 255, 255) if n == 0
  186.     return Color.new(128, 128, 255, 255) if n == 1
  187.     return Color.new(255, 128, 128, 255) if n == 2
  188.     return Color.new(128, 255, 128, 255) if n == 3
  189.     return Color.new(128, 255, 255, 255) if n == 4
  190.     return Color.new(255, 128, 255, 255) if n == 5
  191.     return Color.new(255, 255, 128, 255) if n == 6
  192.     return Color.new(192, 192, 192, 255) if n == 7
  193.     return normal_color
  194.   end
  195. end

  196. class Bitmap
  197.   alias blkk_text_old blkk_text
  198.   def blkk_text(*arg)
  199.     if arg[0].is_a?(Rect)
  200.       rect_x = arg[0].x
  201.       rect_y = arg[0].y
  202.       rect_width = arg[0].width
  203.       rect_height = arg[0].height
  204.       rect = Rect.new(rect_x, rect_y, rect_width, rect_height)
  205.       unless arg[1].is_a?(String)
  206.         arg[1] = arg[1].to_s
  207.       end
  208.       y_plus = 0
  209.       arg[1].split("!换行").each{
  210.       |i| blkk_text_old(rect.set(
  211.       rect_x, rect_y + y_plus, rect_width, rect_height),
  212.       i, arg[2] == nil ? 0 : arg[2]) ; y_plus += 32}
  213.     else
  214.       unless arg[4].is_a?(String)
  215.         arg[4] = arg[4].to_s
  216.       end
  217.       y_plus = 0
  218.       arg[4].split("!换行").each{
  219.       |i| blkk_text_old(
  220.       arg[0], arg[1] + y_plus, arg[2], arg[3], i, arg[5] == nil ? 0 : arg[5]) ;
  221.       y_plus += 32}
  222.     end
  223.   end
  224. end
复制代码

作者: a994520851    时间: 2013-12-31 22:47
chd114 发表于 2013-12-31 22:27
我这里没用这种···我用的是这个

谢了!!!
作者: chd114    时间: 2014-1-1 11:17
a994520851 发表于 2013-12-31 22:47
谢了!!!

这个脚本还可以在对话里显示装备、物品的图标




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1