Making a program, not working

June 6, 2012 at 15:36:01
Specs: N/A
here is the code www.tinyurl.com/adventure1234
when i leave the input blank, it prompts again, which is what I want it to do. However, the second if statement is acting like an else statement...whatever I input, it goes right to :wild
any suggestions would be appreciated...thanks!

See More: Making a program, not working

Report •


#1
June 6, 2012 at 22:35:50
Fix your link.


=====================================
Life is too important to be taken seriously.

M2


Report •

#2
June 7, 2012 at 01:08:06
Something wrong with your link,just checkit

Report •

#3
June 7, 2012 at 06:49:07
::Look Forward to seeing the rest you have a great start here
@echo off
echo Welcome to TEXT ADVENTURE!
echo Created by Ben Weiss.
::pause
echo You spawn in the middle of a strange land...
::added /a
set /a A=5
::pause
:action
echo What do you want to do?
:input
echo You can GoNorth, GoSouth, GoEast, or GoWest.
set /P input= %=%
if "%input%"=="" goto :input
if "%input%"=="GoNorth" goto North
:North
if %A%==1 goto wild
if %A%==2 goto wild
if %A%==3 goto wild
::added /a
if %A%==4 set /a A=1 && echo You move North
if %A%==5 set /a A=2 && echo You move North
::added a return to input this should correct the auto wilding
goto input
:wild
echo Ahead is the wild.
echo You cannot move there.
goto action

:: mike


Report •

Related Solutions

#4
June 7, 2012 at 07:58:05
On another note, as a lazy person myself. You may want to change it to

echo You can [N]GoNorth [S]GoSouth [E]GoEast [W]GoWest.
and then
if "%input%"=="N" goto North
no offense intended, but if the game has more than two rooms, this might make things nicer. Again though the scripting is yours, and you may have a good reason for it.

:: mike


Report •

#5
June 8, 2012 at 06:20:03
Sorry man but that script is downright absolutely awful. You seriously need to improve on your "skill". That has to be the worst code i have ever seen.

Report •

#6
June 8, 2012 at 06:29:33
If you are talking about the script posted here, I would agree it needs work, however it looks as though ihaveaquestion is just starting to work with .bat files, The script above is ihaveaquestion's original script with modifications.

you may want to consider

http://www.computing.net/answers/th...

:: mike


Report •

#7
June 8, 2012 at 08:11:06
I am aware of the rules, i just couldn't resist posting that.

Report •

#8
June 9, 2012 at 14:58:45
ok well thanks guys, although i got an answer from another source within 15 minutes of having the issue. i needed capitals, and an else for the input. Thanks anyway!

and p.s. Dod, mikelinus was correct, I'm just starting programming in batch files.


Report •


Ask Question