Het script
Met dank aan
@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