Home > Blockchain >  How do I silence a batch script file
How do I silence a batch script file

Time:03-28

Okay so I am trying to make a rpg and it's going good so far but I want to fix this one bug. I use a system so when you press "w s d" It will go down up or select. The problem is that when I press a difrent button like "Q" or "K" it will beep at me. I have been stumped with this for a while now.

:startgame
cls
if %select% gtr 4 set select=1
if %select% lss 1 set select=4
set s1=-
set s2=-
set s3=-
set s4=-
set s%select%=@
echo --------------------------------
echo Welcome to StormTides.
echo --------------------------------
echo Version: v1.1: Beta_Test
echo What would you like to do?
echo.
echo [%s1%] Load Save
echo [%s2%] New Save
echo [%s3%] Controls
echo.
echo --------------------------------
echo [%s4%] Exit
if "%msplash%"=="y" echo.
choice /c:wsd /n /m ""
set msplash=n
if "%errorlevel%"=="1" set /a select-=1
if "%errorlevel%"=="2" set /a select =1
if "%errorlevel%"=="3" (
if "%select%"=="1" set select=1&goto login2
if "%select%"=="2" set select=1&goto createuser
if "%select%"=="3" set select=1&goto controls
if "%select%"=="4" exit
)
goto startgame

CodePudding user response:

Your choice command only allows w, s or d. If you want to allow a user to enter other chars like Q or K, you need to add them to the choice command ... for example, choice /c:wsdQK ...

  • Related