どう考えてもわからない(質問掲示板)
投稿:
闇さん
投稿:2011/12/01 21:55:01(最新:2011/12/01 22:40:01)
h=0
if getVariable("植物")[h][0]==1
i=0
while i<1
case speakWithSelect(4,"土の質を調べる","元肥をまく","種をまく","やめる","まだ何も植えていない\n何をしますか?")
when 0
a=getVariable("植物")[h][5]
b=getVariable("植物")[h][6]
c=getVariable("植物")[h][7]
if getFlag("測定器")
speak("測定中・・・・")
speak("窒素",a,"リン",b,"カリウム",c)
else
speak("土を一口・・・・")
if getFlag("熟練の舌")
s=a
if s>17
a="多すぎ"
elsif s>13
a="多い"
elsif s>9
a="ちょうどいい"
elsif s>5
a="少ない"
else
a="少なすぎ"
end
s=b
if s>17
b="多すぎ"
elsif s>13
b="多い"
elsif s>9
b="ちょうどいい"
elsif s>5
b="少ない"
else
b="少なすぎ"
end
s=c
if s>17
c="多すぎ"
elsif s>13
c="多い"
elsif s>9
c="ちょうどいい"
elsif s>5
c="少ない"
else
c="少なすぎ"
end
else
s=a
if s>11
a="多め"
else
a="少なめ"
end
s=b
if s>11
b="多め"
else
b="少なめ"
end
s=c
if s>11
c="多め"
else
c="少なめ"
end
end
speak("うーん窒素",a,"リン",b,"カリウム",c,"ぐらいかな")
end
when 1
when 2
when 3
i=1
end
else
end
エラー文 緑 3, 16 action : syntax error, コードに文法的な間違いがあります。 line(行): 81
なにがエラーでどこが間違っているかわかりません
コメントする
コメントするには、ログインする必要があります。
コメント一覧
h = 0
if getVariable("植物")[h][0] == 1
i = 0
while i < 1
case speakWithSelect(4,"土の質を調べる","元肥をまく","種をまく","やめる",
"まだ何も植えていない\n何をしますか?")
when 0
a=getVariable("植物")[h][5]
b=getVariable("植物")[h][6]
c=getVariable("植物")[h][7]
if getFlag("測定器")
speak("測定中・・・・")
speak("窒素",a,"リン",b,"カリウム",c)
else
speak("土を一口・・・・")
if getFlag("熟練の舌")
s = a
if s > 17
a = "多すぎ"
elsif s > 13
a = "多い"
elsif s > 9
a = "ちょうどいい"
elsif s > 5
a = "少ない"
else
a = "少なすぎ"
end
s = b
if s > 17
b = "多すぎ"
elsif s > 13
b = "多い"
elsif s > 9
b = "ちょうどいい"
elsif s > 5
b = "少ない"
else
b = "少なすぎ"
end
s = c
if s > 17
c = "多すぎ"
elsif s > 13
c = "多い"
elsif s > 9
c = "ちょうどいい"
elsif s > 5
c = "少ない"
else
c = "少なすぎ"
end
else
s = a
if s > 11
a = "多め"
else
a = "少なめ"
end
s=b
if s > 11
b = "多め"
else
b="少なめ"
end
s=c
if s > 11
c = "多め"
else
c="少なめ"
end
end
speak("うーん窒素",a,"リン",b,"カリウム",c,"ぐらいかな")
end
when 1
when 2
when 3
i=1
end
end#ここにendが無かった
else
end
スペースで整理をすると、endが少ないことが分かります。
こういうエラーが出たら、とりあえずスペースで整理をしてみては?
ここなどを見るのもいいかもしれません。
・if ~ elsif ~ else ~ end
・while ~ end
・case ~ when ~ end
といった辺りのスクリプトはセットになりますので
使用するときに予め記述しておき、
空白も揃えておくとミスが少なくなります。