このコードは、ポケモンバトルゲームプレイのより単純なバージョンに似ています。私は攻撃をコード化しました。私は徹底的にテストしましたが、ユーザーが攻撃を確認したときにエラーメッセージ(この時点ではGotoは予期しなかったものです)が見つかりました。警告!!コードは96行です。最後に、私は問題のセクションを置くので、この最初の巨大なチャンクをスキップすることができます。この時点でGotoは予期しなかったバッチウィンドウ7のスターター
@echo off
Set H1=20
Set A1=8
Set D1=6
Set S1=5
Set H2=14
Set A2=5
Set D2=4
Set S2=8
:Begin
CLS
Echo Bulbasur
Echo %H2%/14 /\
Echo (__) ___
Echo l __lo.ol
Echo l_\ l_\"
Echo.
Echo _
Echo */\
Echo \\l )
Echo \\__l Charmander
Echo %H1%/20
Echo -Attack -Capture
Echo -Item -Run
Set /p Move=Action?
If %move%==Attack goto Attack
If %move%==Catpure goto capture
If %move%==Item goto Item
If %move%==Run Goto Run
Echo I'm sorry, Charmander can't do that.
Pause
goto Begin
:Attack
ClS
Echo Attacks
Echo 1)Tackle
Echo 2)Growl
Echo 3)Ember
Echo 4)Scratch
Set /p attack=Which one?
If %attack%==Tackle goto Tackle
If %attack%==1 goto Tackle
If %attack%==Growl Goto Growl
If %attack%==2 goto Growl
If %attack%==Ember goto Ember
If %attack%==3 goto Ember
If %attack%==Scratch goto Scratch
If %attack%==4 goto Scratch
If %attack%==Cancel goto Begin
Echo I didn't get that
Goto Attack
:Tackle
CLS
Echo Tackle Hits The opponent where it hurts. EVERYWHERE.
Echo Do you want to?
set /p accept=Yes/No?
If %acccept%==Yes goto Combat
If %acccept%==No goto Begin
Echo I didn't get that.
goto Tackle
:Growl
CLS
Echo Growl lowers the opponents attack.
Echo Do you want to?
set /p accept=Yes/No?
If %acccept%==Yes goto Status
If %acccept%==No goto Begin
Echo I didn't get that.
goto Growl
:Scratch
CLS
Echo Scratch hits the foe with a claw.
Echo Do you want to?
set /p accept=Yes/No?
If %acccept%==Yes goto Combat
If %acccept%==No goto Begin
Echo I didn't get that.
goto Scratch
:Ember
CLS
Echo Ember hits the opponent with a small fire.
Echo Do you want to?
set /p accept=Yes/No?
If %acccept%==Yes goto Combat
If %acccept%==No goto Begin
Echo I didn't get that.
goto Ember
:Combat
CLS
If NOT %attack%==Growl If NOT %attack%==2 set /a H2=%H2%-(%A1%^2/%D2%)
set /a H1=%H1%-(%A2%^2/%D1%)
goto Begin
:Status
CLS
Set /a A1=%A1%-1
goto Combat
問題エリア:
:Tackle
CLS
Echo Tackle Hits The opponent where it hurts. EVERYWHERE.
Echo Do you want to?
set /p accept=Yes/No?
If %acccept%==Yes goto Combat
If %acccept%==No goto Begin
Echo I didn't get that.
goto Tackle
コードをここに罰金取得しますが、私はここにいると、それが後藤のコマンドを期待していません。誰もがこの牛肉を修正することができますか?編集:ユーザーが「はい」、「いいえ」、不器用、または何も入力しなかった場合でも、同じエラーメッセージが表示されます(この時点では予期せぬものでした)。 )
私はdownvotesについて不思議です。質問者はコードを掲示し、問題領域の例を選び出し、エラーメッセージを出した。私には良い質問のようです。バッチファイルでは軽蔑ですか?それは質問が良いかどうかに影響を与えるべきではありません。 –
@WesleyPetrowski、おそらく彼は彼の全体のスクリプトを投稿した。そして、問題のあるコードの追加コピーを投稿しました。彼は問題のあるコードを掲載しているだけであったはずです。 – mikerobi
'%%move%== Catpure goto capture'私は知っている、その猫は優しいですが、これはtypoです^^ – Stephan