Project1

标题: 自编脚本出错 [打印本页]

作者: qth830818    时间: 2012-2-4 16:37
标题: 自编脚本出错
我刚刚写了一个勋章的脚本,插在菜单中用.
结果我发现无论当变量49等于多少时
勋章显示的都是变量49等于1时的图标
请问有人能教一下吗?谢谢了
一下是脚本
def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(10, 75, 120, 32, "勋章")
  if $game_variables[49] =1
    bitmap=Bitmap.new("Graphics/XZ/1")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =2
    bitmap=Bitmap.new("Graphics/XZ/2")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =3
    bitmap=Bitmap.new("Graphics/XZ/3")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =4
    bitmap=Bitmap.new("Graphics/XZ/4")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =5
    bitmap=Bitmap.new("Graphics/XZ/5")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =6
    bitmap=Bitmap.new("Graphics/XZ/6")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =7
    bitmap=Bitmap.new("Graphics/XZ/7")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =8
    bitmap=Bitmap.new("Graphics/XZ/8")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =9
    bitmap=Bitmap.new("Graphics/XZ/9")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =10
    bitmap=Bitmap.new("Graphics/XZ/10")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =11
    bitmap=Bitmap.new("Graphics/XZ/11")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =12
    bitmap=Bitmap.new("Graphics/XZ/12")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =13
    bitmap=Bitmap.new("Graphics/XZ/13")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =14
    bitmap=Bitmap.new("Graphics/XZ/14")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =15
    bitmap=Bitmap.new("Graphics/XZ/15")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =16
    bitmap=Bitmap.new("Graphics/XZ/16")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =17
    bitmap=Bitmap.new("Graphics/XZ/17")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =18
    bitmap=Bitmap.new("Graphics/XZ/18")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =19
    bitmap=Bitmap.new("Graphics/XZ/19")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =20
    bitmap=Bitmap.new("Graphics/XZ/20")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    elsif $game_variables[49] =21
    bitmap=Bitmap.new("Graphics/XZ/21")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    else
    bitmap=Bitmap.new("Graphics/XZ/21")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(50, 75, bitmap, src_rect)
    end

作者: 后知后觉    时间: 2012-2-4 21:21
一个 = 号是赋值.
两个 = 号是判断.




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