Project1
标题:
装备、物品介绍栏支持文本代码和显示
[打印本页]
作者:
well
时间:
2009-8-29 06:25
标题:
装备、物品介绍栏支持文本代码和显示
本帖最后由 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[图标名]应该就够了。只不过我不能确定那个替换是否正确。
正则表达式,唉唉。
def set_text(text, y = nil)
if y != nil
self.y = y
end
self.visible = true
self.contents.clear
self.contents.font.color = normal_color
@text = text.clone
x = y = 0
begin
last_text = @text.clone
@text.gsub!(/\[Vv][([0-9]+)]/) { $game_variables[$1.to_i] }
end until @text == last_text
@text.gsub!(/\[Nn][([0-9]+)]/) do
$game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
end
@text.gsub!(/\\/) { "00" }
@text.gsub!(/\[Cc][([0-9]+)]/) { "01[#{$1}]" }
@text.gsub!(/\[Nn]/) { "02" }
@text.gsub!(/\[Ii][([0-9]+)]/) { "03[#{$1}]" }
@text.gsub!(/\[Ss][([0-9]+)]/) { "04[#{$1}]" }
@text.gsub!(/\[Ww][([0-9]+)]/) { "05[#{$1}]" }
@text.gsub!(/\[Aa][([0-9]+)]/) { "06[#{$1}]" }
@text.gsub!(/\[Pp][(.+?)]/) { "07[#{$1}]" }
while ((c = @text.slice!(/./m)) != nil)
if c == "00"
c = "\"
end
if c == "01" #文本颜色
@text.sub!(/[([0-9]+)]/, "")
color = $1.to_i
if color >= 0 and color <= 7
self.contents.font.color = text_color(color)
end
next
end
if c == "02" #换行
y += 1
x = 0
next
end
if c == "03" # "\I""\i"物品图标
@text.sub!(/[([0-9]+)]/, "")
icon = RPG::Cache.icon($data_items[$1.to_i].icon_name)
self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
@x+=24
next
end
if c == "04" # "\S""\s"技能图标
@text.sub!(/[([0-9]+)]/, "")
icon = RPG::Cache.icon($data_skills[$1.to_i].icon_name)
self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
@x+=24
next
end
if c == "05" # "\W""\w"武器图标
@text.sub!(/[([0-9]+)]/, "")
icon = RPG::Cache.icon($data_weapons[$1.to_i].icon_name)
self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
@x+=24
next
end
if c == "06" # "\A""\a"防具图标
@text.sub!(/[([0-9]+)]/, "")
icon = RPG::Cache.icon($data_armors[$1.to_i].icon_name)
self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
@x+=24
next
end
if c == "07" # "\P""\p"任意图标
@text.sub!(/[([0-9]+)]/, "")
icon = RPG::Cache.icon("#{$1}")
self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
@x+=24
next
end
self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
x += self.contents.text_size(c).width
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1