スクリプト/汎用関数/辞書を表示する
最終投稿者:
aoihikawa
更新:2013/01/01 18:13:07
辞書を表示する (RPG系用)
(ご自由にご利用ください)
ご意見やご質問などありましたら
こちらのブログ記事まで。
ツイート
(ご自由にご利用ください)
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
# 開始スクリプトに記述する
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
setVariable("dicListFlg",createArray())
setVariable("dicListNam",createArray())
setVariable("dicListMsg",createArray())
#--------- 辞書設定 ----------
#入手していないものを?で表示するかどうか
setFlag("dicQestion",true)
#辞書データ
getVariable("dicListNam")[0] = "にぃみゃん"
getVariable("dicListMsg")[0] = "可愛いしろねこ\nねこふーどGOLDが好物"
getVariable("dicListNam")[1] = "いこさみ"
getVariable("dicListMsg")[1] = "ゼリーのようにやわらかく\nしかくい生き物"
getVariable("dicListNam")[2] = "まじたい"
getVariable("dicListMsg")[2] = "おっさん顔の\n全国的(?)なキャラクター"
#--------- ここまで ----------
#----- 配列検索 -----
def indexOfArray(ar, n, m)
l = getArrayLength(ar)
i = 0; r = -1
if m
i = m
end
while i < l
if ar[i] == n
r = i; i = l
end
i = i + 1
end
return r
end
#----- 辞書表示 -----
def viewDictionary(str)
str_sel = createArray()
no_sel = createArray()
i = 0; ilen = getArrayLength(getVariable("dicListNam")); c = 0
while i < ilen
if getFlag("dicQestion")
if getVariable("dicListFlg")[i]
str_sel[c] = getVariable("dicListNam")[i]
no_sel[c] = i
else
str_sel[c] = "???"
no_sel[c] = (-1)
end
c = c + 1
else
if getVariable("dicListFlg")[i]
str_sel[c] = getVariable("dicListNam")[i]
no_sel[c] = i
c = c + 1
end
end
i = i + 1
end
str_sel[c] = "やめる"
no_sel[c] = (-2)
sel = (-1); len = getArrayLength(str_sel) - 1
while sel < len
sel = speakWithSelectArray(str_sel,str)
if no_sel[sel] == (-2)
speak("閉じました")
elsif no_sel[sel] == (-1)
speak("そのページはまだ見ることができません")
else
speak(getVariable("dicListNam")[no_sel[sel]] + "\n" + getVariable("dicListMsg")[no_sel[sel]])
end
end
end
#----- 辞書開放 -----
def setDictionary(str)
no = indexOfArray(getVariable("dicListNam"),str)
if no > (-1)
getVariable("dicListFlg")[no] = true
end
end
#----- 辞書表示(カスタムメニューの場合) -----
setCustomParamMenuEnable(true)
setCustomParamMenuName("辞書を開く")
def onShowCustomParameter()
viewDictionary("登場キャラクター辞書")
end
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
# イベントなどに記述する
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#----- 辞書開放 -----
setDictionary("にぃみゃん")
setDictionary("まじたい")
#----- 辞書表示(イベントの場合) -----
viewDictionary("登場キャラクター辞書")
ご意見やご質問などありましたら
こちらのブログ記事まで。
コメントする
コメントするには、ログインする必要があります。
コメント一覧
コメントはありません。