2016-12-06 48 views
0

基本上,我一直在研究一個遊戲,讓你創造一個世界。這是非常新的,我已經做了大約30分鐘。第三方外部程序是cmdmenusel和CHOICE。在岩石現場((岩石)),當我點擊Expand時,它會以一個快速消息崩潰。你能幫我看看我的代碼有什麼問題嗎?:岩石場景無效並且崩潰。批次代碼有什麼問題?

@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 
+0

請把下面的幫助主題:如何創建一個最小的,完整的,並且可驗證的示例](HTTP:/ /stackoverflow.com/help/mcve)! – aschipfl

+0

調試批處理文件的提示:從批處理文件中刪除「@echo off」並保存。打開一個命令提示符窗口,該命令提示符窗口導致啓動具有選項'/ K'的'cmd.exe'以在執行一個或多個批處理文件後__keep open__窗口,鍵入帶有雙引號括起來的完整路徑的批處理文件的名稱,以及按回車鍵執行。您現在看到預處理後執行的命令行。而且您還會看到類似標籤的錯誤消息,導致批量解釋退出。雙擊一個批處理文件導致使用'cmd.exe'運行它,結束時使用'/ C'作爲__close__。 – Mofi

回答

0

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

看看下面的兩行就可以看到你的錯字。代碼中的任何地方都沒有:mountain。只有:mountains

因此,只要改變:

if %ERRORLEVEL% == 1 goto mountain 

..到:

if %ERRORLEVEL% == 1 goto mountains 
+1

謝謝,我之前沒有注意到這一點。 – spokify