Basically, what I'm interested in doing, is allow the user playing my game, through a settings menu, switch the colors of the text in game ( and in the menu ). If you run my code, and you select a color via settings/color settings/ from the main menu, it will select the color correctly, however once you exit the color settings menu. It will revert the color to purple or some odd reason, and not the color you selected. How do I fix this? Here is the code...
@echo off
title KnightsOval
cls
title RPG Game
color e
mode 80,25
goto titlescreen
:titlescreen
if "%color%"=="1" ( set "%color%"="e")
if "%color%"=="2" ( set "%color%"="07")
if "%color%"=="3" ( set "%color%"="03")
if "%color%"=="4" ( set "%color%"="0c")
color %color%
cls
echo.
echo ======
echo Welcome To
echo KnightRealm
echo ======
echo.
echo [1] =Play=
echo [2] =Settings=
echo [3] =Exit=
echo.
echo Made by: MS-DOS Guy
echo ===============================================================================
set /p selection1=">"
if /i "%selection1%"=="1" goto StartGame
if /i "%selection1%"=="2" goto Settings
if /i "%selection1%"=="3" exit
:StartGame
cls
echo.
echo.
echo.
echo.
echo Far away...
color 01
ping 127.0.0.1 -n 4 > nul
cls
echo.
echo In a Land...
color 02
ping 127.0.0.1 -n 4 > nul
cls
echo.
echo.
echo Considered to be one of the most
color 03
ping 127.0.0.1 -n 5 > nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Dangerous, and Bandit filled Lands
color 04
ping 127.0.0.1 -n 4 > nul
echo Lies a man, a man seeking to fix humanity's evil doers, and regain peace
echo and order in the world...
ping 127.0.0.1 -n 4 > nul
cls
echo This man's name is
ping 127.0.0.1 -n 2 > nul
cls
echo This man's name is.
ping 127.0.0.1 -n 3 > nul
cls
echo This man's name is..
ping 127.0.0.1 -n 3 > nul
cls
ping 127.0.0.1 -n 3 > nul
cls
echo This man's name is...
ping 127.0.0.1 -n 2 > nul
cls
echo Ehhh, what is your name young boy?
echo.
echo.
set /p name="Enter Your Name:"
cls
echo Ah, good! I see your name is %name%, very nice name, has a nice
echo ring to it I suppose. Now! If I may ask, haha, it looks like
echo I have forgotten your class!
echo.
echo.
echo ===============================================================
echo SELECT YOUR CLASS --------------------------------------------
echo ===============================================================
echo = WARLOCK =
echo.
echo.
echo = ROGUE =
echo.
echo.
echo = TITAN =
echo.
set /p class="Enter Your Class:"
if "%class%"=="Warlock" goto next1
)
if "%class%"=="Titan" goto next1
)
if "%class%"=="Rogue" goto next1
)
goto exit
:color c0
echo PICK A CORRECT CHOICE/COMMAND!
echo.
echo Redo Y/N?
goto startgame
exit
:next1
if "%color%"=="1" ( set "%color%"="e")
if "%color%"=="2" ( set "%color%"="07")
if "%color%"=="3" ( set "%color%"="03")
if "%color%"=="4" ( set "%color%"="0c")
color %color%
cls
echo I could have sworn your class was %class%! Sounds about right!
ping 127.0.0.1 -n 4 > nul
cls
echo Unknown: Eh, anyways, I suppose now its time I introduce who I may be...
echo ================================================================
echo 1) Yeah, who are you?
echo.
echo 2) No, let me embark on my quest!
echo.
echo ================================================================
set /p choice1=">"
if "%choice1%"=="1" goto continuestory1
if "%choice1%"=="2" goto continuestory2
:continuestory1
if "%color%"=="1" ( set "%color%"="e")
if "%color%"=="2" ( set "%color%"="07")
if "%color%"=="3" ( set "%color%"="03")
if "%color%"=="4" ( set "%color%"="0c")
color %color%
cls
echo Unknown: Well... I'm glad you asked
ping 127.0.0.1 -n 4 > nul
goto continuestory3
:continuestory3
color %color%
echo.
echo.
echo.
echo ....
echo .'' .'''
echo .' :
echo \\ .: :
echo \\ _: : ..----.._
echo \\ .:::.....:::.. .' ''.
echo \\ .' #-. .-######' # '.
echo \\ '.##'/ ' ################ :
echo \\ ##################### :
echo \\ ..##.-.#### .''''###'.._ :
echo \\ :--:########: '. .' :
echo \\..__...--.. :--:#######.' '. '. :
echo : : : : '':'-:'':':: . '. .'
echo '---'''..: : ': '..'''. '. :'
echo \\ :: : : ' ''''''. '. .:
echo \\ :: : : ' '. ' :
echo \\:: : : ....' ..: ' '.
echo \\:: : : .....####\\ .~~.:. :
echo \\':.:.:.:'#########. =. ~ .'-. . '''.. :
echo \\ .' ########## \ \ _.' '. '-. '''.
echo :\\ : ######## \ \ '. '-. :
echo : \\' ' #### : \ \ :. '-. :
echo : .'\\ :' : : \ \ : '-. :
echo : .' .\\ ' : : :\ \ : '. :
echo :: : \\' :. : : \ \ : '. :
echo ::. : \\ : : : ; \ \ : '.:
echo : ': '\\ : : : : \:\ : ..'
echo : ' \\ : : ; \ : .'''
echo '. ' \\: :.''
echo .:..... \\: : ..''
echo '._____ '.\\......'''''''.:..'''
echo \\
echo.
echo ==============================================================
echo Ralph: My name is Ralph, how rude of me, to now inform you
echo at such a time, %name%! Now, let me show you outside!
echo ==============================================================
echo [1] - Sure, Ralph.
echo [2] - Where am I, right now?
echo []
echo.
echo.
echo.
pause
:continuestory2
cls
echo Unknown: Well too bad! I was going to tell you anyways!
ping 127.0.0.1 -n 5 > nul
goto continuestory3
:Settings
if "%color%"=="1" ( set "%color%"="e")
if "%color%"=="2" ( set "%color%"="07")
if "%color%"=="3" ( set "%color%"="03")
if "%color%"=="4" ( set "%color%"="0c")
cls
color %color%
echo ======
echo Settings
echo ======
echo.
echo [1] =Display Settings=
echo [2] =Color Settings=
echo
echo.
echo [3] =Go Back=
echo.
echo ===============================================================================
set /p settings=">"
if /i "%settings%"=="1" goto DisplaySeti
if /i "%settings%"=="2" goto ColorS
if /i "%settings%"=="3" goto titlescreen
:DisplaySeti
if "%color%"=="1" ( set "%color%"="e")
if "%color%"=="2" ( set "%color%"="07")
if "%color%"=="3" ( set "%color%"="03")
if "%color%"=="4" ( set "%color%"="0c")
color %color%
cls
echo ====================
echo Display Settings
echo ====================
echo 1) Default
echo 2) Fullscreen
echo 3) Back
set /p displayseti=">"
if "%displayseti%"=="1" mode 80,25
if "%displayseti%"=="2" mode con: cols=160 lines=78
if "%displayseti%"=="3" goto settings
goto DisplaySeti
:ColorS
if "%color%"=="1" ( set "%color%"="e")
if "%color%"=="2" ( set "%color%"="07")
if "%color%"=="3" ( set "%color%"="03")
if "%color%"=="4" ( set "%color%"="0c")
color %color%
cls
echo ====================
echo Color Settings
echo ====================
echo 1) Yellow ( Default )
echo 2) White
echo 3) Blue
echo 4) Red
echo ===================
echo 5) Go Back
echo ===================
set /p color=">"
if "%color%"=="1" color 0e
if "%color%"=="2" color 07
if "%color%"=="3" color 03
if "%color%"=="4" color 0c
if "%color%"=="5" goto settings
rem switching variables to match color code
if "%color%"=="1" ( set "%color%"="e")
if "%color%"=="2" ( set "%color%"="07")
if "%color%"=="3" ( set "%color%"="03")
if "%color%"=="4" ( set "%color%"="0c")
goto ColorS
The color selector thingy is located in :ColorS and the code I'm using to make it so that wherever you are in the program, is selected to the color you wanted is "color %color%" but it doesn't seem to work...