This will show everything you need for atleast a intermediate game, from basic skills to sound!
You always start with @echo off because if you don't, you will get this:
C:/game>echo Welcome to my game! WIP!
Welcome to my game! WIP!
C:/game>pause
Press any key to continue...
C:/game will be different, it depends on the directory you are creating the game in.
To launch another program, make sure it is in the same folder.
So, if we wanted to launch info.bat, we would need to get info (because that is the batch name).
To get the last time someone played, put this after @echo off:
echo Last Time Played: %date% %time% > info.txt
To determine the first time played, put this code after the 2nd line:
echo Y for yes, N for no
set /p ft=Is this your first time?
if %ft%==Y echo First Time Played: %date% %time% > info.txt
if %ft%==N goto main
And then, info.bat will be:
@echo off
type info.txt
pause
And then to launch it,
info.bat
Do you want it to look like a nice sky, or a devilish world?
Use the color command.
Sets the default console foreground and background colors.
COLOR [attr]
attr Specifies color attribute of console output
Color attributes are specified by TWO hex digits -- the first
corresponds to the background; the second the foreground. Each digit
can be any of the following values:
0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White
If no argument is given, this command restores the color to what it was
when CMD.EXE started. This value either comes from the current console
window, the /T command line switch or from the DefaultColor registry
value.
The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute
the COLOR command with a foreground and background color that are the
same.
Example: "COLOR fc" produces light red on bright white
This way you could do:
color cc
if errorlevel==1 goto colorerror
:colorerror
echo Attempt to set color values same > gamelog.log
--INTERMEDIATE--
So you want sound, eh?
SNDREC32 /PLAY /EMBEDDED C:/game/battle.wav
C:/game/battle.wav can be any audio file.
-This is a ongoing development. Help can be added or edited by me at any time.-