1

Recently I created a small BATCH game.

The thing is, because I'm using Windows' CMD BATCH language the game will not run properly in DOS or DOSbox.

The opening is fine, but once I get to the first player input section, I get a "bad syntax" error.

Does anyone know MS-DOS equivalents of Windows CMD command?

For example, in a CMD based BATCH file I'd use "set ..." to set an input. What would the DOS version of "set..." be?

:start
cls
echo GUESSING GAME
echo.
echo Created By: John Ingram
echo Copyright 2015
echo.
pause
goto :begin

:begin
cls
echo Please enter the number of your desired difficulty setting.
echo.
echo 1) Easy: Guess a number from 1-10
echo 2) Normal: Guess a number from 1-100
echo 3) Hard: Guess a number from 1-1000
echo.
echo Type "Quit" to exit the game.
echo.
echo Have Fun!

set /p choice=Enter: 

if %choice%==1 (
goto :difficulty1
) 

if %choice%==2 (
goto :difficulty2
)

if %choice%==3 (
goto difficulty3
)

if %choice%==quit (
goto :endgame
)

if %choice%==Quit (
goto :endgame
)

if %choice% GTR 3 (
echo.
echo I do not understand that command.
echo.
pause
goto :begin
)

pause

The trouble begins once the player presses a key after starting the game and is brought to the first input section (:begin).

Does this have anything to do with DOS/DOSbox not being able to register "/p" as a SET command?

If so what is the DOS equivalent?

nobody
  • 19,814
  • 17
  • 56
  • 77

1 Answers1

0

I suggest using virtualbox with MSDOS 7.1 instead of DOSBOX. You will receive less trouble as DOSBOX is an simulator, while Virtualbox will run it as if it ran an actual IBM-PC running MSDOS.

You have 1 major flaw in your game:

SET /P CHOICE=ENTER

In DOS, this command does not work. I know a workaround, but I do not know how to make an equation if "%choice%"=="1" . It uses QBASIC.

PRINT ENTER; CHOICE$ will do the job.

PRINT echoes ENTER.
The semicolon ; CHOICE$ sets the variable CHOICE. You need the $ for the variable to be able to contain string.

You can find plenty of QBASIC tutorials online. Once you find one, figure out how to do an if statement on IF CHOICE$ = 1 to open up a file with the contents of :dificulty3.

I may post an IF statement for this is I find one.

Roke
  • 300
  • 1
  • 6
  • 27
  • Thanks for the information. I'll check out QBASIC and VirtualBox. I just have one question though: So in order to make a DOS compatible BATCH file, I shouldn't use any normal Batch scripts and instead write everything based around QBASIC then? Or should I do a hybrid of both (where player inputs are done in QBASIC, but everything else is in normal BATCH)? – JasonWanderer Nov 04 '15 at 00:58
  • I would do a hybrid as the conversion would be much easier, but if the command doesn't work then I would do it in QBASIC, as it has a big library of commands that will probably suite the needs. – Roke Nov 04 '15 at 02:15
  • as far as I know, QBASIC doesn't run on 64bit Windows. To be compatible to both DOS and Windows, you'll have to use DOS commands only (although I'm not quite sure, if all of them will work in Windows). If you want to write a game for DOS only, I'd go for QBASIC and forget Batch. – Stephan Nov 04 '15 at 09:49
  • @Stephan Considering DOS commands may or may not work in Windows, and QBASIC not working in Windows it's probably best if I just focus on DOS. That being said, in terms of DOS commands vs QBASIC would it be less of a hassle to run a program written using DOS commands or is QBASIC completely supported by DOS? – JasonWanderer Nov 04 '15 at 11:25
  • @RookieTEC9 Thanks for the information. I'll probably be focusing on just making something for DOS as it seems like trying to make something work on DOS and Windows may be troublesome. – JasonWanderer Nov 04 '15 at 11:27
  • @Stephan It seems there is something called QB64. Do you think that will work as a bridge between DOS and Windows? – JasonWanderer Nov 04 '15 at 11:50
  • @JasonWanderer: [this site](http://www.qb64.net/wiki/index.php/Main_Page) claims, it will `run on Windows XP, Vista, 7, 8, 8.1, Linux and Mac OSX. It will work on 32 or 64 bit machine`. DOS is a 8 / 16 bit operating system, so I can't imagine, it would run. – Stephan Nov 04 '15 at 18:00
  • @Stephan I really should have realized that myself...thanks for looking into it for me. Additionally, thanks for all the help in general and be patient. I appreciate it. – JasonWanderer Nov 05 '15 at 01:48
  • @Rookie Thanks for the help. I got DOSome to run on Virtual Box and have been writing my game in QBASIC. Once I'm finished I'll just port it to QB64 (and I'll probably make a version using UE4) since, as Stephan said, it runs on Windows. Thanks for all the help, I appreciate it. – JasonWanderer Nov 05 '15 at 01:51