查看: 3286|回复: 3

[已经解决] 求解,那个支援单张图标的脚本出错了

[复制链接]

哆啦菌

梦石
0
星屑
46
在线时间
795 小时
注册时间
2010-7-24
回帖
3507
发表于 2012-3-18 04:05:28 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 fxwd 于 2012-3-18 10:03 编辑

class RPG::BaseItem
  #--------------------------------------------------------------------------
  # ● 获取图标
  #--------------------------------------------------------------------------
  def get_icon
    self.note.split(/[\r\n]+/).each { |line|
      return $1 if line =~ /\[(?:icon) (\S+)\]/
    }
    return nil
  end
  #--------------------------------------------------------------------------
  # ● 图标 index
  #--------------------------------------------------------------------------
  alias draw_single_icon_icon_index icon_index
  def icon_index
    icon_index = get_icon
    # 如果有指定图标
    if icon_index && icon_index =~ /\d+/ # 如果指定的是數字
      @icon_index = icon_index.to_i # 轉換成數字  #--------------------------------------------------------------------------
  alias draw_single_icon_draw_icon draw_icon
  def draw_icon(icon_index, x, y, enabled = true)
    if icon_index.is_a?(Integer) # 判断是否为整数
    elsif icon_index
      return icon_index # 返回指定图标文件名
    end
    return draw_single_icon_icon_index # 否则返回原本的图标 index
  end
end
class Window_Base
  #--------------------------------------------------------------------------
  # ● 绘制图标

      # 调用原本的绘制图标方法
      draw_single_icon_draw_icon(icon_index, x, y, enabled)
    else # 指定图标时
      bitmap = Cache.load_bitmap("Graphics/Icons/", icon_index)
      rect = Rect.new(0, 0, 24, 24)
      contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
    end
  end
end
这个脚本,用了之后提示CACHE106行出错了,什么意思?
随便看看

醉啸 长风万里

梦石
0
星屑
6512
在线时间
6616 小时
注册时间
2007-12-16
回帖
4301

贵宾

发表于 2012-3-18 09:06:50 | 显示全部楼层
没找到你设置的图标

还在龟速填坑中
回复

使用道具 举报

哆啦菌

梦石
0
星屑
46
在线时间
795 小时
注册时间
2010-7-24
回帖
3507
 楼主| 发表于 2012-3-18 10:03:14 | 显示全部楼层
哦,谢谢,解决了,是因为我把那张图片弄成了PNG格式的了
随便看看
回复

使用道具 举报

天仙

梦石
0
星屑
720
在线时间
184 小时
注册时间
2008-4-15
回帖
4872

贵宾

发表于 2012-3-18 12:50:32 | 显示全部楼层
补充一点,如果文件夹中有两个同名文件(扩充名不同)时,也会出错
VA脚本开工中...
偷窃脚本1.0 - 已完成
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部