-1
我在批處理文件中工作我的第一場比賽,我不斷收到 的錯誤,''此時'採取的是意外''「。 「採取」是我分配變量「霰彈槍」爲。我試圖做的是,如果用戶沒有「拾起將軍」,他們會留在當前區域,但是如果他們確實拿起它將會移動到另一個「活的」區域。「」在這個時候出乎意料
: barn
echo. You enter the barn, it's creeky and it's dark, just as it is outside.
echo.
echo. You wonder if anything of use is in this barn.
echo.
echo. Should you check under the staircase to the left or to the right?
echo.
set /p command =
echo.
if %command% equ right goto barn_right
if %command% equ left goto barn_left_die
: barn_left_die
if %shotgun% equ taken goto barn_left_live
echo. You hear creeking in the floorboards to the right, an infected jumps at you tearing you into pieces.
echo.
echo. YOU ARE DEAD
echo.
pause
: barn_left_live
echo. You hear creeking in the floorboards to the right, you kill the infected that jumps at you with your shotgun!
echo. You decide to go to a different building, do you go to the shed or house?
echo.
set /p command =
echo.
if %command% = shed goto shed
if %command% = house goto house
: barn_right
echo. You see a glint in the dark, it appears to be the moon light reflecting off the steel of a shotgun barrel.
echo.
echo. You take the shotgun.
echo.
set /p shotgun = taken
echo. Should you now go to the house, shed, or check underneath the left staircase?
echo.
set /p command =
echo.
if %command% = shed goto shed_die
if %command% = house goto house_die
if %command% = left goto left_staircase_die
pause
的可能的複製[爲什麼是與「回聲%VAR%」沒有字符串輸出使用命令行上的「設置VAR =文本」後?](http://stackoverflow.com/questions/26386697/why- is-no-string-output-with-echo-var-after-using-set-var-text-on-comman) – Mofi
通常我會同意@Mofi,就像你看到的那樣,有太多的問題,獨自一人解決不了他們的困境。 – Compo