Okay, so I'm trying to make a batch game with a lot of choices in it. The code for the main action menu section can be found below. All the variables except %c% are set above. Anyways, whenever I get to this section in the batch, I will type in my selection, and it will just reload the menu. Then, the next time I type in my selection, no matter what I put, it will go to the selection that I had typed previously. I have no idea why it does this, because I have the line that says "Set "c=" which should clear it, right? And why does the menu only reload the first time I type in a response?
Any help would be appreciated. If you need more explanation, I'd be happy to give some.
:action menu
if "%loc%" NEQ "Falconwood" (
echo Select an option:
echo.
echo 1. Find an Enemy to Fight
echo.
echo 2. View Inventory
echo.
echo 3. Travel
echo.
echo 4. Rest at the Inn
echo.
echo 5. Quit
echo.
echo "%c%"
set "c="
SET /P c=Your Choice:
if "%c%" == "2" goto :inventory
if "%c%" == "3" goto :travel
if "%c%" == "4" goto :rest
if "%c%" == "5" goto :quitaction
goto :actionmenu )
REM -----HomeMenu-----
if "%loc%"=="Falconwood" (
if "%house%"=="No" (
echo Select an option:
echo.
echo 1. Buy a house
echo.
echo 2. View Inventory
echo.
echo 3. Travel
echo.
echo 4. Rest at the Inn
echo.
echo 5. Quit
echo.
set "c="
SET /P c=Your Choice:
if "%c%" == "1" goto :houseshop
if "%c%" == "2" goto :inventory
if "%c%" == "3" goto :travel
if "%c%" == "4" goto :rest
if "%c%" == "5" goto :quitaction
goto :actionmenu
)
IF "%house%"=="Yes" (
echo Select an option:
echo.
echo 1. Go Home
echo.
echo 2. View Inventory
echo.
echo 3. Travel
echo.
echo 4. Rest at the Inn
echo.
echo 5. Quit
echo.
set "c="
SET /P c=Your Choice:
REM if "%c%" == 1 goto :houseshop
if "%c%" == 2 goto :inventory
if "%c%" == 3 goto :travel
if "%c%" == 4 goto :rest
if "%c%" == 5 goto :quitaction
goto :actionmenu
)
goto :actionmenu
Aucun commentaire:
Enregistrer un commentaire