我正在进行批量游戏,直到你回答第一个问题(choice1Scene1)
@echo off
title RPG
color 0C
:top
echo ***************************************************************************
echo ~Welcome To Wild West Ranger~
echo ***************************************************************************
echo.
echo.
echo please type answers exactly as they appear
echo.
echo.
echo ~Enter S To Begin Your New Life~
echo.
echo.
echo.
set /p opt=
if %opt%==S GOTO name
if %opt%!==!S GOTO top
if %opt%==s GOTO name
if %opt%!==!s GOTO top
pause
cls
:name
echo ***************************************************************************
echo What Will You Be Called?
echo ***************************************************************************
set /p playerName=
set playerHealth=100HP
echo.
echo.
echo.
echo.
echo.
cls
echo Your name is %playerName%?
echo Key:
echo [1] Yes
echo [2] Redo
echo [e] Exit
echo.
set /p playerNameChoice=
if %playerNameChoice%==1 goto nameConfirmed
if %playerNameChoice%==2 goto name
if %playerNameChoice%==e goto exit
:nameConfirmed
echo WELCOME %playerName% TO THE WEST
echo.
echo.
cls
goto gameStart
:gameStart
echo.
echo [Health %playerHealth%]
echo You wake up on the ground outside an old wooden barn...
echo What will you do?
echo.
echo.
echo [1] Get up and walk inside the barn
echo [2] Get up and look for others
echo [3] Go back to sleep
set /p %playerChoice1Scene1%=
if %playerChoice1Scene1%==1 goto choice1'2Scene1
if %playerChoice1Scene1%==2 goto choice2Scene1
if %playerChoice1Scene1%==3 goto choice1Scene1
if %playerChoice1Scene1%!==!1 goto gameStart
if %playerChoice1Scene1%!==!2 goto gameStart
if %playerChoice1Scene1%!==!3 goto gameStart
:choice1'2Scene1
echo.
echo [Health %playerHealth%]
echo You walk around around the barn and enter through two big wooden doors.
echo Inside you see a table with two choice weapons on it...
echo.
echo.
echo [Spanish Pistol] Fast Fire, 15 Bullets, Not As Accurate
echo [Long-Barreled Western Pistol] Medium Fire, 10 Bullets, Very Accurate
set /p %playerChoice1Scene1%=
if %playerChoice1Scene1%==Spanish Pistol goto choice1'3Scene1
if %playerChoice1Scene1%==Long-Barreled Western Pistol goto choice1'3Scene1
if %playerChoice1Scene1%!==!Spanish Pistol goto choice1'2Scene1
if %playerChoice1'2Scene1%!==!Long-Barreled Western Pistol goto choice1'2Scene1
:exit
cls
echo ***************************************************************************
echo.
echo Thanks For Playing Wild West Ranger
echo.
echo ***************************************************************************
pause
exit
答案 0 :(得分:0)
set /p %playerChoice1Scene1%=
尝试设置当前内容 playerChoice1Scene1。移除%
以设置变量 playerChoice1Scene1
并且请仅发布显示问题所需的代码部分,以及代码应该执行的操作及其实际操作的描述。
答案 1 :(得分:0)
除了Magoo所说的,!==!
符号是什么?没有这样的运营商。您需要if "%opt%" NEQ "S"
或if not "%opt%" == "S". For case-insensitive tests,
if / i . Type
if /?`寻求帮助。
其次,choice
命令更易于用于您的目的。输入choice /?
寻求帮助。