Project1

标题: 图片显示失败? [打印本页]

作者: 黑米馒头    时间: 2024-2-11 20:12
标题: 图片显示失败?
本帖最后由 黑米馒头 于 2024-2-11 20:55 编辑

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

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








RUBY 代码复制
  1. def draw_actor_zhongzu(actor, x, y)
  2.  
  3.     # 文本内容
  4.     text = "Graphics/Pictures/图片显示/头像/种族/"
  5.     # 种族分歧
  6.     case actor.zhongzu
  7.     # 人族
  8.     when "人"; facename = text + "人"
  9.     # 仙族
  10.     when "仙"; facename = text + "仙"
  11.     # 妖族
  12.     when "妖"; facename = text + "妖"
  13.     # 兽族
  14.     when "兽"; facename = text + "兽"
  15.     # 巫族
  16.     when "巫"; facename = text + "巫"
  17.     # 鬼族
  18.     when "鬼"; facename = text + "鬼"
  19.     end
  20.  
  21.     bitmap = Bitmap.new(facename)
  22.     src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  23.     self.contents.blt(x, y, bitmap, src_rect)
  24.     self.z = 9999
  25.   end


作者: soulsaga    时间: 2024-2-11 23:42
本帖最后由 soulsaga 于 2024-2-12 09:01 编辑

RUBY 代码复制
  1. # 文本内容
  2.     text = "Graphics/Pictures/图片显示/头像/种族/"
  3.     # 种族分歧
  4.     case actor.zhongzu
  5.     # 人族
  6.     when "人"; facename = text + "人"
  7.     # 仙族
  8.     when "仙"; facename = text + "仙"
  9.     # 妖族
  10.     when "妖"; facename = text + "妖"
  11.     # 兽族
  12.     when "兽"; facename = text + "兽"
  13.     # 巫族
  14.     when "巫"; facename = text + "巫"
  15.     # 鬼族
  16.     when "鬼"; facename = text + "鬼"
  17. else
  18. # 无族
  19. facename = text + "无"
  20.     end


不保证还有其他问题
作者: 紫英晓狼1130    时间: 2024-3-26 21:21
excepted 除了;除……外
string 字符串
bitmap = Bitmap.new(facename)




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