**REPOSTING** SOM TERMINOLOGY THREAD

#5
Here is a hairy DOS batch file for dumping your games text. I've never really worked with batch files before. I still have to program the three command line tools that will extract the text, but after wading thru all this loopy DOS syntax that should be the easy part.

Quote:@echo OFF

setlocal

if not exist som_db.exe.pot set /p sdbpot=Where is som_db.exe.pot?
if not defined sdbpot (set sdbpot=%cd%\som_db.exe.pot) else (set sdbpot=%sdbpot%\som_db.exe.pot)

if not exist "%sdbpot%" echo som_db.pot does not exist: unable to continue
if not exist "%sdbpot%" goto :eof

if not exist datpot.exe set /p datpot=Where is datpot.exe?
if not defined datpot (set datpot=%cd%\datpot.exe) else (set datpot=%datpot%\datpot.exe)
if not exist prmpot.exe set /p prmpot=Where is prmpot.exe?
if not defined prmpot (set prmpot=%cd%\prmpot.exe) else (set prmpot=%prmpot%\prmpot.exe)
if not exist evtpot.exe set /p evtpot=Where is evtpot.exe?
if not defined evtpot (set datpot=%cd%\evtpot.exe) else (set evtpot=%evtpot%\evtpot.exe)
if not exist PROJECT.DAT set /p prjdat=Where is PROJECT.DAT?
if not defined prjdat set prjdat=%cd%

if not exist "%TEMP%\Swordofmoonlight.com" md "%TEMP%\Swordofmoonlight.com"

set _=%TEMP%\Swordofmoonlight.com\XGETTEXT.bat_

if not exist "%datpot%" echo datpot.exe does not exist: unable to output .dat file contents
if not exist "%datpot%" goto :prm

echo Looking in PARAM folder for .dat files...

if exist "%_%dat.pot" del /Q "%_%dat.pot"
"%datpot%" "--output=%_%dat.pot" "%prjdat%\PARAM\*.dat"

if not exist "%_%dat.pot" echo datpot failure

:prm
if not exist "%prmpot%" echo prmpot.exe does not exist: unable to output .prm file contents
if not exist "%prmpot%" goto :evt

echo Looking in PARAM folder for .prm files...

if exist "%_%prm.pot" del /Q "%_%prm.pot"
"%prmpot%" "--output=%_%prm.pot" "%prjdat%\PARAM\*.prm"

if not exist "%_%prm.pot" echo prmpot failure

:evt
if not exist "%evtpot%" echo evtpot.exe does not exist: unable to output .evt file contents
if not exist "%evtpot%" goto :out

echo Looking in DATA\MAP folder for .evt files...

if exist "%_%evt.pot" del /Q "%_%evt.pot"
"%evtpot%" "--output=%_%dat.pot" "%prjdat%\DATA\MAP\*.evt"

if not exist "%_%evt.pot" echo evtpot failure

:out
set out=%1

if not defined out set /p out=What is the name of the game pot file? [XGETTEXT.POT]
if not defined out set out=XGETTEXT.POT

if exist "%_%dat.pot" (set a=+ "%_%dat.pot") else (set a= )
if exist "%_%prm.pot" (set b=+ "%_%prm.pot") else (set b= )
if exist "%_%evt.pot" (set c=+ "%_%evt.pot") else (set c= )

if defined a goto :fin
if defined b goto :fin
if defined c goto :fin


set /p fin=only som_db.exe.pot exists: continue? [y/N]
if fin==Y goto :fin
if fin==y goto :fin
if fin==N goto :del
if fin==n goto :del
echo assuming No was meant: no output was generated
goto :del

:fin

echo #rename this file like your game's .exe file with a .pot file extension > %out%
echo #don't forget to remove these lines and be sure to save as a UTF-8 file >> %out%
echo. >> %out%

copy /Y /B "%out%" + "%sdbpot%" %a% %b% %c% "%out%"

:del
if exist "%_%dat.pot" del /Q "%_%dat.pot"
if exist "%_%prm.pot" del /Q "%_%prm.pot"
if exist "%_%evt.pot" del /Q "%_%evt.pot"

endlocal

:eof

This was the only way to go without asking people to install Cygwin or anything unfortunately.
Reply



Messages In This Thread
Re: **REPOSTING** SOM TERMINOLOGY THREAD - by HolyDiver - 2009-10-31, 12:16 PM



Users browsing this thread:
2 Guest(s)