Batched conversion script?
by Erik Madison · in Constructor · 10/03/2007 (2:10 pm) · 4 replies
Anyone written a script/plugin that will read a directory of .maps and autoexport them to the newest dif format? I'm sitting on hundreds of purchased contents, most exported for TGE when I only use TGEA. I'd love a simple method of quickly converting them (barring any with errors, I can attack manually later).
About the author
#2
10/08/2007 (3:04 pm)
I wrote a perl script a while back to do it. I ran into problems with texture directories as it recursively reached into directories. I guess a .map parser could be written to massage the texture calls. I'll see if I can find it. It was a *LONG* time ago and *VERY* hackish.
#3
1) Locate map2dif_plus.exe. It's in your Constructor root folder.
2) Create a file called "Map2DIFBatch.bat" in the same folder and copy the following lines into it:
3) Create a folder full of .map files (for instance "[Constructor Root]\mymaps\").
4) Go to a command prompt, navigate to the folder with the script and type at the prompt:
Map2DIFBatch.bat [path to map files folder]
for instance:
Map2DIFBatch.bat ./mymaps/
It will run map2dif_plus on every .map file it finds in the specified folder and output them into the same folder. It may display errors about not finding textures but I think this is fixed when you put the DIF with the textures again. I have to admit, I never work with MAP files so I don't really know how the export is supposed to work (with textures and such). Either way, maybe this script will give you a good start (adding new switches onto map2dif_plus line).
Again, I'm no batch file guru so anyone is welcome to refine my script.
Hope this helps.
10/08/2007 (3:11 pm)
Ok, Erik. I took a quick pass at writing a batch script. I'm not sure if this will be helpful because there has got to be a simpler way of doing this (like maybe a way of providing map2dif_plus with a list of files?), but...1) Locate map2dif_plus.exe. It's in your Constructor root folder.
2) Create a file called "Map2DIFBatch.bat" in the same folder and copy the following lines into it:
@echo off echo --------------------------- echo Converting MAP files in %1 echo --------------------------- FOR %%f IN (%1*.map) DO map2dif_plus %1%%f echo --------------------------- echo Done echo --------------------------- pause
3) Create a folder full of .map files (for instance "[Constructor Root]\mymaps\").
4) Go to a command prompt, navigate to the folder with the script and type at the prompt:
Map2DIFBatch.bat [path to map files folder]
for instance:
Map2DIFBatch.bat ./mymaps/
It will run map2dif_plus on every .map file it finds in the specified folder and output them into the same folder. It may display errors about not finding textures but I think this is fixed when you put the DIF with the textures again. I have to admit, I never work with MAP files so I don't really know how the export is supposed to work (with textures and such). Either way, maybe this script will give you a good start (adding new switches onto map2dif_plus line).
Again, I'm no batch file guru so anyone is welcome to refine my script.
Hope this helps.
#4
Thanks though, anyways.
10/09/2007 (12:38 pm)
Running a batch file on map2dif+/- is easy. However, I want the new constructor format which works in both TGE and TGEA. So, I need a constructor specific script. I'm sure it's easy, a huge chunk of constructor is simple TS. I simply don't have the time to learn how/where they do things for just a small task like this, I'd rather focus my time on the engine itself. A few out there have begun writing plugins, so I figured someone is already intimate with the product and would know a trivial method of doing this.Thanks though, anyways.
Torque Owner Masser
Sorry I couldn't be of more help with an actual script.