0

基本上,我一直在开发一款可以让你创造世界的游戏。它非常新,我已经研究了大约 30 分钟。第三方外部程序是 cmdmenusel 和 CHOICE。在岩石场景( :rocks )中,当我单击展开时,它会崩溃并显示一条快速消息。你能帮我看看我的代码有什么问题吗?

@echo off
title Develop a World
cd z
:: Not a fully developed program. 
:: Do not distribute.
:: (C) Copyright Bextem 2016  - Present
:love
cls
color D
echo There is nothing but love.
cmdMenuSel f870 "Grow"
if %ERRORLEVEL% == 1 goto hope
goto love
:hope
cls
color E
echo There is love and hope.
cmdMenuSel f870 "Grow"
if %ERRORLEVEL% == 1 goto start
goto hope
:start
cls
color F
echo With love and hope, there is a start.
cmdMenuSel f870 "Grow"
if %ERRORLEVEL% == 1 goto rocks
goto start
:rocks
cls
color 8
echo There are rocks in your land.
cmdMenuSel f870 "Grow"
if %ERRORLEVEL% == 1 goto mountain
goto rocks
:mountains
cls
color 8 
echo There is a mountain.
echo.
type mountain.txt
echo.
cmdMenuSel f870 "Expand"
if %ERRORLEVEL% == 1 goto manymts
goto mountains
:manymts
cls
color 8
echo There are caves and mountains.
echo.
type mt.txt
cmdMenuSel f870 "Crumble" "Grow"
if %ERRORLEVEL% == 1 goto earth
if %ERRORLEVEL% == 2 goto stone
goto manymts
:stone
echo There is nothing but stone.
echo Press any key to undo your mistake.
pause >nul
goto manymts
:earth
cls
color 6
echo There is dirt and mountains.
cmdMenuSel f870 "Water" "Shine"
if %ERRORLEVEL% == 1 goto earthwater
if %ERRORLEVEL% == 2 goto earthshine
goto earth
:earthwater
cls
color 61
echo There is moist soil and mountains.
cmdMenuSel f870 "Shine" "Water"
if %ERRORLEVEL% == 1 goto earthwatershine
if %ERRORLEVEL% == 2 goto floodearth1
goto earthwater
:earthshine
cls
color 16
echo There is hot soil and mountains.
cmdMenuSel f870 "Water" "Shine"
if %ERRORLEVEL% == 1 goto earthwatershine
if %ERRORLEVEL% == 2 goto droughtearth1
goto earthshine
:floodearth1
cls
color 2
echo Your world has flooded.
echo Press any key to undo your mistake.
pause >nul
goto earthwater
:droughtearth2
cls
color 6
echo The world burns from the sun.
echo Press any key to undo your mistake.
pause >nul
goto earthshine
:earthwatershine
cls
color A2
echo The soil is floroushing.
cmdMenuSel f870 "Grow" "Plant"
if %ERRORLEVEL% == 1 goto dirtpile
goto earthwatershine
:dirtpile
cls
color 6
echo There is a pile of dirt and mountains
echo +1 more.
cmdMenuSel f870 "Grow Dirt" "Grow Mountains" "Inventory"
if %ERRORLEVEL% == 1 goto dirtpilehuge
if %ERRORLEVEL% == 2 goto stone
if %ERRORLEVEL% == 3 goto Inventory
goto dirtpile
:Inventory
echo PLAYER'S INVENTORY (PAGE 1)
echo You have: 
echo Loves: %love%
echo Hopes: %hope%
echo Starts: %start%
echo Rocks: %rocks%
echo Mountains: %mountains%
echo Caves: %caves%
echo Soil: %soil%
:startgame
set love=0
set hope=0
set start=0
set rocks=0
set mountain=0
set caves=0
set soil=0
set humans=0
goto love
4

1 回答 1

0

你有goto mountain而不是goto mountains在该:rocks部分。

只需查看 goto 下方的两行即可查看您的错字。您的代码中没有:mountain任何地方。只有:mountains.

因此,只需更改:

if %ERRORLEVEL% == 1 goto mountain

.. 至:

if %ERRORLEVEL% == 1 goto mountains
于 2016-12-06T22:17:51.520 回答