Hey Leute^^

Ich hab ein kleines Script für eine HP-Leiste geschrieben, aber sobald das Script aufgerufen wird sagt er:
Code:
Line 119: NoMethodError occurred.
Undefined Method 'show' for nil:NilClass
Zwei Dinge die mich daran wundern sind, dass ich genau den selben Befehl schon einige Male vor Zeile 119 im script stehen hab und zweitens dass er diese Fehlermeldung sogar ausgibt wenn er (durch eine if-Bedingung) diese Zeile eigentlich überspringen sollte...

Hier mal das Script mit Zeile 119 unterstrichen:
Code:
module Numberpic
  def Numberpic.show(x)
    if x == 1
      a1 = 3
      a2 = 4
      a3 = 7
      b = 22
      x1 = 39
      x2 = 52
      y = 427
    end
    if x == 2
      a1 = 5
      a2 = 6
      a3 = 7
      b = 26
      x1 = 73
      x2 = 86
      y = 427
      q = 7
      while q <= 18
        $game_screen.pictures[q].erase
        q += 1
      end
    end
    if x == 3
      a1 = 19
      a2 = 20
      a3 = 23
      b = 23
      x1 = 39
      x2 = 52
      y = 445
    end
    if x == 4
      a1 = 21
      a2 = 22
      a3 = 23
      b = 27
      x1 = 73
      x2 = 86
      y = 445
      q = 23
      while q <= 46
        $game_screen.pictures[q].erase
        q += 1
      end
    end
    if x == 5
      a1 = 47
      a2 = 48
      a3 = 51
      b = 24
      x1 = 39
      x2 = 52
      y = 463
    end
    if x == 6
      a1 = 49
      a2 = 50
      a3 = 51
      b = 28
      x1 = 73
      x2 = 86
      y = 463
      q = 51
      while q <= 62
        $game_screen.pictures[q].erase
        q += 1
      end
    end
    c = $game_variables[b]
    d = 0
    while c >= 10
      c -= 10
      d += 1
    end
    $game_screen.pictures[a1].show("Zahl_" + d.to_s, 0, x1, y, 100, 100, 255, 0)
    $game_screen.pictures[a2].show("Zahl_" + c.to_s, 0, x2, y, 100, 100, 255, 0)
    e = $game_variables[b]
    f = 0
    g = 0
    if x = 2 or 4 or 6
      while e >= 1
        $game_screen.pictures[a3 + g].show("Point Empty", 0, 104 + f, y + 1, 100, 100, 255, 0)
        g += 1
        f += 6
        e -= 1
      end
    end
    if x = 1 or 3 or 5
      q = $game_variables[b + 4]
      q =- $game_variables[b]
      if e >= 5
        while e >= 1
          $game_screen.pictures[a3 + g].show("Point Full", 0, 104 + f, y + 1, 100, 100, 255, 0)
          g += 1
          f += 6
          e -= 1
        end
      end
      if e >= 3
        while e >= 1
          $game_screen.pictures[a3 + g].show("Point Low", 0, 104 + f, y + 1, 100, 100, 255, 0)
          g += 1
          f += 6
          e -= 1
        end
      end
      if e >= 1
        while e >= 1
          $game_screen.pictures[a3 + g].show("Point Critical", 0, 104 + f, y + 1, 100, 100, 255, 0)
          g += 1
          f += 6
          e -= 1
        end
      end
      while q <= 1
        $game_screen.pictures[a3 + g].show("Point Empty", 0, 104 + f, y + 1, 100, 100, 255, 0)
        g += 1
        f += 6
        q -= 1
      end
    end
  end
  
end
btw, mag sein dass der code stellenweise etwas umständlich is, bin halt noch nicht so sehr geübt mit Ruby