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

Project1

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

[讨论] 装备、物品介绍栏支持文本代码和显示

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
120
在线时间
73 小时
注册时间
2008-7-9
帖子
234
跳转到指定楼层
1
发表于 2009-8-29 06:25:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 well 于 2009-8-29 06:32 编辑

物品武器介绍显示变量贴10# 越前リョーマ
http://rpg.blue/web/index.php?doc-view-3268
http://rpg.blue/web/index.php?doc-view-3068
高级help脚本和苹果梨的对话加强脚本整合一下大概就可以。就是重定义并扩展了set_text
那些对话脚本里华丽的效果还有很多可以移植的样子
其实有p[图标名]应该就够了。只不过我不能确定那个替换是否正确。
正则表达式,唉唉。

  1.   def set_text(text, y = nil)
  2.     if y != nil
  3.       self.y = y
  4.     end
  5.     self.visible = true
  6.     self.contents.clear
  7.     self.contents.font.color = normal_color
  8.     @text = text.clone
  9.     x = y = 0
  10.     begin
  11.       last_text = @text.clone
  12.       @text.gsub!(/\[Vv][([0-9]+)]/) { $game_variables[$1.to_i] }
  13.     end until @text == last_text
  14.     @text.gsub!(/\[Nn][([0-9]+)]/) do
  15.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  16.     end
  17.     @text.gsub!(/\\/) { "00" }
  18.     @text.gsub!(/\[Cc][([0-9]+)]/) { "01[#{$1}]" }
  19.     @text.gsub!(/\[Nn]/) { "02" }
  20.     @text.gsub!(/\[Ii][([0-9]+)]/) { "03[#{$1}]" }
  21.     @text.gsub!(/\[Ss][([0-9]+)]/) { "04[#{$1}]" }
  22.     @text.gsub!(/\[Ww][([0-9]+)]/) { "05[#{$1}]" }
  23.     @text.gsub!(/\[Aa][([0-9]+)]/) { "06[#{$1}]" }
  24.     @text.gsub!(/\[Pp][(.+?)]/) { "07[#{$1}]" }
  25.     while ((c = @text.slice!(/./m)) != nil)
  26.       if c == "00"       
  27.         c = "\"
  28.       end
  29.       if c == "01"        #文本颜色
  30.         @text.sub!(/[([0-9]+)]/, "")
  31.         color = $1.to_i
  32.         if color >= 0 and color <= 7
  33.           self.contents.font.color = text_color(color)
  34.         end
  35.         next
  36.       end
  37.       if c == "02"        #换行
  38.         y += 1
  39.         x = 0
  40.         next
  41.       end
  42.       if c == "03"        # "\I""\i"物品图标
  43.         @text.sub!(/[([0-9]+)]/, "")
  44.         icon = RPG::Cache.icon($data_items[$1.to_i].icon_name)
  45.         self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  46.         @x+=24
  47.         next
  48.       end      
  49.       if c == "04"        # "\S""\s"技能图标
  50.         @text.sub!(/[([0-9]+)]/, "")
  51.         icon = RPG::Cache.icon($data_skills[$1.to_i].icon_name)
  52.         self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  53.         @x+=24
  54.         next
  55.       end     
  56.       if c == "05"         # "\W""\w"武器图标
  57.         @text.sub!(/[([0-9]+)]/, "")
  58.         icon = RPG::Cache.icon($data_weapons[$1.to_i].icon_name)
  59.         self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  60.         @x+=24
  61.         next
  62.       end      
  63.       if c == "06"        # "\A""\a"防具图标
  64.         @text.sub!(/[([0-9]+)]/, "")
  65.         icon = RPG::Cache.icon($data_armors[$1.to_i].icon_name)
  66.         self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  67.         @x+=24
  68.         next
  69.       end
  70.       if c == "07"        # "\P""\p"任意图标
  71.         @text.sub!(/[([0-9]+)]/, "")
  72.         icon = RPG::Cache.icon("#{$1}")
  73.         self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  74.         @x+=24
  75.         next
  76.       end
  77.       self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
  78.       x += self.contents.text_size(c).width
  79.     end
  80.   end  
复制代码
血瞳睨世

也来玩一下养小龙吧
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-4-29 07:19

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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