:rocks scene invalid and crashing. what's wrong with the batch code?

104 Views Asked by At

Basically, I've been working on a game that allows you to create a world. It's extremely new and I've been working on it for about 30 minutes. The third-party external programs are cmdmenusel and CHOICE. At the rocks scene, ( :rocks ), when I click Expand, it crashes with a quick message. Can you please help me see what's wrong with my code?

@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
1

There are 1 best solutions below

1
On

You have goto mountain instead of goto mountains in the :rocks section.

Look just two lines beneath that goto to see your typo. There is no :mountain anywhere in your code. Only :mountains.

Hence, just change:

if %ERRORLEVEL% == 1 goto mountain

.. to:

if %ERRORLEVEL% == 1 goto mountains