[GUIDE] Creating backups on compile

Discussion in 'Tutorials & Resources' started by Idolon, Nov 28, 2016.

  1. Idolon

    aa Idolon the worst admin

    Messages:
    1,576
    Positive Ratings:
    4,683
    Accidents happen, and sometimes you'll end up with a corrupt .vmf. There's a lot you can do to combat this: use Hammer's autosave feature, regularly save your map under a new filename, and so on. However, all of these rely on you being consistent, and if you're like me, you just aren't.

    Another step you can take is creating a backup on every compile. This can be accomplished through either Hammer's Expert Compile menu or CompilePal, and it doesn't require much additional effort from you once you set it up - it just duplicates the .vmf every time you compile.

    Here's how:

    1. Open the compile window (F9). If you aren't already using Expert Compile, It should look like this:

    [​IMG]

    2. Click "Expert..." in the bottom left to open the Expert Compile menu. You'll find this scary looking interface:

    [​IMG]

    3. This menu works by executing a series of commands in order, which are shown in the menu on the left. We're going to add a command by clicking "New." It should add a blank entry to the list at the bottom, which you can move to the top by highlighting this option and clicking "Move Up" a few times.

    [​IMG]

    4. Now we want to configure this command with the menu on the right. Click "Cmds" and choose Copy File.

    [​IMG]

    5. Now we're going to enter "$path\$file.vmf $path\$file.backup.vmf" into the Parameters menu (without quotes). This tells the Copy File command to duplicate your .vmf file into the same directory, but change ".vmf" to ".backup.vmf." (You can change if you'd like your backups to be named differently or if you'd like them to be saved to another folder.) Ultimately, your window should look like this:

    [​IMG]

    6. You'll need to copy this command to all of your configurations so that it happens all of the time. You might also find it helpful to make an additional configuration that just creates a backup without actually compiling a .bsp.

    Note that this method requires that you use Expert Compile for all of your compiles, since you can't configure the simple compile menu to do this. Hammer already comes with a number of configurations that should suit most of your needs, so this isn't that bad - its just a little less friendly looking.

    Download the attached "compilepal-backup.zip," and extract it to your CompilePal folder.

    It contains a backup.exe that should appear in the same folder as CompilePalX.exe, which is the program that actually copies files on compile. Also contained is a new Parameters folder that will replace your existing files, which is what will add a "BACKUP" command to CompilePal.

    You'll need to open "backup.meta" (with Notepad or something similar) in the Parameters folder and replace "C:\Source\Backups" with whatever path you want your backups to be stored at.

    The next time you launch CompilePal, there should be a new command:

    [​IMG]

    Credit for all of this goes to Fubar, who made all of these files and helped me set them up. Thanks dude!
     

    Attached Files:

    • Thanks Thanks x 8
    • Like Like x 1
  2. Hyperion

    aa Hyperion L16: Grid Member

    Messages:
    810
    Positive Ratings:
    618
    While we are at it, how can one save compile options? Sometimes those just reset
     
  3. Werewolf

    aa Werewolf Probably not a real Werewolf

    Messages:
    793
    Positive Ratings:
    235
    Compile settings are stored in the "CmdSeq.wc" file, which itself is located in the bin folder (Steam\SteamApps\common\Team Fortress 2\bin\CmdSeq.wc)

    Personally I have batch file set to copy that file (along with other files) to my backup location (my external HDD) and that batch file runs every time I boot up my PC. Then whenever TF2 updates and those settings revert to default, you just need to copy the CmdSeq.wc back from your backup location to the bin folder.
     
    • Thanks Thanks x 1
  4. Crash

    aa Crash func_nerd

    Messages:
    3,191
    Positive Ratings:
    5,017
    The trick @Egan taught me was just zipping it right in that folder, which you can just unzip in place if you ever need to reverify your game cache.
     
    • Like Like x 1
  5. BigfootBeto

    aa BigfootBeto Too obsessed with perfection

    Messages:
    408
    Positive Ratings:
    599
    I keep getting the error

    * Windows gave the error message:
    "Access is denied."

    :/