-
March 19th, 2013, 04:23 PM
#1
ELSE issue?
I'm making a text adventure in pure Batch, and made a test level, as shown below.
Code:
echo What do?
echo.
set /p var=Input Command:
if %var%==i goto inventory
if %var%==inventory goto inventory
if %var%==l goto look
if %var%==look goto look
if %var%==inspect goto look
if %var%==examine goto look
if %var%==xyzzy goto cliche
if %var%==potato goto potato
else echo I dont understand.
The idea here is that if you type in a command that isn't one of the ones listed, it says it doesn't understand.
Yet, if I type in an unknown command, it just goes back to the start of that level.
What's going on?
Thanks!
~DigiDuncan
-
March 20th, 2013, 03:06 PM
#2
Re: ELSE issue?
Try
Code:
if %var%==potato (
goto potato
) else (
echo I dont understand.
)
see the help (type help if in a console window)
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|