VPA and (DosBox) batch files

This forum is for discussion of the VPA client.

Moderators: BitMask, Havok

User avatar
FireAge
Posts: 424

VPA and (DosBox) batch files

Post#1 » Sun Aug 25, 2013 2:33 am

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:
C:\games\VGAPlanets

Folder which contains my installation (I use DOSPlan):
C:\games\VGAPlanets\planets

Folder where my game is located:
C:\games\VGAPlanets\planets\FedWar3

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

@ECHO OFF
REM -----------------------------
REM INITIALIZE
REM -----------------------------
SET DONE=N
SET NRST=1

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
  @ECHO ON
  C:\games\VGAPlan\PCC2\c2unpack -w 6 C:\games\VGAPlan\planets\FedWar3
  @ECHO OFF
  REM Second, call MoveRST with numbers 0 through 999, but stop when the file move has been done.
:while1
  IF %NRST% LSS 1000 (
    IF %DONE%==N (
      CALL :MoveRST %NRST%  
      SET /A "NRST=NRST+1"
      GOTO while1
    )
  )

REM -------------------
REM RUNTRN
REM -------------------
:runTRN
  "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
  @ECHO ON
  PCC2\c2mkturn planets\FedWar3
  PAUSE
  @ECHO OFF
  GOTO End


REM ------------------
REM Move RST Routine, takes a number from 0 to 999 as parameter
REM ------------------
:MoveRST
  REM If DONE is set to Y the routine does not need to do anyting anymore
  IF %DONE%==Y GOTO :EOF
  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
  SET FEXT=%FEXT:~-3%
  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
  @ECHO ON
  MOVE C:\games\VGAPlan\planets\FedWar3\player6.rst C:\games\VGAPlan\planets\Fedwar3\RST\player6.%FEXT%
  @ECHO OFF
  REM Set Done to Y so the routine will not run again
  SET DONE=Y
GOTO :EOF

:End
My DosBox autoexec:

Code: Select all

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

Super Tech
Posts: 69

Re: VPA and (DosBox) batch files

Post#2 » Mon Aug 26, 2013 7:45 pm

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

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

User avatar
streu
Posts: 232
Contact:

Re: VPA and (DosBox) batch files

Post#3 » Tue Aug 27, 2013 5:28 am

FireAge wrote:Folder where my game is located:
C:\games\VGAPlanets\planets\FedWar3
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.


--Stefan

User avatar
FireAge
Posts: 424

Re: VPA and (DosBox) batch files

Post#4 » Tue Aug 27, 2013 2:13 pm

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.

Super Tech
Posts: 69

Re: VPA and (DosBox) batch files

Post#5 » Tue Aug 27, 2013 2:56 pm

Did you get message errors in Fed War 2? That is the only time I have seen them.
Did c2unpack fix that?

User avatar
FireAge
Posts: 424

Re: VPA and (DosBox) batch files

Post#6 » Tue Aug 27, 2013 3:27 pm

Yes, in Fed War 2!

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

Return to “Project 7: VPA”

Who is online

Users browsing this forum: No registered users and 0 guests

cron