コメント

このコメントは、スクリプトを作れるようになろう-03へのコメントです。

コメントの内容

User icon mini 退会したユーザー(投稿日:2012/04/06 21:04/06/12)
case文でもelse使えますよ。
if getVariable("ST") == 1
  s[0] = Array("1,1,1,1,1")
  s[1] = Array("1,0,1,2,1")
  s[2] = Array("1,0,0,0,1")
  s[3] = Array("1,0,1,1,1")
  s[4] = Array("1,1,1,1,1")
  x = 1;y = 1
elsif getVariable("ST") == 2
  s[0] = Array("1,1,1,1,1")
  s[1] = Array("1,0,1,1,0,1")
  s[2] = Array("1,0,0,0,0,2,1")
  s[3] = Array("1,0,1,1,0,1")
  s[4] = Array("1,1,1,1,1")
  x = 1;y = 1
elsif getVariable("ST") == 3
  s[0] = Array("1,1,1,1,1,1,1")
  s[1] = Array("1,0,1,1,0,0,1")
  s[2] = Array("1,0,0,0,0,0,1")
  s[3] = Array("1,0,1,1,0,0,1")
  s[4] = Array("1,0,0,0,1,0,1")
  s[5] = Array("1,1,1,1,1,2,1")
  x = 3;y = 4
elsif getVariable("ST") == 4
  s[0] = Array("1,1,1,1,1,1,1")
  s[1] = Array("1,0,0,1,0,0,1")
  s[2] = Array("1,1,0,0,0,1,1")
  s[3] = Array("1,2,1,1,0,0,1")
  s[4] = Array("1,0,0,0,0,0,1")
  s[5] = Array("1,0,1,0,1,0,1")
  s[5] = Array("1,1,1,1,1,1,1")
  x = 1;y = 1
else
  speak("すべてのステージをクリアしました!\nおめでとうございます!")
  goEnding()
end

#↑↑↑↑↑↑これらは同一↓↓↓↓↓↓

case getVariable("ST")

  when 1
    s[0] = Array("1,1,1,1,1")
    s[1] = Array("1,0,1,2,1")
    s[2] = Array("1,0,0,0,1")
    s[3] = Array("1,0,1,1,1")
    s[4] = Array("1,1,1,1,1")
    x = 1;y = 1

  when 2
    s[0] = Array("1,1,1,1,1")
    s[1] = Array("1,0,1,1,0,1")
    s[2] = Array("1,0,0,0,0,2,1")
    s[3] = Array("1,0,1,1,0,1")
    s[4] = Array("1,1,1,1,1")
    x = 1;y = 1

  when 3
    s[0] = Array("1,1,1,1,1,1,1")
    s[1] = Array("1,0,1,1,0,0,1")
    s[2] = Array("1,0,0,0,0,0,1")
    s[3] = Array("1,0,1,1,0,0,1")
    s[4] = Array("1,0,0,0,1,0,1")
    s[5] = Array("1,1,1,1,1,2,1")
    x = 3;y = 4

  when 4
    s[0] = Array("1,1,1,1,1,1,1")
    s[1] = Array("1,0,0,1,0,0,1")
    s[2] = Array("1,1,0,0,0,1,1")
    s[3] = Array("1,2,1,1,0,0,1")
    s[4] = Array("1,0,0,0,0,0,1")
    s[5] = Array("1,0,1,0,1,0,1")
    s[5] = Array("1,1,1,1,1,1,1")
    x = 1;y = 1

  else
    speak("すべてのステージをクリアしました!\nおめでとうございます!")
    goEnding()
end

コメントの内容(一番最初の投稿)

User icon mini 退会したユーザー(投稿日:2012/04/06 21:04/06/12)
case文でもelse使えますよ。
if getVariable("ST") == 1
  s[0] = Array("1,1,1,1,1")
  s[1] = Array("1,0,1,2,1")
  s[2] = Array("1,0,0,0,1")
  s[3] = Array("1,0,1,1,1")
  s[4] = Array("1,1,1,1,1")
  x = 1;y = 1
elsif getVariable("ST") == 2
  s[0] = Array("1,1,1,1,1")
  s[1] = Array("1,0,1,1,0,1")
  s[2] = Array("1,0,0,0,0,2,1")
  s[3] = Array("1,0,1,1,0,1")
  s[4] = Array("1,1,1,1,1")
  x = 1;y = 1
elsif getVariable("ST") == 3
  s[0] = Array("1,1,1,1,1,1,1")
  s[1] = Array("1,0,1,1,0,0,1")
  s[2] = Array("1,0,0,0,0,0,1")
  s[3] = Array("1,0,1,1,0,0,1")
  s[4] = Array("1,0,0,0,1,0,1")
  s[5] = Array("1,1,1,1,1,2,1")
  x = 3;y = 4
elsif getVariable("ST") == 4
  s[0] = Array("1,1,1,1,1,1,1")
  s[1] = Array("1,0,0,1,0,0,1")
  s[2] = Array("1,1,0,0,0,1,1")
  s[3] = Array("1,2,1,1,0,0,1")
  s[4] = Array("1,0,0,0,0,0,1")
  s[5] = Array("1,0,1,0,1,0,1")
  s[5] = Array("1,1,1,1,1,1,1")
  x = 1;y = 1
else
  speak("すべてのステージをクリアしました!\nおめでとうございます!")
  goEnding()
end

#↑↑↑↑↑↑これらは同一↓↓↓↓↓↓

case getVariable("ST")

  when 1
    s[0] = Array("1,1,1,1,1")
    s[1] = Array("1,0,1,2,1")
    s[2] = Array("1,0,0,0,1")
    s[3] = Array("1,0,1,1,1")
    s[4] = Array("1,1,1,1,1")
    x = 1;y = 1

  when 2
    s[0] = Array("1,1,1,1,1")
    s[1] = Array("1,0,1,1,0,1")
    s[2] = Array("1,0,0,0,0,2,1")
    s[3] = Array("1,0,1,1,0,1")
    s[4] = Array("1,1,1,1,1")
    x = 1;y = 1

  when 3
    s[0] = Array("1,1,1,1,1,1,1")
    s[1] = Array("1,0,1,1,0,0,1")
    s[2] = Array("1,0,0,0,0,0,1")
    s[3] = Array("1,0,1,1,0,0,1")
    s[4] = Array("1,0,0,0,1,0,1")
    s[5] = Array("1,1,1,1,1,2,1")
    x = 3;y = 4

  when 4
    s[0] = Array("1,1,1,1,1,1,1")
    s[1] = Array("1,0,0,1,0,0,1")
    s[2] = Array("1,1,0,0,0,1,1")
    s[3] = Array("1,2,1,1,0,0,1")
    s[4] = Array("1,0,0,0,0,0,1")
    s[5] = Array("1,0,1,0,1,0,1")
    s[5] = Array("1,1,1,1,1,1,1")
    x = 1;y = 1

  else
    speak("すべてのステージをクリアしました!\nおめでとうございます!")
    goEnding()
end