Post Thu May 25, 2006 11:12 pm

** Tutorial ** - Efficiently making mods

I don't know how many people are interested in this, but I know that when I am doing a lot of modding, I can get very tired of doing the same steps over and over again. I have a specific way I do my modding, and I thought it would be nice to share it with y'all.

First of all, let's go over how this normally works. If you just made a change to your mod, this is normally how you would test it out:

1. Deactive and delete the previous version of the mod in FLMM
2. Start a zip utility (such as winzip, winace, etc.), find your mod's files, select them all, and zip the files together
3. delete the old .zip.flmod file
4. rename the zip file with a .flmod extension
5. double-click on the mod
6. have fun

I found a way to automate steps 2 through 5. You'll only need one tool; a command-line zip utility. I use info-zip, which you can obtain at http://www.info-zip.org/. I have all my work-in-progress mods stored in a folder called "My Mods", each mod having its own subfolder. I put the zip.exe file in the My Mods folder. Then, in each mod, I keep three .bat files. A .bat file is a series of commands that windows will execute when you double-click on the filename. The idea is that the .bat file will use the zip utility to zip our mod, but we don't want to keep the .bat file in with the mod. Thus the three .bat files. Here are the contents of three example .bat files from one of my mods which resides in the "shuttle" subfolder of the "my mods" folder:

makemod.bat

move "instructions.bat" ..
move "lastwords.bat" ..
cd..
instructions

instructions.bat

cd "shuttle"
del "shuttle.zip.flmod"
move "makemod.bat" ..
cd..
zip -r "shuttle" "shuttle"
ren "shuttle.zip" "shuttle.zip.flmod"
move "shuttle.zip.flmod" "shuttle\"
move "lastwords.bat" "shuttle\"
move "makemod.bat" "shuttle\"
cd "shuttle"
start shuttle.zip.flmod
lastwords

lastwords.bat

cd..
move "instructions.bat" "shuttle\"

And that's it. Now, the process for testing a new version of a mod is:

1. Deactive and delete the previous version of the mod in FLMM
2. double-click on makemod.bat
3. have fun

If you just want to use the technique without understanding it, you can just copy the contents above into .bat files with the same name - the only changes you'll have to make are to change any occurance of the word "shuttle" to the name of your mod. If you want to understand how this works, read on.

When you execute makemod.bat, it moves the other two .bat files one folder up (two periods is the windows/dos symbol for one directory up). Then, it moves the working folder one folder up ("cd" means change directory). It then executes instructions.bat. I would have just had makemod.bat move itself, but I have had bad experience with that in the past - it is generally not advisable to have a .bat file move or delete itself. The first thing instructions.bat does is delete the old .zip.flmod file, then it moves makemod.bat up one directory. Then, it executes zip to create the new .zip file (the -r is an argument for infozip - it means "recurse through directories" ). Then, it renames the .zip file to a .zip.flmod file. After than, it moves everything (except for itself) back into the mod's directory. Then, it opens the .zip.flmod file in FLMM. It does this with the "start" command, which is basically the same thing as double-clicking on the file from a folder browser. Finally, it executes lastwords.bat. lastwords.bat then just moves instructions.bat back into the mod's folder.

Note that if you choose, instead of keeping zip.exe one folder up from your mod's folder, you can also put it someplace recognized by the windows path variable. I know it may seem like a lot of work just to save a few seconds, but this method has tremendously sped up my modding. Just post if you have questions - thanks!

I have become one with my computer. It is a feeling of ecstasy...the perfect blend of logic and emotion. I have reached...Nerdvana!

Edited by - Overkill on 5/26/2006 12:13:32 AM