1

私はしばらくアップルスクリプトで遊んでいて、テキスト版のポケモンを作っています。リストから選択し、表示ダイアログを開始する if ステートメントがあります。実行を押すと、「トレーナー戦からは実行できません」と表示されるはずですが、表示ダイアログは開きません。何が悪いのかわかりません。Googleで検索していますが、解決策が見つかりません

ここにコードがあります

set userStarter to "undefined"
set starterHP to "undefined"
set starterLV to 5
set starters to {"Charmander", "Bulbasor", "Squirtle", "Pikachu"}
set userName to "undefined"

on battle(traner)
display dialog traner & " wants to battle!" buttons {"Next"}
set battleMenu to {"Attack", "Bag", "Run"}
set temp to {choose from list battleMenu}
if temp is "Run" then
    display dialog "You cannot run from a trainer battle" buttons {"Ok"}
end if

end battle


display dialog "Welcome to text based Pokemon!" buttons {"Play", "Quit"}
if the button returned of the result is "Play" then
set temp to display dialog "What is your name?" default answer "Ash" buttons {"Submit"}
set userName to text returned of temp
set userStarter to {choose from list starters}

display dialog "Oak: Okay " & userName & " here is your " & userStarter buttons {"Next"}
display dialog "Gary: Hey, lets battle!" buttons {"Battle"}
battle("Gary")


end if

ここにログがあります

tell application "AppleScript Editor"
display dialog "Welcome to text based Pokemon!" buttons {"Play", "Quit"}
    --> {button returned:"Play"}
display dialog "What is your name?" default answer "Ash" buttons {"Submit"}
    --> {text returned:"Ash", button returned:"Submit"}
choose from list {"Charmander", "Bulbasor", "Squirtle", "Pikachu"}
    --> {"Pikachu"}
display dialog "Oak: Okay Ash here is your Pikachu" buttons {"Next"}
    --> {button returned:"Next"}
display dialog "Gary: Hey, lets battle!" buttons {"Battle"}
    --> {button returned:"Battle"}
display dialog "Gary wants to battle!" buttons {"Next"}
    --> {button returned:"Next"}
choose from list {"Attack", "Bag", "Run"}
    --> {"Run"}
end tell
4

1 に答える 1