アイテムを預ける実験(質問掲示板)
投稿:
rumina
投稿:2015/02/17 20:29:17(最新:2015/02/18 17:04:18)
rumina
投稿:2015/02/17 20:29:17(最新:2015/02/18 17:04:18)
アイテムを預けて、それを引き出すことができるようにするために
実際にやってみたのですが、完成してテストプレーをしたら、
変な感じになりました。エラーは出ていません。
言葉で説明するのが、難しいので、テストプレーを願いします。
URL↓
http://rmake.jp/games/27805/limited_play
ID↓
souko
パスワード↓
souko
スクリプトはこんな感じでやっています。
ツイート
実際にやってみたのですが、完成してテストプレーをしたら、
変な感じになりました。エラーは出ていません。
言葉で説明するのが、難しいので、テストプレーを願いします。
URL↓
http://rmake.jp/games/27805/limited_play
ID↓
souko
パスワード↓
souko
スクリプトはこんな感じでやっています。
case speakWithSelect(3,"預ける","引き出す","今はいい", #選択肢1-1 ~ 3 : 3は、イベント終了
"アイテム預かるかい?")
when 0 #選択肢1-1の場合
#預ける
case speakWithSelect(3,"水晶の実","太陽の実","やっぱりいい", #選択肢2-1 ~ 3 : 3は、イベント終了
"何を預けるんだい?")
when 0 #選択肢2-1の場合 水晶の実を預ける
case speakWithSelect(3,"1個","5個","10個", #選択肢3-1 ~ 3
"何個預けるんだい?")
when 0 #選択肢3-1の場合 1個預ける
if getVariable("suisixyou") >= 1
a = getItemIndexWithId(19062)
removeItemWithIndex(a)
setVariable("suisixyou", getVariable("suisixyou") - 1)
setVariable("soukosuisixyou", getVariable("soukosuisixyou") + 1)
speak("しっかり預かったよ。")
elsif getVariable("suisixyou") == 0
speak("水晶の実が足りないよ。")
else getVariable("suisixyou") <= 0
speak("水晶の実が足りないよ。")
end
when 1 #選択肢3-2の場合 5個預ける
if getVariable("suisixyou") >= 5
b = getItemIndexWithId(19062)
removeItemWithIndex(b)
c = getItemIndexWithId(19062)
removeItemWithIndex(c)
d = getItemIndexWithId(19062)
removeItemWithIndex(d)
e = getItemIndexWithId(19062)
removeItemWithIndex(e)
f = getItemIndexWithId(19062)
removeItemWithIndex(f)
setVariable("suisixyou", getVariable("suisixyou") - 5)
setVariable("soukosuisixyou", getVariable("soukosuisixyou") + 5)
speak("しっかり預かったよ。")
elsif getVariable("suisixyou") == 0
speak("水晶の実が足りないよ。")
else getVariable("suisixyou") <= 0
speak("水晶の実が足りないよ。")
end
when 2 #選択肢3-3の場合 10個預ける
if getVariable("suisixyou") >= 10
g = getItemIndexWithId(19062)
removeItemWithIndex(g)
h = getItemIndexWithId(19062)
removeItemWithIndex(h)
i = getItemIndexWithId(19062)
removeItemWithIndex(i)
j = getItemIndexWithId(19062)
removeItemWithIndex(j)
k = getItemIndexWithId(19062)
removeItemWithIndex(k)
l = getItemIndexWithId(19062)
removeItemWithIndex(l)
m = getItemIndexWithId(19062)
removeItemWithIndex(m)
n = getItemIndexWithId(19062)
removeItemWithIndex(n)
o = getItemIndexWithId(19062)
removeItemWithIndex(o)
p = getItemIndexWithId(19062)
removeItemWithIndex(p)
setVariable("suisixyou", getVariable("suisixyou") - 10)
setVariable("soukosuisixyou", getVariable("soukosuisixyou") + 10)
speak("しっかり預かったよ。")
elsif getVariable("suisixyou") == 0
speak("水晶の実が足りないよ。")
else getVariable("suisixyou") <= 0
speak("水晶の実が足りないよ。")
end
when 1 #選択肢2-2の場合 太陽の実を預ける
case speakWithSelect(3,"1個","5個","10個", #選択肢4-1 ~ 3
"何個預けるんだい?")
when 0 #選択肢4-1の場合 1個預ける
if getVariable("taiyou") >= 1
q = getItemIndexWithId(19289)
removeItemWithIndex(q)
setVariable("taiyou", getVariable("taiyou") - 1)
setVariable("soukotaiyou", getVariable("soukotaiyou") + 1)
elsif getVariable("taiyou") == 0
speak("太陽の実が足りないよ。")
else getVariable("taiyou") <= 0
speak("太陽の実が足りないよ。")
end
when 1 #選択肢4-2の場合 5個預ける
if getVariable("taiyou") >= 5
r = getItemIndexWithId(19289)
removeItemWithIndex(r)
s = getItemIndexWithId(19289)
removeItemWithIndex(s)
t = getItemIndexWithId(19289)
removeItemWithIndex(t)
u = getItemIndexWithId(19289)
removeItemWithIndex(u)
v = getItemIndexWithId(19289)
removeItemWithIndex(v)
setVariable("taiyou", getVariable("taiyou") - 5)
setVariable("soukotaiyou", getVariable("soukotaiyou") + 5)
speak("しっかり預かったよ。")
elsif getVariable("taiyou") == 0
speak("太陽の実が足りないよ。")
else getVariable("taiyou") <= 0
speak("太陽の実が足りないよ。")
end
when 2 #選択肢4-3の場合 10個預ける
if getVariable("taiyou") >= 10
g = getItemIndexWithId(19062)
removeItemWithIndex(g)
h = getItemIndexWithId(19062)
removeItemWithIndex(h)
i = getItemIndexWithId(19062)
removeItemWithIndex(i)
j = getItemIndexWithId(19062)
removeItemWithIndex(j)
k = getItemIndexWithId(19062)
removeItemWithIndex(k)
l = getItemIndexWithId(19062)
removeItemWithIndex(l)
m = getItemIndexWithId(19062)
removeItemWithIndex(m)
n = getItemIndexWithId(19062)
removeItemWithIndex(n)
o = getItemIndexWithId(19062)
removeItemWithIndex(o)
p = getItemIndexWithId(19062)
removeItemWithIndex(p)
setVariable("taiyou", getVariable("taiyou") - 10)
setVariable("soukotaiyou", getVariable("soukotaiyou") + 10)
elsif getVariable("taiyou") == 0
speak("太陽の実が足りないよ。")
else getVariable("taiyou") <= 0
speak("太陽の実が足りないよ。")
end
end
コメントする
コメントするには、ログインする必要があります。
コメント一覧
太陽の実を預けるところから、
endがひとつ多くなっていますね。
水晶の実を引き出す選択肢と、太陽の実を引き出す選択肢にも
同じミスがあります。
endがひとつ多くなっていますね。
when 2 #選択肢4-3の場合 10個預ける
if getVariable("taiyou") >= 10
g = getItemIndexWithId(19062)
removeItemWithIndex(g)
h = getItemIndexWithId(19062)
removeItemWithIndex(h)
i = getItemIndexWithId(19062)
removeItemWithIndex(i)
j = getItemIndexWithId(19062)
removeItemWithIndex(j)
k = getItemIndexWithId(19062)
removeItemWithIndex(k)
l = getItemIndexWithId(19062)
removeItemWithIndex(l)
m = getItemIndexWithId(19062)
removeItemWithIndex(m)
n = getItemIndexWithId(19062)
removeItemWithIndex(n)
o = getItemIndexWithId(19062)
removeItemWithIndex(o)
p = getItemIndexWithId(19062)
removeItemWithIndex(p)
setVariable("taiyou", getVariable("taiyou") - 10)
setVariable("soukotaiyou", getVariable("soukotaiyou") + 10)
elsif getVariable("taiyou") == 0
speak("太陽の実が足りないよ。")
else getVariable("taiyou") <= 0
speak("太陽の実が足りないよ。")
end #ここのendがひとつ多いです。
when 2 #選択肢2-3 イベント終了
end
case speakWithSelect(2,"水晶の実","太陽の実", #選択肢5-1 ~ 2
"何を引き出しますか?")
水晶の実を引き出す選択肢と、太陽の実を引き出す選択肢にも
同じミスがあります。
endを消したら、253行目にエラーが出ました。
そこのendが多いのかと思い、消しても治りません。
253行の近くを書きます。
自分でも頑張ってみますが、わかるようであれば、
教えてくれると幸いです。
そこのendが多いのかと思い、消しても治りません。
253行の近くを書きます。
自分でも頑張ってみますが、わかるようであれば、
教えてくれると幸いです。
when 2 #選択肢7-3
if getVariable("soukotaiyou") >= 10
giveItem(19289)
giveItem(19289)
giveItem(19289)
giveItem(19289)
giveItem(19289)
giveItem(19289)
giveItem(19289)
giveItem(19289)
giveItem(19289)
giveItem(19289)
speak("はい、しっかり引き出したよ。")
setVariable("soukotaiyou", getVariable("soukotaiyou") - 10)
setVariable("taiyou", getVariable("taiyou") + 10)
elsif getVariable("soukotaiyou") == 0
speak("倉庫にある太陽の実が足りないよ。")
else getVariable("soukotaiyou") <= 0
speak("倉庫にある太陽の実が足りないよ。")
#太陽の実↑
end
when 2 #選択肢1-3 イベント終了
#やめる
end
end
end#ここが問題。
上のスクリプトの続きです。
when 2 #選択肢2-3 イベント終了
end
when 1 #選択肢1-2
case speakWithSelect(2,"水晶の実","太陽の実", #選択肢5-1 ~ 2
"何を引き出しますか?")
when 0 #選択肢5-1
case speakWithSelect(3,"1個","5個","10個", #選択肢6-1 ~ 3
"何個引き出しますか?")
when 0 #選択肢6-1
if getVariable("soukosuisixyou") >= 1
giveItem(19062)
speak("はい、しっかり引き出したよ。")
setVariable("soukosuisixyou", getVariable("soukosuisixyou") - 1)
setVariable("suisixyou", getVariable("suisixyou") + 1)
elsif getVariable("soukosuisixyou") == 0
speak("倉庫に水晶の実はないよ。")
else getVariable("soukosuisixyou") <= 0
speak("倉庫に水晶の実はないよ。")
end
when 1 #選択肢6-2
if getVariable("soukosuisixyou") >= 5
giveItem(19062)
giveItem(19062)
giveItem(19062)
giveItem(19062)
giveItem(19062)
speak("はい、しっかり引き出したよ。")
setVariable("soukosuisixyou", getVariable("soukosuisixyou") - 5)
setVariable("suisixyou", getVariable("suisixyou") + 5)
elsif getVariable("soukosuisixyou") == 0
speak("倉庫にある水晶の実が足りないよ。")
else getVariable("soukosuisixyou") <= 0
speak("倉庫にある水晶の実が足りないよ。")
end
when 2 #選択肢6-3
if getVariable("soukosuisixyou") >= 10
giveItem(19062)
giveItem(19062)
giveItem(19062)
giveItem(19062)
giveItem(19062)
giveItem(19062)
giveItem(19062)
giveItem(19062)
giveItem(19062)
giveItem(19062)
speak("はい、しっかり引き出したよ。")
setVariable("soukosuisixyou", getVariable("soukosuisixyou") - 10)
setVariable("suisixyou", getVariable("suisixyou") + 10)
elsif getVariable("soukosuisixyou") == 0
speak("倉庫にある水晶の実が足りないよ。")
else getVariable("soukosuisixyou") <= 0
speak("倉庫にある水晶の実が足りないよ。")
end
end
#水晶引き出し↑
when 1 #選択肢5-2
#太陽の実↓
case speakWithSelect(3,"1個","5個","10個", #選択肢7-3
"何個引き出しますか?")
when 0 #選択肢7-1
if getVariable("soukotaiyou") >= 1
giveItem(19289)
speak("はい、しっかり引き出したよ。")
setVariable("soukotaiyou", getVariable("soukotaiyou") - 1)
setVariable("taiyou", getVariable("taiyou") + 1)
elsif getVariable("soukotaiyou") == 0
speak("倉庫に太陽の実はないよ。")
else getVariable("soukotaiyou") <= 0
speak("倉庫に太陽の実はないよ。")
end
when 1 #選択肢7-2
if getVariable("soukotaiyou") >= 5
giveItem(19289)
giveItem(19289)
giveItem(19289)
giveItem(19289)
giveItem(19289)
speak("はい、しっかり引き出したよ。")
setVariable("soukotaiyou", getVariable("soukotaiyou") - 5)
setVariable("taiyou", getVariable("taiyou") + 5)
elsif getVariable("soukotaiyou") == 0
speak("倉庫にある太陽の実が足りないよ。")
else getVariable("soukotaiyou") <= 0
speak("倉庫にある太陽の実が足りないよ。")
end
when 2 #選択肢7-3
if getVariable("soukotaiyou") >= 10
giveItem(19289)
giveItem(19289)
giveItem(19289)
giveItem(19289)
giveItem(19289)
giveItem(19289)
giveItem(19289)
giveItem(19289)
giveItem(19289)
giveItem(19289)
speak("はい、しっかり引き出したよ。")
setVariable("soukotaiyou", getVariable("soukotaiyou") - 10)
setVariable("taiyou", getVariable("taiyou") + 10)
elsif getVariable("soukotaiyou") == 0
speak("倉庫にある太陽の実が足りないよ。")
else getVariable("soukotaiyou") <= 0
speak("倉庫にある太陽の実が足りないよ。")
end
#太陽の実↑
end
when 2 #選択肢1-3 イベント終了
#やめる
end
end
end
正しくは最初のendがひとつ抜けていましたね。
2つ並んでいるendは正しいです。失礼いたしました。
最後のendは1つで大丈夫ですよ。
case speakWithSelect(3,"預ける","引き出す","今はいい", "アイテム預かるかい?") when 0 #選択肢1-1の場合 case speakWithSelect(3,"水晶の実","太陽の実","やっぱりいい", "何を預けるんだい?") when 0 #選択肢2-1の場合 case speakWithSelect(3,"1個","5個","10個", #選択肢3-1 ~ 3 "何個預けるんだい?") when 0 #選択肢3-1の場合 1個預ける if elsif getVariable("suisixyou") == 0 else getVariable("suisixyou") <= 0 end when 1 #選択肢3-2の場合 if elsif getVariable("suisixyou") == 0 else getVariable("suisixyou") <= 0 end when 2 #選択肢3-3の場合 if elsif getVariable("suisixyou") == 0 else getVariable("suisixyou") <= 0 end end #←ここにendを追加 when 1 #選択肢2-2の場合 case speakWithSelect(3,"1個","5個","10個", "何個預けるんだい?") when 0 #選択肢4-1の場合 1個預ける if elsif getVariable("suisixyou") == 0 else getVariable("suisixyou") <= 0 end when 1 #選択肢4-2の場合 if elsif getVariable("suisixyou") == 0 else getVariable("suisixyou") <= 0 end when 2 #選択肢4-3の場合 if elsif getVariable("suisixyou") == 0 else getVariable("suisixyou") <= 0 end end #←ここにendを追加 when 2 #選択肢2-3の場合 end when 1 #選択肢1-2 #上と同じ when 2 #選択肢1-3 endスクリプトの実行上、
処理の括りとして、endを必要とするパターン
「if文」「while文」「case文」の基本記述方を
纏めた記事がありますので、
こちらもご一読頂けましたら何よりです
if文、while文
case文
スクリプト言語一覧
すべて正常に動きました!