.bat(ch) files, questions/info?

  • If you're asking a question make sure to set the thread type to be a question!

Cerulean

L3: Member
Sep 12, 2008
112
60
I just discovered the power of batch files... including adding extra lines to the compile process in hammer.

Now, hammer adds all of my custom files from a text file into my bsp.... but only the ones that I know I've added, and added to a text file:

bspzip.exe... -addlist $bspdir\$file.bsp path\to\customlist.txt $bspdir\$file.bsp

But, does anyone have anything to say about bspzip vs pakrat (and/or pakrat auto features)??? I'm curious...

And outside of Hammer...

bz2.bat... path/to/bzip2.exe -z -k path/to/teamfo~1/tf/maps/%1.bsp

Copied this to my system32 folder... all I have to do is open a run prompt and type bz2 mapname. I love it. I've added more to this bat to copy the bsp to my srcds map folder, and the bz2 to the srcds map folder and www map folder.



Some questions I have...

Is it possible to batch buildcubemaps? (I'm trying to go from hammer to dedicated server testing in as few steps as possible)

What other cool things can I do with batch files? (and save time searching steam folders for files to copy/open/etc)

And... useful batch files for the executables hiding in the sourcesdk bin?
 
Last edited:

nossie

L3: Member
May 9, 2008
107
4
ok first off i dont know much about batch files but all i know is that basically they do commands instantly instead of you doing them. so you can practiclly get it to type a essay if u wanted to... (dno why u would tho lolz) u can get it to search the computer excute files at certain times (not sure tho). the buildcubemaps probably wont be able to be done as i think u actually have to be ingame to build them. not too sure tho
and yes u can run executables in the sourcesdk bin

try searching on google to see what else you can do
 

Apom

L6: Sharp Member
Sep 14, 2008
366
65
One tip I can give you is to not put your file in the System32 folder - because, well, it's really not a system file. Put it in your sourcesdk/bin folder instead.

I understand that the reason why you did it is because you wanted to run your program without having to type the whole C:\ program files\etc. thing. The proper way to do this is to go to your windows control panel > system > advanced, click on environment variables, find PATH in the list of system variables, and add your sourcesdk/bin folder to the list of folders that's already here (it's semicolon-separated).
 

Cerulean

L3: Member
Sep 12, 2008
112
60
Thanks for the PATH info...

I just took the .bat's out of my system32 folder and put them all in a batch folder with my other mapping tools. (and added that folder to the Path)
 

Apom

L6: Sharp Member
Sep 14, 2008
366
65
Glad I could help. Also, those commands you call in hammer with your "build" button could actually be called directly from a batch file (vbsp, vvis and vrad all are executable files).
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
I use this to compile. You may find it of interest... possibly. For me at least, it's way faster than compiling with hammer when dealing with smaller maps, because hammer seems to actually wait for the slow UI update of all the stuff the compilers report.

Also, cubemaps are built off the rendering engine, so there's no way to do that through the compilers.
 

Brandished

L5: Dapper Member
Jan 19, 2008
234
311
You can do a bunch of stuff with batch files, I listed a few things here. You can't build cubemaps via batch files (as far as I know) as the process uses the HL2 (source) engine to do so.

You can supposedly compile the map without using Hammer, I haven't tried this myself, but saw this in an email from the hlmappers mailing list a while back, Steam would probably have to be running for this to work:

All you need to do is make a file say "compilefast.cmd" in the same folder as your VMF.

It's important to make sure your SDK Launcher has the correct game selected for this to work, occasionally I've found it necessary to select the game in the launcher and the exit the SDK launcher then run it again for the setting to take.

===============
// compilefast.cmd example for EP1 game maps.

// use the following line if you keep map versions (good idea)
// copy mapname_version.vmf mapname.vmf

"%sourcesdk%\bin\ep1\bin\vbsp.exe" -game "%VProject%" "mapname"
"%sourcesdk%\bin\ep1\bin\vvis.exe" -fast -game "%VProject%" "mapname"
"%sourcesdk%\bin\ep1\bin\vrad.exe" -game "%VProject%" "mapname"

copy "mapname" "%VProject%/maps/"

@pause
===============

for EP2 maps (TF2 and eventually DODS) use:
%sourcesdk%\bin\orangebox\bin\

for the root path to the compile binaries.

for a full VIS just remove the "-fast" from the vvis.exe line.
for a final VRAD just add "-final" to the vrad line.

KevinO