**Tutorial** No more Trailing References!
This is a tutorial for the advanced modder or programmer. If you are new to making FL mods, and haven't even figured out how to get things to work yet... this is not for you. But, for those of you who're advanced modders, or working on new and improved versions of your mods... this is some very powerful mojo for getting rid of one of the bigger instability-causing things commonly left in mods: blank lines, which cause the following error to show up in Spew/Spit:
WARNING:General: DA SYSTEM: trailing references
Trailing References are lines that should've been stripped from INI scripts... but weren't. These are blank lines, and they aren't handled well by FL's script parser, unlike Comment lines (lines that start with ; ).
I can now confirm that Trailing References are a major contributor to mod instability. Good coders seeking the best possible experience for players should not leave blank lines in their code, in short. Having removed all of the blank lines from the FL SDK, I was astounded by how much faster the game loaded, and how much greater my mod's stability was- especially when running a server, where almost of the stability issues are in the INIs.
So, after this long buildup... here are step-by-step instructions:
1. Download 12Ghosts' "SuperGee" software from http://www.12Ghosts.com . Bear in mind that SuperGee is a big, bundled set of utilities (some of which have NOTHING to do with text-editing... and I have no idea whether they're worth using or not... so this isn't a blanket recommendation of 12Ghosts.)
2. Open up 12Ghosts Replace.
3. Go down to the list of "File Names Containing", and DELETE all entries EXCEPT for .XML and .INI (which you will have to add). Do NOT, repeat, NOT forget to add the period before the file extensions, or you might hose your mod. And make SURE to do this step before doing the next step, or you WILL destroy things like CMPs. Just warning you now...
4. Back up you *entire* mod- everything in the mod, including graphics and sound and CMPs and everything. Really. You're about to do something that could (potentially) ruin lots of hard work- text editors that can edit Hex are *very* powerful (and dangerous) tools. And you may have made a mistake- we all do that occasionally...
5. Click on the little folder next to the Search Path, and select your mod's folder. Double-click on the folder. Now you're ready.
6. In the "Search for" field, enter this string: \:n\:r\:000
This string basically means, "search/grep for a New Line followed by a Carriage Return followed by a Null"- i.e., a blank line (not a comment line or anything else we should keep).
7. In the "Replace with" field, enter this string: \:r\:000
So now we're getting rid of all of those New Line tags, which effectively deletes all of the empty lines from our INI.
Now... before doing this... be fully aware and warned... TEST this, back your stuff up... and do it *very* carefully. Batch-processes of this sort CAN destroy all sorts of things on your computer... so this is not a tool that you want to use unless you are fully aware of the consequences, should you screw up, and take all precautions. And by no means should anybody use this tool if they're unaware of its power to destroy as well as change.
That said... I used this tool to completely fix all of the INIs in the FL SDK in 15 seconds... and the decrease in load times (and the increase in overall stability) was quite large. And I'm going to use this tool from here on out on all of my mods, because it's definately the way to go. You won't want to do this until you're sure your mod's ready to release, unless you're like me and just use a lot've comment lines (which apparantly get stripped by the FL parser without causing Trailing References errors).
WARNING:General: DA SYSTEM: trailing references
Trailing References are lines that should've been stripped from INI scripts... but weren't. These are blank lines, and they aren't handled well by FL's script parser, unlike Comment lines (lines that start with ; ).
I can now confirm that Trailing References are a major contributor to mod instability. Good coders seeking the best possible experience for players should not leave blank lines in their code, in short. Having removed all of the blank lines from the FL SDK, I was astounded by how much faster the game loaded, and how much greater my mod's stability was- especially when running a server, where almost of the stability issues are in the INIs.
So, after this long buildup... here are step-by-step instructions:
1. Download 12Ghosts' "SuperGee" software from http://www.12Ghosts.com . Bear in mind that SuperGee is a big, bundled set of utilities (some of which have NOTHING to do with text-editing... and I have no idea whether they're worth using or not... so this isn't a blanket recommendation of 12Ghosts.)
2. Open up 12Ghosts Replace.
3. Go down to the list of "File Names Containing", and DELETE all entries EXCEPT for .XML and .INI (which you will have to add). Do NOT, repeat, NOT forget to add the period before the file extensions, or you might hose your mod. And make SURE to do this step before doing the next step, or you WILL destroy things like CMPs. Just warning you now...
4. Back up you *entire* mod- everything in the mod, including graphics and sound and CMPs and everything. Really. You're about to do something that could (potentially) ruin lots of hard work- text editors that can edit Hex are *very* powerful (and dangerous) tools. And you may have made a mistake- we all do that occasionally...
5. Click on the little folder next to the Search Path, and select your mod's folder. Double-click on the folder. Now you're ready.
6. In the "Search for" field, enter this string: \:n\:r\:000
This string basically means, "search/grep for a New Line followed by a Carriage Return followed by a Null"- i.e., a blank line (not a comment line or anything else we should keep).
7. In the "Replace with" field, enter this string: \:r\:000
So now we're getting rid of all of those New Line tags, which effectively deletes all of the empty lines from our INI.
Now... before doing this... be fully aware and warned... TEST this, back your stuff up... and do it *very* carefully. Batch-processes of this sort CAN destroy all sorts of things on your computer... so this is not a tool that you want to use unless you are fully aware of the consequences, should you screw up, and take all precautions. And by no means should anybody use this tool if they're unaware of its power to destroy as well as change.
That said... I used this tool to completely fix all of the INIs in the FL SDK in 15 seconds... and the decrease in load times (and the increase in overall stability) was quite large. And I'm going to use this tool from here on out on all of my mods, because it's definately the way to go. You won't want to do this until you're sure your mod's ready to release, unless you're like me and just use a lot've comment lines (which apparantly get stripped by the FL parser without causing Trailing References errors).