Introduction: Party Time 2 and Party Time 3.5 (an Example Walkthrough of Editing a Batch File)
Hi there! This is my first Instructable, so please don't criticize me too badly in the comments! To fully understand this Instructable, I have to give you a little bit of history on it. Before I was as member and just read Instructables, I found an Instructable on how to create a certain program. After reading the Instructable, I downloaded the file of the finished product. This program was called Party Time 2 (by I Got a Cup Productions). Being somewhat of a computer geek myself, I noticed all sorts of glitches and improvements to be made in the program. So with my handy computer, I went into the file and corrected all of these glitches along the way adding my own personal touch. So today, I am going to show you the original code, the improved code, and show you the improvements I made.
WARNING! Some of this does require knowledge of making batch files (especially the part where I show you the improvements I made). If you don't care, read on. If you want to actually understand what I'm saying, just search for a basic guide to batch on this site (believe me, they're everywhere).
WARNING! Some of this does require knowledge of making batch files (especially the part where I show you the improvements I made). If you don't care, read on. If you want to actually understand what I'm saying, just search for a basic guide to batch on this site (believe me, they're everywhere).
Attachments
Step 1: Party Time 2
The original Party Time program that I downloaded from an I Got a Cup Productions Instructable was entitled Party Time 2 (presumably because it was an edited version of an even earlier Party Time). The code was sophisticated to a newbie programmer and simple to a more experienced one. It was very normal. The actual code looked like this:
@echo off
title PARTY TIME! Made By: I Got A Cup Productions
color 0e
echo.
echo -----------------------
echo Its Time to Party!
echo -----------------------
echo.
echo Made By: I Got a Cup Productions
echo.
set /p input=Type Start to Party or No to Not Party :
if %input%==Start goto A
if %input%==No goto B
if %input%==no goto B
:A
:top
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo *********
echo *** ***
echo *** *** ******
echo ********* ****** **
echo *** *** ** * ** ** **
echo *** ** ** ****** ** ** **
echo *** ******* ** ** ** **
echo *** ** ** ** ** ** **
echo *** ** ** ** ** ** **
echo.
color 1a
ping localhost -n 0 >nul
color 2b
ping localhost -n 0 >nul
color 3c
ping localhost -n 0 >nul
color 4d
ping localhost -n 0 >nul
color 5e
ping localhost -n 0 >nul
color 6f
ping localhost -n 0 >nul
color 7a
ping localhost -n 0 >nul
color 8b
ping localhost -n 0 >nul
color 9c
ping localhost -n 0 >nul
goto time
:B
echo.
title Goodbye
color 0c
cls
echo -----------------------
echo You are a Party Pooper!
echo -----------------------
ping localhost -n 3 >nul
echo -----------------------
echo Goodbye!
echo -----------------------
ping localhost -n 4 >nul
:time
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo ********* *****
echo ********* *****
echo *** ** ****** ***
echo *** ** ** ***
echo *** ** *
echo *** ** ********* **** *
echo *** ** ** ** ** **
echo *** ** ** ** ** ** ***
echo *** ** ** ** ** ****** ***
echo.
echo.
color 1a
ping localhost -n 0 >nul
color 2b
ping localhost -n 0 >nul
color 3c
ping localhost -n 0 >nul
color 4d
ping localhost -n 0 >nul
color 5e
ping localhost -n 0 >nul
color 6f
ping localhost -n 0 >nul
color 7a
ping localhost -n 0 >nul
color 8b
ping localhost -n 0 >nul
color 9c
ping localhost -n 0 >nul
goto top
That makes sense if you understand batch code. To those of you who do understand it (which I will assume you do), a mistake should be obvious at this point. The creator takes into account the capitalization of no, but not the non- capitalization of start (more on that later). There is one bigger mistake that I will also address in the corrections step of this.
One thing I do credit this code for is teaching me how to use the variable function for batch by showing me the %input%== section of the code. Over all, this is the code of somebody who got bored and decided to make a batch file to pass the time. He didn't take into account efficiency, he just wanted something that would make his friends laugh and would further his understanding of batch files through practice. However, I was taking into account efficiency and used the batch file to practice my batch skills at spotting mistakes and correcting them.
@echo off
title PARTY TIME! Made By: I Got A Cup Productions
color 0e
echo.
echo -----------------------
echo Its Time to Party!
echo -----------------------
echo.
echo Made By: I Got a Cup Productions
echo.
set /p input=Type Start to Party or No to Not Party :
if %input%==Start goto A
if %input%==No goto B
if %input%==no goto B
:A
:top
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo *********
echo *** ***
echo *** *** ******
echo ********* ****** **
echo *** *** ** * ** ** **
echo *** ** ** ****** ** ** **
echo *** ******* ** ** ** **
echo *** ** ** ** ** ** **
echo *** ** ** ** ** ** **
echo.
color 1a
ping localhost -n 0 >nul
color 2b
ping localhost -n 0 >nul
color 3c
ping localhost -n 0 >nul
color 4d
ping localhost -n 0 >nul
color 5e
ping localhost -n 0 >nul
color 6f
ping localhost -n 0 >nul
color 7a
ping localhost -n 0 >nul
color 8b
ping localhost -n 0 >nul
color 9c
ping localhost -n 0 >nul
goto time
:B
echo.
title Goodbye
color 0c
cls
echo -----------------------
echo You are a Party Pooper!
echo -----------------------
ping localhost -n 3 >nul
echo -----------------------
echo Goodbye!
echo -----------------------
ping localhost -n 4 >nul
:time
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo ********* *****
echo ********* *****
echo *** ** ****** ***
echo *** ** ** ***
echo *** ** *
echo *** ** ********* **** *
echo *** ** ** ** ** **
echo *** ** ** ** ** ** ***
echo *** ** ** ** ** ****** ***
echo.
echo.
color 1a
ping localhost -n 0 >nul
color 2b
ping localhost -n 0 >nul
color 3c
ping localhost -n 0 >nul
color 4d
ping localhost -n 0 >nul
color 5e
ping localhost -n 0 >nul
color 6f
ping localhost -n 0 >nul
color 7a
ping localhost -n 0 >nul
color 8b
ping localhost -n 0 >nul
color 9c
ping localhost -n 0 >nul
goto top
That makes sense if you understand batch code. To those of you who do understand it (which I will assume you do), a mistake should be obvious at this point. The creator takes into account the capitalization of no, but not the non- capitalization of start (more on that later). There is one bigger mistake that I will also address in the corrections step of this.
One thing I do credit this code for is teaching me how to use the variable function for batch by showing me the %input%== section of the code. Over all, this is the code of somebody who got bored and decided to make a batch file to pass the time. He didn't take into account efficiency, he just wanted something that would make his friends laugh and would further his understanding of batch files through practice. However, I was taking into account efficiency and used the batch file to practice my batch skills at spotting mistakes and correcting them.
Attachments
Step 2: Party Time 3.5
Right from the start, even a non-programmer will notice that the name was changed. Whereas the original was Party Time 2, my updated version is called Party Time 3.5. This is because my version incorporates major changes and minor changes (a whole number is a major change, decimals are minor changes). My additions to the program not only fix glitches in the code, but also add my special touch to the code. This creates both a properly functioning program, and a more fun and interesting program. But here's the actual code:
@echo off
title PARTY TIME! Made By: I Got A Cup Productions
color 0e
echo.
echo -----------------------
echo Its Time to Party!
echo -----------------------
echo.
echo Made By: I Got a Cup Productions. Improved By: Ink Ninja Productions
echo.
set /p input=Type Start to Party or No to Not Party. Not sure? Type maybe. Want to see who made this? Type credits. :
if %input%==Start goto A
if %input%==start goto A
if %input%==No goto B
if %input%==no goto B
if %input%==maybe goto C
if %input%==Maybe goto C
if %input%==credits goto credits
if %input%==Credits goto credits
:A
:top
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo *********
echo *** ***
echo *** *** ******
echo ********* ****** **
echo *** *** ** * ** ** **
echo *** ** ** ****** ** ** **
echo *** ******* ** ** ** **
echo *** ** ** ** ** ** **
echo *** ** ** ** ** ** **
echo.
color 1a
ping localhost -n 0 >nul
color 2b
ping localhost -n 0 >nul
color 3c
ping localhost -n 0 >nul
color 4d
ping localhost -n 0 >nul
color 5e
ping localhost -n 0 >nul
color 6f
ping localhost -n 0 >nul
color 7a
ping localhost -n 0 >nul
color 8b
ping localhost -n 0 >nul
color 9c
ping localhost -n 0 >nul
goto time
:B
echo.
title Goodbye
color 0c
cls
echo -----------------------
echo You are a Party Pooper!
echo -----------------------
ping localhost -n 3 >nul
echo -----------------------
echo Goodbye!
echo -----------------------
ping localhost -n 4 >nul
exit
:time
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo ********* *****
echo ********* *****
echo *** ** ****** ***
echo *** ** ** ***
echo *** ** *
echo *** ** ********* **** *
echo *** ** ** ** ** **
echo *** ** ** ** ** ** ***
echo *** ** ** ** ** ****** ***
echo.
echo.
color 1a
ping localhost -n 0 >nul
color 2b
ping localhost -n 0 >nul
color 3c
ping localhost -n 0 >nul
color 4d
ping localhost -n 0 >nul
color 5e
ping localhost -n 0 >nul
color 6f
ping localhost -n 0 >nul
color 7a
ping localhost -n 0 >nul
color 8b
ping localhost -n 0 >nul
color 9c
ping localhost -n 0 >nul
goto top
:C
cls
echo Think about what you want to do.
ping localhost -n 5 >nul
echo -----------------------------------------------------------
echo Okay! You've had time to think! Now what do you want to do?
echo -----------------------------------------------------------
set /p input=Type Start to Party or No to Not Party. Not sure? Type maybe. Want to see who made this? Type credits. :
if %input%==Start goto A
if %input%==No goto B
if %input%==no goto B
if %input%==maybe goto C
if %input%==Maybe goto C
if %input%==credits goto credits
if %input%==Credits goto credits
:credits
cls
color 2
echo This is who made this!
ping localhost -n 5 >nul
echo.
echo Base code (yes and no functions) by: I Got a Cup Productions
ping localhost -n 5 >nul
echo.
echo Improved coding (maybe function) by: Ink Ninja Productions
ping localhost -n 5 >nul
echo.
echo "No" glitch fixed by: Ink Ninja Productions
ping localhost -n 5 >nul
echo.
echo Credits by: Ink Ninja productions
pause
I know that it's really big, but it's very important to demonstrate how I fixed and improved upon the code. All of the previous problems that I stated in step 2 are gone, AND I added a few cool new features. These features include: a new option on the title screen and credits to show who actually did what in the program. To get informational details on the fixed glitches and improvements, go to the next step.
@echo off
title PARTY TIME! Made By: I Got A Cup Productions
color 0e
echo.
echo -----------------------
echo Its Time to Party!
echo -----------------------
echo.
echo Made By: I Got a Cup Productions. Improved By: Ink Ninja Productions
echo.
set /p input=Type Start to Party or No to Not Party. Not sure? Type maybe. Want to see who made this? Type credits. :
if %input%==Start goto A
if %input%==start goto A
if %input%==No goto B
if %input%==no goto B
if %input%==maybe goto C
if %input%==Maybe goto C
if %input%==credits goto credits
if %input%==Credits goto credits
:A
:top
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo *********
echo *** ***
echo *** *** ******
echo ********* ****** **
echo *** *** ** * ** ** **
echo *** ** ** ****** ** ** **
echo *** ******* ** ** ** **
echo *** ** ** ** ** ** **
echo *** ** ** ** ** ** **
echo.
color 1a
ping localhost -n 0 >nul
color 2b
ping localhost -n 0 >nul
color 3c
ping localhost -n 0 >nul
color 4d
ping localhost -n 0 >nul
color 5e
ping localhost -n 0 >nul
color 6f
ping localhost -n 0 >nul
color 7a
ping localhost -n 0 >nul
color 8b
ping localhost -n 0 >nul
color 9c
ping localhost -n 0 >nul
goto time
:B
echo.
title Goodbye
color 0c
cls
echo -----------------------
echo You are a Party Pooper!
echo -----------------------
ping localhost -n 3 >nul
echo -----------------------
echo Goodbye!
echo -----------------------
ping localhost -n 4 >nul
exit
:time
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo ********* *****
echo ********* *****
echo *** ** ****** ***
echo *** ** ** ***
echo *** ** *
echo *** ** ********* **** *
echo *** ** ** ** ** **
echo *** ** ** ** ** ** ***
echo *** ** ** ** ** ****** ***
echo.
echo.
color 1a
ping localhost -n 0 >nul
color 2b
ping localhost -n 0 >nul
color 3c
ping localhost -n 0 >nul
color 4d
ping localhost -n 0 >nul
color 5e
ping localhost -n 0 >nul
color 6f
ping localhost -n 0 >nul
color 7a
ping localhost -n 0 >nul
color 8b
ping localhost -n 0 >nul
color 9c
ping localhost -n 0 >nul
goto top
:C
cls
echo Think about what you want to do.
ping localhost -n 5 >nul
echo -----------------------------------------------------------
echo Okay! You've had time to think! Now what do you want to do?
echo -----------------------------------------------------------
set /p input=Type Start to Party or No to Not Party. Not sure? Type maybe. Want to see who made this? Type credits. :
if %input%==Start goto A
if %input%==No goto B
if %input%==no goto B
if %input%==maybe goto C
if %input%==Maybe goto C
if %input%==credits goto credits
if %input%==Credits goto credits
:credits
cls
color 2
echo This is who made this!
ping localhost -n 5 >nul
echo.
echo Base code (yes and no functions) by: I Got a Cup Productions
ping localhost -n 5 >nul
echo.
echo Improved coding (maybe function) by: Ink Ninja Productions
ping localhost -n 5 >nul
echo.
echo "No" glitch fixed by: Ink Ninja Productions
ping localhost -n 5 >nul
echo.
echo Credits by: Ink Ninja productions
pause
I know that it's really big, but it's very important to demonstrate how I fixed and improved upon the code. All of the previous problems that I stated in step 2 are gone, AND I added a few cool new features. These features include: a new option on the title screen and credits to show who actually did what in the program. To get informational details on the fixed glitches and improvements, go to the next step.
Attachments
Step 3: Corrections and Improvements
As I've mentioned, the original program had a few mistakes. While there weren't many of these mistakes, the ones there were had a major impact on the overall running of the program. I won't show the code again, but I will include details from the code, so you might want to look at it again.
I mentioned the first mistake in step 1. There was no variable for the non-capitalization of start. So I went into the code and added the variable that looked like this: if %input%==start goto A. This fixed the problem and made it so that people who perhaps didn't follow the exact context of the original creator could still enjoy the program without trying it a million times and thinking that the program was faulty (unless you're a programmer like me!).
The biggest glitch in this was what I call the "no" glitch. What the glitch did was that when you added the input no on the title screen, after the little message played, it would got to the label after that one and continue to play perpetually. So basically, you type no, but ended up wit yes anyway. Fortunately, the solution was simple. After the message, I wrote in an "exit" command that would end the program before it went to the following label.
On top of the glitches that I corrected, I also added some features that made the program more interesting. For example, I added the "maybe" function, which let unsure people have time to think before actually making a decision on whether or not to hit yes or no. It was also a great way to show the people using the program that the person making it does know what he's doing (and to assure them that the program is not a virus).
Another nifty feature is the credits that I created. I added these for two reasons: 1) It gave the program a more professional look. 2) To give credit to the parts that I made and the parts that I Got a Cup Productions made.
I mentioned the first mistake in step 1. There was no variable for the non-capitalization of start. So I went into the code and added the variable that looked like this: if %input%==start goto A. This fixed the problem and made it so that people who perhaps didn't follow the exact context of the original creator could still enjoy the program without trying it a million times and thinking that the program was faulty (unless you're a programmer like me!).
The biggest glitch in this was what I call the "no" glitch. What the glitch did was that when you added the input no on the title screen, after the little message played, it would got to the label after that one and continue to play perpetually. So basically, you type no, but ended up wit yes anyway. Fortunately, the solution was simple. After the message, I wrote in an "exit" command that would end the program before it went to the following label.
On top of the glitches that I corrected, I also added some features that made the program more interesting. For example, I added the "maybe" function, which let unsure people have time to think before actually making a decision on whether or not to hit yes or no. It was also a great way to show the people using the program that the person making it does know what he's doing (and to assure them that the program is not a virus).
Another nifty feature is the credits that I created. I added these for two reasons: 1) It gave the program a more professional look. 2) To give credit to the parts that I made and the parts that I Got a Cup Productions made.
Step 4: Want to Do This Yourself?
If you want to do what I do to another program, here's what you do (Windows is required since batch is owned by Microsoft):
1. Take the downloaded batch file and right-click on it
2. Go to the "edit" button (in the right-click menu)
3. This should open up notepad, where there will be lots of code
4. Poke around in the code and play around with it as much as you like (assuming you know how to program in batch
1. Take the downloaded batch file and right-click on it
2. Go to the "edit" button (in the right-click menu)
3. This should open up notepad, where there will be lots of code
4. Poke around in the code and play around with it as much as you like (assuming you know how to program in batch
Step 5: Conclusion
By now you're probably thinking to yourself, "That's all very nice, but what does that teach us?" Well I would certainly say that you learned a little bit about batch programming. But also, you learned how to spot mistakes in other programs, which is a good skill and can lead to many openings for jobs (you know, after you go to college for four years to learn how to do it all properly). Well, I hope you learned from all this. Both of the programs are available for download below. This is The Ink Ninja signing off on my very first Instructable. More to come soon!