1.

Solve : Creating a game!?

Answer»

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:
Code: [Select]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:
Code: [Select]echo Last Time Played: %date% %time% > info.txtTo determine the first time played, put this code after the 2ND line:
Code: [Select]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 mainAnd then, info.bat will be:
Code: [Select]@echo off
type info.txt
pauseAnd then to launch it,
Code: [Select]info.batDo you want it to look like a nice sky, or a devilish world?
Use the color command.
Quote from: C:/Users/-----/Desktop/help.txt

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:
Code: [Select]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.-

Quote from: simplyTechy100 on March 08, 2014, 06:47:12 PM
Use the color command.This way you could do:
Code: [Select]color cc
if errorlevel==1 goto colorerror
:colorerror
echo Attempt to set color values same > gamelog.log

Just a comment re the code above - I didn't read most of your code as it is a wall of TEXT and quotes, and hard to read.

The two lines in the middle of your code above will do nothing.

For future reference, a number of websites haven games written in scripts. And there are tutorials about writing such kind of things.
Here is none of many:
How to Make a Large Game With Batch Script
Quote from: foxidrive on March 09, 2014, 12:26:44 AM
Just a comment re the code above - I didn't read most of your code as it is a wall of text and quotes, and hard to read.

The two lines in the middle of your code above will do nothing.
Cmon, look at this lil snippet from the help.txt!
Quote from: C:/Users/-----/Desktop/help.txt
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.
Quote from: simplyTechy100 on March 13, 2014, 05:21:06 AM
Cmon, look at this lil snippet from the help.txt!

What will your code do if it is not errerlevel 1? Exactly the same as if it is errorlevel 1.Eh.. I should have added a :1...
OK, this is it..
Just put a :1 at the start if you used my method of detecting COLOR errorlevel.


Discussion

No Comment Found