I am trying to create a number typing game to help train me and whoever else of my coworkers to see a number and type it faster without error. So I decide to make a quick game in notepad++, because im also trying to make CYOA (choose your own adventure) stories but thats for another post. I have posted my code below.
@ECHO OFF
:START
cls
echo num="%random%"
echo.
set /p inp=
if %inp% == %num% goto rght
if %inp% neq %num% goto wrng
:rght
echo.
echo CORRRECT
pause
GOTO START
:wro
echo.
echo wrong
pause
GOTO START
when I run the bat file, the number generated by %random% prints and if you put the correct or incorrect number, i get this
'wrng' is not recognized as an internal or external command, operable program or batch file.
and then continues to :rght even though I typed in the incorrect number
What does this mean and how can i fix this?
linked below is the exact message i get after putting the incorrect value
update
i have added a timer that goes straight to the next number after input which works fine but my counters for correct and incorrect answers both stay at 0 regardless of how many are put entered right or wrong. i basically need help understanding why my 2 counters dont work
@ECHO OFF
:START
CLS
color 07
SET "CORRECT=0"
SET "INCORRECT=0"
ECHO CORRECT %CORRECT%
ECHO INCORRECT %INCORRECT%
ECHO.
ECHO.
SET "num=%RANDOM%"
ECHO %num%
ECHO.
SET /P "INP= "
IF NOT "%INP%"=="%num%" GOTO WRNG
color 27
ECHO.
ECHO CORRECT
SET /a CORRECT=CORRECT+1
GOTO TIMER
: WRNG
color 47
ECHO.
ECHO INCORRECT
SET /a INCORRECT=INCORRECT+1
GOTO TIMER
: TIMER
set /a time=1
: TM
ping localhost -n 2 >nul
set /a time=%time%-1
if %time%==0 (
goto START
)else goto TM