Notepad game question?

techi3

In Runtime
Messages
119
This is my first attempt at any type of programming. Please take a look at the following game I created; is there an easy way to add some lines of code to make it keep score? At the end I would like it go give you a score and then say, press any key to exit...Thank You!

@echo off
cls
echo LOADING GAME
ping localhost -n 5 >nul
cls
@echo off
color 0a
:loop
:menu
cls
echo Hello and Welcome to the Game.
echo You get to...
echo 1) Start!
echo 2) Info
echo 3) Exit
set /p number=

if not defined number (
cls
goto loop
)

if %number% == 1 goto game
if %number% == 2 goto info
if %number% == 3 exit

:game
cls
echo Who are you?
set /p name=
echo Hello %name%!
echo Do you want to start the quiz? (y/n)
set /p start=

if %start% == y goto lvl1
if %start% == Y goto lvl1
if %start% == n goto menu
if %start% == N goto menu
goto startgame

:info
cls
echo Press your desired button and press enter to continue to where ever you are going
echo.
echo Go back? (y/n)
set /p help=

if %help% == y goto menu
if %help% == Y goto menu
if %help% == n goto info
if %help% == N goto info
goto info

:lvl1
cls
color 0a
echo Hello, it's quiz-time, please answer the following questions.
echo An IP Address starting with 192 is what class?
echo A. Class A
echo B. Class B
echo C. Class C
echo D. Class D
set /p !=

if %!% == A goto wrl
if %!% == B goto wrl
if %!% == C goto crl
if %!% == D goto wrl
if %!% == a goto wrl
if %!% == b goto wrl
if %!% == c goto crl
if %!% == d goto wrl
goto lvl1

:crl
echo You Are Correct!
echo.
echo Continue (y/n)
set /p ha=

if %ha% == y goto lvl2
if %ha% == n goto menu
goto crl

:wrl
echo Wrong!
echo.
pause

:lvl2
cls
color 0a
echo Good Job, now it gets a little harder
echo How many bits are in a byte?
echo A. 4
echo B. 8
echo C. 16
echo D. 64
set /p !=

if %!% == A goto wrl
if %!% == B goto crl
if %!% == C goto wrl
if %!% == D goto wrl
if %!% == a goto wrl
if %!% == b goto crl
if %!% == c goto wrl
if %!% == d goto wrl
goto lvl2

:crl
echo You Are Correct!
echo.
echo Dare to Continue? (y/n)
set /p ha=

if %ha% == y goto lvl2
if %ha% == n goto menu
 
You're already using the set command to set some variables - you just need another for the score, which you can then add to and display as and when you choose!
 
Back
Top Bottom