PDA

View Full Version : txt game in cmd



dragon39990
10-23-2008, 09:00 PM
Hey guys thanks for all that use have done for me. I wanted to know this time how to make something simple for a txt game i'm making. I wanted to no how to make it that for example when it says: Do you want to play (y/n) is there anyway for it to reconginze the y or the n for if u put y it starts the game and if u hit n it would close it. Thanks if use can help me and if not thanks anyway.

-Dragon****0

Moonbat
10-23-2008, 09:13 PM
If you just want a simple game for the Command Line, look into Windows batch files (http://en.wikipedia.org/wiki/Batch_file)

dragon39990
10-23-2008, 09:18 PM
im running it through a batch file but is there anyway for it to recongize the letter or number typed in?

-Dragon****0

Moonbat
10-23-2008, 10:49 PM
This site should help:

http://www.robvanderwoude.com/userinput.html

dragon39990
10-25-2008, 10:44 PM
I'm running into another problem and I can't find help anywhere else.

here is my batch file code.

@echo off
c:
cls
Echo Are you ready to play Mafia Wars?
pause >nul
cls
set /p y/n=(Y/N)-
cls
if %y/n%==n goto exit
if %y/n%==y goto start
:start
Echo My Attack:0
Echo My Defense:0
Echo My *****:$200
Echo My Lives:*
Echo *.Fight a rivel mobster.
Echo 2.Shop
pause >nul
set /p number==
if %number%==* goto fight
if %number%==2 goto shop
:fight
echo *.fight rival mobster *
echo 2.fight rival mobster 2
echo *.fight rival mobster *
echo 4.fight rival mobster 4
echo 5.fight rival mobster 5
echo 6.fight rival mobster 6
set /p number==Enter the number of which you want to fight-
if %number%==* goto mobster*
:shop
:exit

okay heres my question within the bold,underline,italics does the set /p (does this part that goes here does it have to be the same throw out them all?)==