Author Topic: --append doesn't appends when work with BAF?  (Read 3046 times)

Offline vit mg

  • Planewalker
  • *****
  • Posts: 42
  • Gender: Male
    • AERIE team
--append doesn't appends when work with BAF?
« on: April 10, 2008, 11:40:58 AM »
I've got a number of baf files and want to traify and translate them. As they are very small and contains the similar text I want to make only one TRA file for all of them to leave out coincident strings.
So I use
Code: [Select]
weidu --traify baf\foo1.baf --append baf-tra\foo.baf //baf\foo1.baf contains text stringsand then
Code: [Select]
weidu --traify baf\foo2.baf --append baf-tra\foo.baf //baf\foo2.baf contains text strings
But baf-tra\foo.tra file contains only strings from baf\foo2.baf file and doesn't contains any strings from baf\foo1.baf.
Tell me, please, is the bug in my head or in the program? :)

And one more thing. I realize that  WeiDU doesn't create baf-tra directory. If that folder doesn't exist WeiDU returns an error. Is it right thing?
« Last Edit: April 10, 2008, 11:46:42 AM by vit mg »

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: --append doesn't appends when work with BAF?
« Reply #1 on: April 10, 2008, 12:33:40 PM »
I hope somebody with working experience with actual traification will come and help you. Generally speaking, though, I can't think of any way to traify so that the same TRA file is shared between multiple files.
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: --append doesn't appends when work with BAF?
« Reply #2 on: April 10, 2008, 12:40:31 PM »
I have this totally hideous "Search for all BAF strings, copy to new TRA, process duplicates, search for ~string~ in all BAFs replacing with @ reference." But it's probably not what you want. :-)

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: --append doesn't appends when work with BAF?
« Reply #3 on: April 10, 2008, 12:48:05 PM »
OK, it should be something like this:

# for the first file
mkdir baf-tra
weidu --traify baf/firstfile.baf --out baf-tra

# for each subsequent file
weidu --traify baf/nthfile.baf --out baf-tra --traify-old-tra baf-tra/firstfile.tra
rename baf-tra/nthfile.tra baf-tra/firstfile.tra

you'll end up with baf-tra/firstfile.tra and baf-tra/*.baf files.

Double- and triple- check that it does what you want before repeating the process for 1000 files and having some of the originals overwritten or other wrong result, though.
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: --append doesn't appends when work with BAF?
« Reply #4 on: April 10, 2008, 01:05:12 PM »
Yes, my script would do it, except that --traify doesn't currently work on a BAF file containing @x references (which happens behind the scenes if you use --traify-old-tra). If you need this to release a mod soon, tell me so that I can send you the beta link (don't use it for shipping your mod though, just for traification).
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline vit mg

  • Planewalker
  • *****
  • Posts: 42
  • Gender: Male
    • AERIE team
Re: --append doesn't appends when work with BAF?
« Reply #5 on: April 11, 2008, 02:18:24 AM »
Thank you very much!
--traify-old-tra argument is really what I needed instead --append!
I've tried the script you posted and in win/dos command line it looks like this

# for the first file
mkdir baf-tra
weidu --traify baf/firstfile.baf --out baf-tra

# for each subsequent file
weidu --traify baf/nthfile.baf --out baf-tra --traify-old-tra baf-tra/firstfile.tra
copy baf-tra/nthfile.tra baf-tra/firstfile.tra //rename can't override existing files in win

But unfortunately as you said this script doesn't traify all BAFs. I don't really need to release a mod as soon as possible so if you want to make changes in tne next WeiDU versions I can wait.
If not, send me the link please.

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: --append doesn't appends when work with BAF?
« Reply #6 on: April 11, 2008, 03:51:05 AM »
What I mean is, I have a version of WeiDU sitting on my hard drive that can run the script above. If you want that to experimentate and/or to traify your mod, give me a nudge.
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline vit mg

  • Planewalker
  • *****
  • Posts: 42
  • Gender: Male
    • AERIE team
Re: --append doesn't appends when work with BAF?
« Reply #7 on: April 11, 2008, 03:56:51 AM »
Quote from: the bigg
If you want that to experimentate and/or to traify your mod, give me a nudge.
Of course I want to! Post me the link, please - vit-mg@yandex.ru.

Offline vit mg

  • Planewalker
  • *****
  • Posts: 42
  • Gender: Male
    • AERIE team
Re: --append doesn't appends when work with BAF?
« Reply #8 on: April 14, 2008, 02:59:47 AM »
Quote from: the bigg
weidu --traify baf/nthfile.baf --out baf-tra --traify-old-tra baf-tra/firstfile.tra
rename baf-tra/nthfile.tra baf-tra/firstfile.tra

I tried to make a batch file for  win/dos that can traify any modification with the cycle:
Code: [Select]
for %%i in (*.baf) do (weidu --traify %%i --out new\%%i --logapp --log log_baf.txt)But the second commad can't be added into the cycle (or I simply don't know how to do it?).

I imagine, if there will be a command line option like a --out-tra X to set a TRA file to output with the --traify command, the cycle can be made with the only oitput of SETUP.tra:
Code: [Select]
for %%i in (*.baf) do (weidu --traify %%i --out new\%%i --out-tra SETUP.tra --traify-old-tra baf-tra/SETUP.tra --logapp --log log_baf.txt)May I ask you to make it, mr.Bigg? Or it's too hard to realize?
Or maybe somebody know how to automate traifiing BAFs with appending strings into setup-mymod.tra?
« Last Edit: April 14, 2008, 03:42:53 AM by vit mg »

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: --append doesn't appends when work with BAF?
« Reply #9 on: April 14, 2008, 05:09:17 AM »
--out-tra is possible.

For now, if you want to chain multiple commands in a single dos-style for loop, either abuse if (which can use multiple commands via ()), or use call + external bat file. You can't do multiple commands natively in a for loop.

Code: [Select]
for %%i in (*.baf) do if "a" == "a" (
weidu --traify %%i --out new\%%i --logapp --log log_baf.txt --traify-old-tra tra/setup.tra
move new\%%~dpni tra/setup.tra
)
... or something, I'd rather install cygwin and use a Bash-style loop  ;)
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline vit mg

  • Planewalker
  • *****
  • Posts: 42
  • Gender: Male
    • AERIE team
Re: --append doesn't appends when work with BAF?
« Reply #10 on: April 14, 2008, 06:54:27 AM »
Great! As my experience in bash even less then in win/dos command line, I've used this loop for win/dos:
Code: [Select]
for %%i in (*.baf) do if "a" == "a" (
weidu --traify %%i --out new\%%i --logapp --log log_baf.txt --traify-old-tra new\setup.tra
move new\%%~ni.tra new\setup.tra
)
(beta-version 20601 also asked me to use --game path) and all text strings from TP2 and BAF files was moved into the new\setup.tra.

Thank you very much, mr.Bigg!

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: