Batch

Discuss how to write good code, break bad code, your current pet projects, or the best way to approach novel problems

Re: Batch

Post by Sharmz on Tue Jul 15, 2008 12:31 pm
([msg=7476]see Re: Batch[/msg])

Thanks a lot!
"You must be the change you wish to see in the world."
-Mohandas Karamchand Gandhi
"Be nice to nerds. Chances are you'll end up working for one."
-Bill Gates
Sharmz
New User
New User
 
Posts: 41
Joined: Thu May 29, 2008 1:18 am
Blog: View Blog (0)


Re: Batch

Post by poppasmurfenfold on Wed Jul 16, 2008 3:16 am
([msg=7518]see Re: Batch[/msg])

not sure if anyone noticed yet but at the end of your game there was a bug that closed the program.....hope its cool that i changed it a little...here is the one without that close bug


@echo off
color A1
:start
echo Welcome to my adventure game. This is a text-based game, meaning there are no graphics. Type "play" to start the game. Type "help" to view the commands you can use. ("n" means North, "s" is South, "e" is East, and "w" is West.) If you get stuck, you can use the "give up" command to start over.
echo Good Luck...
set /p a=Enter your command:
if %a%==play goto game
if %a%==help goto help
:help
echo Commands you can use:
echo ----------------------
echo n
echo e
echo s
echo w
echo give up
goto start
:game
cls
echo You are in a cave. There are tunnels going north and east.
set /p n=
if %n%==n goto north
if %n%==w goto error
if %n%==e goto east
if %n%==s goto error
if %n%==give up exit
:error
echo You cannot go that way.
pause
cls
goto game
:east
echo You were attacked by bats and killed. Start over
pause
goto start
:north
echo You chose the correct path. You are out of the cave. You are standing in an open field. Where do you go?
set /p b=
if %b%==n goto nth
if %b%==s goto nth
if %b%==e goto e
if %b%==w goto nth
if %b%==give up exit
:nth
echo You had a heart attack and died. Game over
goto start
:e
echo You are now in a forest. The only paths are north and south.
set /p z=
if %z%==n goto die
if %z%==e goto error
if %z%==s goto path
if %z%==w goto error
if %z%==give up exit
:die
echo You tripped on a rock and died. Game over.
goto start
:path
echo You are still in the forest. The Only paths now are south and east
set /p x=
if %x%==n goto error
if %x%==e goto death
if %x%==s goto happy
if %x%==w goto error
if %x%==give up exit
:death
echo A snake bit you and you died. Game over.
pause
goto start
:happy
echo You are out of the forest now, but a tribe of Indians surrounded you. The only ways out are south and east.
set /p d=
if %d%==n goto error
if %d%==e goto indians
if %d%==s goto escape
if %d%==w goto error
if %d%==give up exit
:indians
echo They saw what you were up to and stabbed you with sharp rocks. Game over.
pause
goto start
:escape
echo You are standing at the edge of a cliff.
set /p w=
if %w%==n goto fall
if %w%==e goto found
if %w%==s goto won
if %w%==w goto tripped
:fall
echo You walked off the cliff. Game over.
pause
goto start
:found
echo The Indians found you again and shot you with arrows. Game over
pause
goto start
:tripped
echo You tripped on a rock and fell off the cliff. Game over.
pause
goto start
:won
echo YOU WON THE GAME!! Congrats!
echo Please type your name:
set /p m=
echo WINNERS
echo ---------
echo 1 %m%
echo 2
echo 3
echo 4
echo 5
pause
cls
goto start

SKON
poppasmurfenfold
New User
New User
 
Posts: 4
Joined: Thu Jul 10, 2008 3:54 am
Blog: View Blog (0)


Re: Batch

Post by beagle on Wed Jul 16, 2008 7:15 pm
([msg=7590]see Re: Batch[/msg])

Hey, I didn't notice that. Thanks!
011000100110010101100001011001110110110001100101
beagle
Poster
Poster
 
Posts: 244
Joined: Wed Jul 02, 2008 2:37 pm
Location: Chico, CA
Blog: View Blog (0)


Previous

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests