Computer Hope

Software => Computer programming => Topic started by: Adam Roger on July 30, 2004, 02:16:50 AM

Title: Creating a game with a batch file.
Post by: Adam Roger on July 30, 2004, 02:16:50 AM
Hey im learning how to create Batch files, and i was thinking, is thier a way to creat a type of game with that. Like you you have an option to go 3 different ways kinda and you press 1 to go one way and 2 to go another and ext.. is that possilbe if so can you help me out?
Title: Re: Creating a game with a batch file.
Post by: contrex on July 03, 2007, 02:07:01 PM
Another old timer back from the grave...
Title: Re: Creating a game with a batch file.
Post by: Dark Blade on July 04, 2007, 12:25:20 AM
I wonder if the OP is around anymore... probably not. But I attached a .bat game I found on this site.

[Saving disk space -  old attachment deleted by admin]
Title: Re: Creating a game with a batch file.
Post by: gamerx365 on July 10, 2007, 08:06:59 PM
sure i can help you out with a sample code, although I may not be the best at .bat and the code would be long. here:
Code: [Select]
@echo off
Title Sample Adventure Game
color 20
REM By Seth Howard
REM Posted on Computerhope.com Forums
echo Welcome to the Adventure Game!
echo pause
:road
CLS
echo You are Walking down the road, and it forks. Which
echo way do you go?
echo.
echo 1.Left
echo 2.Right
set choice=
set /p choice=Please Press a number and press enter. 
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto l1
if '%choice%'=='2' goto r1
CLS
ECHO "%choice%" is not valid please try again
pause
goto road
:l1
CLS
echo You go left and see a monster. It eats you and you die.
echo.
echo Play again? (y/n)
set choice=
set /p choice=Please Press a number and press enter. 
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='y' goto road
if '%choice%'=='n' exit
CLS
ECHO "%choice%" is not valid please try again
pause
goto l1
:r1
CLS
echo You go right and the is a giant pickle that wants to fight
echo you. What do you do?
echo.
echo 1.Fight it!
echo 2.Run past it
set choice=
set /p choice=Please Press a number and press enter. 
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto fight1
if '%choice%'=='2' goto run1
CLS
ECHO "%choice%" is not valid please try again
pause
goto r1
and you would keep adding to it. I will make one and post it eventually
Title: Re: Creating a game with a batch file.
Post by: Carbon Dudeoxide on July 10, 2007, 10:13:37 PM
I wonder if the OP is around anymore... probably not. But I attached a .bat game I found on this site.
Yeah, Jarjee. He's in my school, a year higher than me.
He showed me that game and told me what all the commands do and everything.
Actually he is the reason why I got into Batch programming.
Thanks man (even though you don't come online anymore)  ;D
Title: Re: Creating a game with a batch file.
Post by: Carbon Dudeoxide on July 11, 2007, 12:07:47 AM
sure i can help you out with a sample code, although I may not be the best at .bat and the code would be long. here:
Code: [Select]
[color=red][i]Code removed[/i][/color]
and you would keep adding to it. I will make one and post it eventually
I'm trying to make one myself, i'm needing to use several files for the one game.
using the GOTO command makes it too confusing.
Title: Re: Creating a game with a batch file.
Post by: gamerx365 on July 11, 2007, 06:50:03 AM
right right. k i wont post it if i make one and sorry i cant help you any further. GOTO is all I know how to use but I guess you can try using CALL. it never worked for me
Title: Re: Creating a game with a batch file.
Post by: Carbon Dudeoxide on July 11, 2007, 07:37:01 AM
Quote
i wont post it if i make one and sorry i cant help you any further.
Wait, theres some misunderstanding here. You can post it, no one is stopping you.

If you're wondering why I removed the code from my other post, it was because it's very long.

I'm gonna post mine when i'm done......