PDA

View Full Version : The benefits of using so-called BATCH scripts


blawk
05-09-2006, 12:38 PM
Hi,
I'm sure many people in this forum may have played or know a bit about GNU/Linux. One of the most easy and fast ways to perform repetitive tasks is to make use of so-called shell scripts (ex. Bash scripts). In MS Windows, we have a (more limited, it doesn't support certain statements and operations, among that you need the ResKit if you want to use complex commands) similar language usually referred as "BATCH".

I was working on the files and setup scripts when I found out that I would need to change the UTC/UTI/DLG files for each language inside the installer. I wrote a short script that will do the job pretty well:

@echo off
REM (c) 2006 blawk - making retro-mod multi-language

REM You should change klang value to one of:
REM English=1 Espa˝ol=2 Franšais=3 4=Deutsch 5=Italiano
REM 6=Polski 7=Simplified Chinese 8=Traditional Chinese
REM 9=Korean 10=Japanese
REM -- dlgconv.exe must be in the PATH

SET klang=1

echo ------------------------------------------
echo Files that need to be translated:
echo -- UTI
FOR /R . %%G IN (*.uti) DO (
dlgconv -i %%G -t %klang%)
echo -- Dialog files
FOR /R . %%G IN (*.dlg) DO (
dlgconv -i %%G -t %klang%)
echo -- UTC
FOR /R . %%G IN (*.utc) DO (
dlgconv -i %%G -t %klang%)
echo ------------------------------------------
pause

It can be even more short, just a matter of changing the 'for' statements. As I like to have the otion of a well structured/organized output, I just divided it in 3 sections for UTI, DLG and UTC files. This way you can just redirect the output to a logfile and keep track of the changes.

I'll share other stuff like this as soon as I get ready to release betas of the mod. Moderators, if it applies, feel free to make it sticky/move under the proper sub-forum/section. (Other scripts will get posted in this thread).

BTW, feel free to reply and show your own scripts. I'm sure someone uses something similar to make some tasks easier.

Cheers.

tk102
05-09-2006, 12:53 PM
Did this not work for you?

@echo off
SET klang=1
echo --UTC
dlgconv -i *.utc -t %klang%
echo --UTI
dlgconv -i *.uti -t %klang%
echo --DLG
dlgconv -i *.dlg -t %klang%
echo -------------
pause

blawk
05-09-2006, 01:59 PM
Did this not work for you?

@echo off
SET klang=1
echo --UTC
dlgconv -i *.utc -t %klang%
echo --UTI
dlgconv -i *.uti -t %klang%
echo --DLG
dlgconv -i *.dlg -t %klang%
echo -------------
pause


Does dlgconv recurse sub-directories?
That's what the script does with the FOR statements, "walks up" the path in search for files with .uti, .dlg and .utc extension and automatically chanegs the language with dlgconv.

Cheers.

PS. The script I use for creating the "dist" versions (aka bundle for release to be included when building the installer), performs a similar operation. The only scalable way of working with stuff like this (a "large" mod ala Retro-Mod) is to have a set of scripts to build up the final directory tree (as Kotor Tool's project manager is way too limited).

tk102
05-09-2006, 03:11 PM
Does dlgconv recurse sub-directories
Oops just noticed the /R switch. :)

blawk
05-09-2006, 04:00 PM
Oops just noticed the /R switch. :)

No problem :P

BTW, I'll release the project dist-making script tomorrow. I need to polish some stuff and the like. I think I may end doing something in .NET but it seems like so much work for a simple task.

I really miss a tool to perform specific tasks like setting up base/skeleton structure for concrete projects. Like a cutscene, then it requests you to start filling some lines for the dialog, set animations and involved NPCs and the location of the cut-scene. Then it prepares a base/skeleton structure and all the other stuff is up to you (ex. scripts, effects,...).

And a project management tool would be AWESOME (Fred, if you are reading this, please lemme know when you have the time. I may be able to help with coding & gui design!).

Many times it's not just talent what makes people get the big projects done successfully but the use of the right tools ;) Full-transition/change mods are painful for maintenance and the currently available tools scale too badly for such cases.

I'm off for today, have fun!

Pavlos
05-09-2006, 04:04 PM
Fred has a project manager already included in KT. True, it may not do all of the things you want but it is still the best we have :).

blawk
05-14-2006, 07:18 PM
Some more scripts. This one is what I use for preparing the files I need to manually copy to my Override testing directory. I use it for the area models modifications.

@echo off
@mdlops.exe -k2 261teld.mdl
@del 261teld.mdl 261teld.mdx
@rename 261teld-k2-bin.mdx 261teld.mdx
@rename 261teld-k2-bin.mdl 261teld.mdl


Cheers.