查看: 1604|回复: 2

[有事请教] 图片显示失败?

[复制链接]
梦石
0
星屑
3850
在线时间
1899 小时
注册时间
2010-6-19
回帖
917
发表于 2024-2-11 20:12:52 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 黑米馒头 于 2024-2-11 20:55 编辑

在游戏里设置 种族,但是当游戏保存之后,在数据库重新添加一个角色,然后读档的时候就会出现脚本错误,因为新添加的角色没有种族,导致下面图片也显示不出来了

下面这段脚本怎么会跳出脚本错误,看不懂?


1.png


2.png


[pre lang="ruby"]  def draw_actor_zhongzu(actor, x, y)
   
    # 文本内容
    text = "Graphics/Pictures/图片显示/头像/种族/"
    # 种族分歧
    case actor.zhongzu
    # 人族
    when "人"; facename = text + "人"
    # 仙族
    when "仙"; facename = text + "仙"
    # 妖族
    when "妖"; facename = text + "妖"
    # 兽族
    when "兽"; facename = text + "兽"
    # 巫族
    when "巫"; facename = text + "巫"
    # 鬼族
    when "鬼"; facename = text + "鬼"
    end
   
    bitmap = Bitmap.new(facename)
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(x, y, bitmap, src_rect)
    self.z = 9999
  end[/pre]
梦石
0
星屑
39236
在线时间
11155 小时
注册时间
2009-3-15
回帖
4768
发表于 2024-2-11 23:42:49 | 显示全部楼层
本帖最后由 soulsaga 于 2024-2-12 09:01 编辑

[pre lang="ruby"]# 文本内容
    text = "Graphics/Pictures/图片显示/头像/种族/"
    # 种族分歧
    case actor.zhongzu
    # 人族
    when "人"; facename = text + "人"
    # 仙族
    when "仙"; facename = text + "仙"
    # 妖族
    when "妖"; facename = text + "妖"
    # 兽族
    when "兽"; facename = text + "兽"
    # 巫族
    when "巫"; facename = text + "巫"
    # 鬼族
    when "鬼"; facename = text + "鬼"
else
# 无族
facename = text + "无"
    end[/pre]

不保证还有其他问题
回复

使用道具 举报

梦石
0
星屑
3905
在线时间
1972 小时
注册时间
2013-1-3
回帖
9146
发表于 2024-3-26 21:21:43 | 显示全部楼层
excepted 除了;除……外
string 字符串
bitmap = Bitmap.new(facename)
《宿愿·寻剑篇》正式版已经发布!快去看看!点击进入论坛发布贴
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部