DOS coding help

Post » Fri Jul 22, 2011 7:17 pm

This is a noob question but why wont his code work.

@echo off:MAINEcho.Echo.echo.echo welocomez to teh quizesecho.echo to begin press A and then enterecho for instructions press B tehn entarecho should you need to piss press C tehn teh enterzset /p input input=COMMAND?if %input%==A goto GAMEif %input%==B GOTO INSTif %input%==C exit:INSTtype INST.txtecho type in capitalsecho.echo.echo to start press Aecho to goto main press Bset /p input=COMMAND?if %input%==A goto GAMEif %input%==B goto MAINif %input%==C exit:GAMEecho.echo.echo welcome to teh gamez!echo.echo time for teh first questionecho.echo what comes first: A or Bset /p input=COMMAND?if %input%==B goto WRONG:WRONGecho YOU svck AND GOT IT WRONG PRESS A KEY TO ADMIT DEFEATpausegoto MAIN:2

User avatar
Nomee
 
Posts: 3382
Joined: Thu May 24, 2007 5:18 pm

Post » Fri Jul 22, 2011 8:15 am

This is a noob question, but why on earth would you use that abomination instead of a proper programming language?
User avatar
Astargoth Rockin' Design
 
Posts: 3450
Joined: Mon Apr 02, 2007 2:51 pm

Post » Fri Jul 22, 2011 6:20 am

This is a noob question, but why on earth would you use that abomination instead of a proper programming language?

And why join these forums just to post this?
User avatar
Veronica Martinez
 
Posts: 3498
Joined: Tue Jun 20, 2006 9:43 am

Post » Fri Jul 22, 2011 5:04 am

And why join these forums just to post this?

Maybe it's someone from the programming thread just trying to make all the programming nerds on the forum have nightmares about GOTO statements by reminding them of BASIC :cold:
User avatar
ImmaTakeYour
 
Posts: 3383
Joined: Mon Sep 03, 2007 12:45 pm

Post » Fri Jul 22, 2011 9:07 am

Maybe it's someone from the programming thread just trying to make all the programming nerds on the forum have nightmares about GOTO statements by reminding them of BASIC :cold:


Please do not even mention the word BASIC to me I still have nightmares about programming in that archaic language. Went from C++ to programming BASIC as part of my credits for my AA degree and that language made me want to tear off my arms then beat myself with them for taking that class. As for the OP I really have no clue the only thing that looks odd to me is the :2 thing at the end since i've never seen anything end with that kind of statement.
User avatar
lauren cleaves
 
Posts: 3307
Joined: Tue Aug 15, 2006 8:35 am

Post » Fri Jul 22, 2011 7:23 am

This is a noob question, but why on earth would you use that abomination instead of a proper programming language?

Hey, don't Bash batch scripts :P

(I know... that was bad, I'm sorry)


There are advantages to batch scripts, but only when just automating various command-line tasks (I have a few I regularly use at work), not like in the OP's example.
User avatar
Richus Dude
 
Posts: 3381
Joined: Fri Jun 16, 2006 1:17 am

Post » Fri Jul 22, 2011 10:19 am

This is a noob question but why wont his code work.

@echo off:MAINEcho.Echo.echo.echo welocomez to teh quizesecho.echo to begin press A and then enterecho for instructions press B tehn entarecho should you need to piss press C tehn teh enterzset /p input input=COMMAND?if %input%==A goto GAMEif %input%==B GOTO INSTif %input%==C exit:INSTtype INST.txtecho type in capitalsecho.echo.echo to start press Aecho to goto main press Bset /p input=COMMAND?if %input%==A goto GAMEif %input%==B goto MAINif %input%==C exit:GAMEecho.echo.echo welcome to teh gamez!echo.echo time for teh first questionecho.echo what comes first: A or Bset /p input=COMMAND?if %input%==B goto WRONG:WRONGecho YOU svck AND GOT IT WRONG PRESS A KEY TO ADMIT DEFEATpausegoto MAIN:2


At the quiz, If you enter A, you don't have any IF statement directing it away to accept or aknowledge this response, as such the process contines through the lines in order, including your wrong section.

Perhaps change it such that - instead of testing for B, test for the absence of A (if %input%<>A goto WRONG) - this allows you not to "Correctly" answer by pressing C

then add a few lines to aknowledge the right answer

echo Yay, you're not a moron.
goto MAIN
User avatar
Tikarma Vodicka-McPherson
 
Posts: 3426
Joined: Fri Feb 02, 2007 9:15 am

Post » Fri Jul 22, 2011 7:45 am

Boomerang is still my favourite games.
User avatar
Sakura Haruno
 
Posts: 3446
Joined: Sat Aug 26, 2006 7:23 pm

Post » Fri Jul 22, 2011 10:51 am

DOS? But.. why? It could be useful for automatic file copying/deleting/renaming commands, but why? You make me want to cry. ,_,
User avatar
Jennie Skeletons
 
Posts: 3452
Joined: Wed Jun 21, 2006 8:21 am

Post » Fri Jul 22, 2011 5:57 am

First, I have to ask... why a batch file?

Secondly, it's not working because you have several errors in the code, the most notable of which is this:
set /p input input=COMMAND?
which should instead be
set /p input=COMMAND?

User avatar
Stay-C
 
Posts: 3514
Joined: Sun Jul 16, 2006 2:04 am


Return to Othor Games