リストについて(質問掲示板)
投稿:
闇さん
投稿:2012/04/30 15:18:30(最新:2012/04/30 22:32:30)
これを参考にして
アイテム名が変化してそれに応じ説明も変化するスクリプトを
開始スクリプトに書いたらエラー文無しで
開始されませんでした
何が間違っているのかさっぱり分かりません
ツイート
アイテム名が変化してそれに応じ説明も変化するスクリプトを
開始スクリプトに書いたらエラー文無しで
開始されませんでした
setVariable("項目",createArray())
i = 0
z = 0
while i < 10
getVariable("項目")[i] = createArray()
i = i + 1
getVariable("項目")[i][z] = "未所持"
end
setVariable("説明文",createArray())
setVariable("説明文",createArray())
i = 0
z = 0
while i < 10
getVariable("説明文")[i] = createArray()
i = i + 1
z = 0
while z < 4
getVariable("説明文")[i][z] = createArray()
z = z + 1
end
end
getVariable("説明文")[0][0] = "鍵のかかった部屋を開ける鍵"#謎の鍵
getVariable("説明文")[0][1] = "一部の部屋と宝箱を開ける鍵"#金の鍵
getVariable("説明文")[0][2] = "全ての部屋と宝箱を開ける鍵"#マスタ-キー
#~~~~~~中略~~~~~~~~
setCustomParamMenuEnable(true)
setCustomParamMenuName("キーアイテム")
def onShowCustomParameter()
i = 0
while i < 1
case speakWithSelect
(11,
getVariable("項目")[0],
getVariable("項目")[1],
getVariable("項目")[2],
getVariable("項目")[3],
getVariable("項目")[4],
getVariable("項目")[5],
getVariable("項目")[6],
getVariable("項目")[7],
getVariable("項目")[8],
getVariable("項目")[9],
"やめる",
"参照したいアイテムを選んでください")
when 0
n = 0
if getVariable("項目")[n]=="謎の鍵"
m=0
elsif getVariable("項目")[n]=="金の鍵"
m=1
elsif getVariable("項目")[n]=="マスターキー"
m=2
end
#~~~~~~中略~~~~~~~~
when 10
i = 1
end
if i == 0
if getVariable("項目")[n] == "未所持"
speak("持っていないため詳しい説明はありません")
else
speak(getVariable("説明文")[n][m])
end
end
end
end
何が間違っているのかさっぱり分かりません
コメントする
コメントするには、ログインする必要があります。
"項目"[0][?]には何も入ってない事になります
同様の理由で、前半のwhile文はおそらく全滅
後半、case speakWithSelect()としているけれど
この場合何番目を選ぶか全くワカラナイ
すると0~9番目全てに於いて「選んだ物が○○だった場合はどう表示する」というのを、アイテムの数だけ分岐を用意しないとダメです
つまり同じ事を10回も書く…非効率なんですね
しかしその後を見ると
n番目を選んだらどーする、みたいな書き方をしてるので
尚、以下の形ならエラーは出ません
setVariable("項目",createArray()) i=0;z=0 while i<10 getVariable("項目")[i]=createArray() getVariable("項目")[i][z]="未所持" i=i+1 end setVariable("説明文",createArray()) i=0 while i<10 getVariable("説明文")[i]=createArray() z=0 while z<4 getVariable("説明文")[i][z]=createArray() z=z+1 end i=i+1 end getVariable("説明文")[0][0]="鍵のかかった部屋を開ける鍵" #謎の鍵 getVariable("説明文")[0][1]="一部の部屋と宝箱を開ける鍵" #金の鍵 getVariable("説明文")[0][2]="全ての部屋と宝箱を開ける鍵" #マスタ-キー setCustomParamMenuEnable(true) setCustomParamMenuName("キーアイテム") def onShowCustomParameter() i = 0 while i<1 case speakWithSelect(11, getVariable("項目")[0],getVariable("項目")[1],getVariable("項目")[2], getVariable("項目")[3],getVariable("項目")[4],getVariable("項目")[5], getVariable("項目")[6],getVariable("項目")[7],getVariable("項目")[8], getVariable("項目")[9],"やめる", "参照したいアイテムを選んでください") when 10 i=1 end end end #onshowCustomParameter()終回答ありがとうございます