Page 1 of 1

How do i save color to a savefile in a batch file

Posted: 02 Mar 2023 05:51
by rune1
i have this code

Code: Select all

:menu
color %backroundColor%%textColor%
cls
echo 1. Play
echo.
echo 2. Load
echo.
echo 3. Delete savefile
echo.
echo 4. Settings
echo.
set /p variable= Write the number of your choice:
if %variable% equ 1 goto start
if %variable% equ 2 goto load
if %variable% equ 3 goto delete
if %variable% equ 4 goto settings
if %variable% neq 1 goto menu

:load
cls
set /p savename= What is the name of the savefile you want to load:
set /p "page="<%filename%.dat
if exist %savename%.dat goto saveandload
echo.
pause
goto menu

:save
cls
set /p filename= What do you want your savefile to be called:
cls
>%filename%.dat echo %page%
echo Saved.
echo.
pause
goto meny

:saveandload
cls
< %savename%.dat (
set /p page=
)
echo Loaded.
echo.
pause
goto :%page%

:delete
cls
set /p delete="Which savefile do you want to delete?: "
if exist %delete%.dat goto delete1
cls
echo It looks like that savefile does not exist.
echo.
pause
goto menu

:delete1
cls
echo Are you sure you want to delete %delete%.dat?
echo.
echo 1. Yes
echo.
echo 2. No
echo.
set /p yesno="Write the number of your choice: "
if %yesno%==1 goto deleteyes
if %yesno%==2 goto deleteno
goto radera1

:deleteyes
cls
del %delete%.dat
echo You deleted %delete%.dat
echo.
pause
goto menu

:deleteno
cls
echo There is no savefile called %delete%.dat
echo.
pause
goto menu

:settings
cls
echo 1. Text- and backroundcolor
echo.
echo 2. Go back
echo.
set /p variable= Write the number of your choice:
if %variable% equ 1 goto textcolor
if %variable% equ 2 goto menu
if %variable% neq 1 goto settings

:textcolor
cls
echo Textcolor
echo.
echo 1. Black
echo.
echo 2. Blue
echo.
echo 3. Grean
echo.
echo 4. Aqua
echo.
echo 5. Red
echo.
echo 6. Purple
echo.
echo 7. Yellow
echo.
echo 8. White
echo.
echo 9. Gray
echo.
echo 10. Light blue
echo.
echo 11. Light grön
echo.
echo 12. Light aqua
echo.
echo 13. Light red
echo.
echo 14. Light purple
echo.
echo 15. Light yellow
echo.
echo 16. Bright white
echo.
echo 17. Go back
echo.
echo 18. Menu
echo.
set /p variable= Write the number of your choice:
if %variable% equ 1 set textColor=0&&goto backroundcolor
if %variable% equ 2 set textColor=1&&goto backroundcolor
if %variable% equ 3 set textColor=2&&goto backroundcolor
if %variable% equ 4 set textColor=3&&goto backroundcolor
if %variable% equ 5 set textColor=4&&goto backroundcolor
if %variable% equ 6 set textColor=5&&goto backroundcolor
if %variable% equ 7 set textColor=6&&goto backroundcolor
if %variable% equ 8 set textColor=7&&goto backroundcolor
if %variable% equ 9 set textColor=8&&goto backroundcolor
if %variable% equ 10 set textColor=9&&goto backroundcolor
if %variable% equ 11 set textColor=a&&goto backroundcolor
if %variable% equ 12 set textColor=b&&goto backroundcolor
if %variable% equ 13 set textColor=c&&goto backroundcolor
if %variable% equ 14 set textColor=d&&goto backroundcolor
if %variable% equ 15 set textColor=e&&goto backroundcolor
if %variable% equ 16 set textColor=f&&goto backroundcolor
if %variable% equ 17 goto settings
if %variable% equ 18 goto menu
if %variable% neq 1 goto textcolor

:backroundcolor
cls
echo Backroundcolor
echo.
echo 1. Black
echo.
echo 2. Blue
echo.
echo 3. Grean
echo.
echo 4. Aqua
echo.
echo 5. Red
echo.
echo 6. Purple
echo.
echo 7. Yellow
echo.
echo 8. White
echo.
echo 9. Gray
echo.
echo 10. Light blue
echo.
echo 11. Light grön
echo.
echo 12. Light aqua
echo.
echo 13. Light red
echo.
echo 14. Light purple
echo.
echo 15. Light yellow
echo.
echo 16. Bright white
echo.
echo 17. Backa
echo.
echo 18. Meny
echo.
set /p variable= Skriv numret av dit val:
if %variable% equ 1 set backroundColor=0&&goto menu
if %variable% equ 2 set backroundColor=1&&goto menu
if %variable% equ 3 set backroundColor=2&&goto menu
if %variable% equ 4 set backroundColor=3&&goto menu
if %variable% equ 5 set backroundColor=4&&goto menu
if %variable% equ 6 set backroundColor=5&&goto menu
if %variable% equ 7 set backroundColor=6&&goto menu
if %variable% equ 8 set backroundColor=7&&goto menu
if %variable% equ 9 set backroundColor=8&&goto menu
if %variable% equ 10 set backroundColor=9&&goto menu
if %variable% equ 11 set backroundColor=a&&goto menu
if %variable% equ 12 set backroundColor=b&&goto menu
if %variable% equ 13 set backroundColor=c&&goto menu
if %variable% equ 14 set backroundColor=d&&goto menu
if %variable% equ 15 set backroundColor=e&&goto menu
if %variable% equ 16 set backroundColor=f&&goto menu
if %variable% equ 17 goto textcolor
if %variable% equ 18 goto menu
if %variable% neq 1 goto backroundcolor

:start
set page=start
cls
echo hello.
echo.
echo 1. Save
echo.
set /p variable= Write the number of your choice:
if %variable% equ 1 goto save
if %variable% neq 1 goto start
it can save the page to a .dat file but how do i get it to work so that it also saves the color changes to the same .dat file

and how do i choose where the .dat file will be saved. i want it to be saved to a map