Page 1 of 1

VPA and (DosBox) batch files

Posted: Sun Aug 25, 2013 2:33 am
by FireAge
All VPA users, share your batch files. What do you use to call your VPA and DosBox. This is the place to show. Maybe other people can profit from it. I'll start by sharing my batch which is of course open for improvements :)

Folder with everything that is VGAPlanets:

Folder which contains my installation (I use DOSPlan):

Folder where my game is located:

My batch is commented, so should be easy to follow.
1: It checks if a new .TRN file has been found, if so, does step 2 and 3, otherwise skips to 4.
2: Extracts the file using c2unpack from PCC2
3: Moves the file to a subfolder called RST and changes the extention to the turn number
4: Starts VPA in a DosBox using my specific configuration file.

My Batch File:

Code: Select all

REM -----------------------------
REM -----------------------------

REM GO TO Planets folder
CD /D C:\games\VGAPlan\planets

REM Check if rst file exists and if not goto runTRN
IF NOT EXIST FedWar3\player6.rst GOTO runTRN
  REM First unpack with c2unpack
  C:\games\VGAPlan\PCC2\c2unpack -w 6 C:\games\VGAPlan\planets\FedWar3
  REM Second, call MoveRST with numbers 0 through 999, but stop when the file move has been done.
  IF %NRST% LSS 1000 (
    IF %DONE%==N (
      CALL :MoveRST %NRST%  
      SET /A "NRST=NRST+1"
      GOTO while1

REM -------------------
REM -------------------
  "C:\Program Files (x86)\DOSBox-0.74\DOSBox.exe" -conf "C:\games\VGAPlan\Planets\FedWar3\2_dosbox-FedWar3.conf" -noconsole -exit 
  CD /D C:\games\VGAPlan
  PCC2\c2mkturn planets\FedWar3
  GOTO End

REM ------------------
REM Move RST Routine, takes a number from 0 to 999 as parameter
REM ------------------
  REM If DONE is set to Y the routine does not need to do anyting anymore
  REM Create the extension with the parameter, 1 becomes 001, 91 becomes 0091, 234 becomes 00234
  SET FEXT=00%1
  REM Take the last 3 characters from FEXT
  REM Look if file exists and if so, skip the routine
  IF EXIST C:\games\VGAPlan\planets\Fedwar3\RST\player6.%FEXT% GOTO :EOF

  REM The file did not exist, so move it
  MOVE C:\games\VGAPlan\planets\FedWar3\player6.rst C:\games\VGAPlan\planets\Fedwar3\RST\player6.%FEXT%
  REM Set Done to Y so the routine will not run again

My DosBox autoexec:

Code: Select all

# Lines in this section will be run at startup.
# You can put your MOUNT lines here.
mount c: C:\games\vgaplan\planets
.\vpa 6 FedWar3
What I still need to improve:
I need to find a way to get UFO4VPA to run inside the DosBox autoexec.

Re: VPA and (DosBox) batch files

Posted: Mon Aug 26, 2013 7:45 pm
by Super Tech
Fire Age,
Why doesn't UFO4VPA run? Does it give an error? How do you call it?

May I suggest putting the complex code in one file used by all games. Also, one .conf file can be used for all games.
Then I have many simple batch files for each game. This makes development modular
Here is my example.

For each game I have a batch file like this. G330.bat

Code: Select all

set mygame=G330
set myrace=8
core %myrace% %mygame%
Then I have just one "core.bat" batch file that is simple now, but I plan to expand it.
Note that a file called vpa.bat is created by echo command

Code: Select all

set myrace=%1
set mygame=%2
echo vpa %myrace% \%mygame%>c:\dos\vpa.bat
"C:\Program Files\DOSBox-0.74\DOSBox.exe" -conf c:\dos\vpa.conf -noconsole -exit
c:\dos\PCC2\c2mkturn \dos\%mygame%
I have just one .conf file called by the single core.bat file.

Code: Select all

# Lines in this section will be run at startup.
# You can put your MOUNT lines here.
mount C C:\DOS
call \vpa.bat
This is new but tested. May not work with game directories with spaces.

Re: VPA and (DosBox) batch files

Posted: Tue Aug 27, 2013 5:28 am
by streu
FireAge wrote:Folder where my game is located:
An important thing for VPA (and Dosplan, and PCC 1.x) users is to keep the file and directory names 8 characters or shorter, and avoid spaces. "VGAPlanets" is too long (that's why you used "VGAPlan" in your batch file). "FederationWar3" would be too long, and VPA wouldn't understand "Fed War3" either (note the space), although it is just 8 characters.

The error messages you get when your file names are too long usually don't say "Your file names are too long", but something more confusing like "File not found", "Cannot create", "Registration not found", etc.


Re: VPA and (DosBox) batch files

Posted: Tue Aug 27, 2013 2:13 pm
by FireAge
I think UFO4VPA was complaining about missing files. Haven't had the time to try again.
Probably will get it to work, but I need to have the newest version by Qapla, as the older version does not work right with the newest VPA.

@strue, you are right of course, indeed I put it in VGAPlan.

The reason I use c2unpack instead of vpa for unpacking, is dat vpa still gives me error messages from time to time, not being able to read a certain message. Doesn't happen a lot though.

I like the idea of making a more general batch file which uses arguments for its call. Good idea.

Re: VPA and (DosBox) batch files

Posted: Tue Aug 27, 2013 2:56 pm
by Super Tech
Did you get message errors in Fed War 2? That is the only time I have seen them.
Did c2unpack fix that?

Re: VPA and (DosBox) batch files

Posted: Tue Aug 27, 2013 3:27 pm
by FireAge
Yes, in Fed War 2!

Didn't try c2unpack in that game yet.
Running it in BrassTacks15.