Important Message

You are browsing the archived Lancers Reactor forums. You cannot register or login.
The content may be outdated and links may not be functional.


To get the latest in Freelancer news, mods, modding and downloads, go to
The-Starport

**Tutorial** No more Trailing References!

Here you find the different tutorials on editing and MODing Freelancer

Post Thu Feb 24, 2005 10:42 pm

**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).

Post Wed Mar 02, 2005 1:16 am

Hi Argh.

I think you should have a little feed back on this.

I did what you said and thats fine, it claimed to change a number of things, so thats great.

But..

After completion it corrupted my MPnew charatcer.ini file, it wouldnt load. Now this isnt a big problem, because, its a small file and I had made a backup - as you quite rightly said ,i was in two minds if to include the files in the .exe folder anyway.

I was looking in some of the .ini's particularly the shiparch.ini. After this process, the title of a new ship entry = [ship...this had been moved up to the end of the line of the previous entry. so it had not recognised the carriage return. This happened in various other entries as well.

Maybe if people want to try this, they should try one folder/ini at a time, when its completed it's task, re-check the ini, so that it looks ok.

Good find tho, Argh. thanks for the post. I will continue to use it...just won't do the whole mod in one go...lol

Post Sun Mar 06, 2005 7:32 am

Yeah, it's definately something you want to be careful about, and back your stuff up first. I'll see what happens when I try it on Shiparch over here... <goes and tests>

Hmm. Well, I didn't have the problem you described. Make very certain that you've gotten the grep terms right... if you get *anything* wrong, you can lose more than just blank lines.

Here's what my Shiparch.ini looks like:
<pre><font size=1 face=Courier>
[Simple
nickname = generic_pilot
DA_archetype = equipment\models\pilot\ship_pilot.3db
material_library = Equipment\models\pilots.mat
LODranges = 0, 50
MinSpecLOD = 2
[Ship
ids_name = 237034
ids_info = 66570
ids_info1 = 66571
ids_info2 = 66608
ids_info3 = 66572
ship_class = 0
nickname = li_fighter
LODranges = 0, 40, 60, 140, 300, 1000
msg_id_prefix = gcs_refer_shiparch_Liblf
mission_property = can_use_berths
type = FIGHTER
mass = 100.000000
hold_size = 25
linear_drag = 1.000000
fuse = li_fighter_gas01, 0.000000, -1
fuse = li_fighter_smoke01, 0.000000, -1
fuse = intermed_damage_smallship02, 0.000000, 400
fuse = intermed_damage_smallship03, 0.000000, 200
max_bank_angle = 35
camera_offset = 6, 22
camera_angular_acceleration = 0.050000
camera_horizontal_turn_angle = 23
camera_vertical_turn_up_angle = 5
camera_vertical_turn_down_angle = 30
camera_turn_look_ahead_slerp_amount = 1.000000
nanobot_limit = 12
shield_battery_limit = 12
hit_pts = 1300
DA_archetype = ships\liberty\li_fighter\li_fighter.cmp
material_library = ships\liberty\li_playerships.mat
material_library = fx\envmapbasic.mat
envmap_material = envmapbasic
cockpit = cockpits\liberty\l_fighter.ini
pilot_mesh = generic_pilot
explosion_arch = explosion_li_fighter
surface_hit_effects = 0, small_hull_hit_light01, small_hull_hit_light02, small_hull_hit_light03
surface_hit_effects = 150, small_hull_hit_medium01, small_hull_hit_medium02, small_hull_hit_medium03
surface_hit_effects = 300, small_hull_hit_heavy01, small_hull_hit_heavy02, small_hull_hit_heavy03
steering_torque = 24000.000000, 24000.000000, 58000.000000
angular_drag = 15000.000000, 15000.000000, 35000.000000
rotation_inertia = 2800.000000, 2800.000000, 1000.000000
nudge_force = 30000.000000
strafe_force = 20000
strafe_power_usage = 2
bay_door_anim = Sc_open baydoor
bay_doors_open_snd = cargo_doors_open
bay_doors_close_snd = cargo_doors_close
HP_bay_surface = HpBayDoor01
HP_bay_external = HpBayDoor02
num_exhaust_nozzles = 1
HP_tractor_source = HpTractor_Source
shield_link = l_fighter_shield01, HpMount, HpShield01
hp_type = hp_gun_special_3, HpWeapon01, HpWeapon02, HpWeapon03, HpWeapon04
hp_type = hp_gun_special_2, HpWeapon01, HpWeapon02, HpWeapon03, HpWeapon04
hp_type = hp_gun_special_1, HpWeapon01, HpWeapon02, HpWeapon03, HpWeapon04
hp_type = hp_fighter_shield_special_3, HpShield01
hp_type = hp_fighter_shield_special_2, HpShield01
hp_type = hp_fighter_shield_special_1, HpShield01
hp_type = hp_thruster, HpThruster01
hp_type = hp_mine_dropper, HpMine01
hp_type = hp_countermeasure_dropper, HpCM01
hp_type = hp_torpedo_special_2, HpTorpedo01
[CollisionGroup
obj = port fin_lod1
separable = true
parent_impulse = 240.000000
child_impulse = 7.000000
dmg_hp = DpPortfin
dmg_obj = li_fighter_dmg_portfin_cap
mass = 5.000000
debris_type = debris_small_ship
separation_explosion = explosion_small_ship_breakoff
type = Port_Fin
hit_pts = 163
root_health_proxy = true
[CollisionGroup
obj = star fin_lod1
separable = true
parent_impulse = 240.000000
child_impulse = 7.000000
debris_type = debris_small_ship
dmg_hp = DpStarboardfin
dmg_obj = li_fighter_dmg_starboardfin_cap
separation_explosion = explosion_small_ship_breakoff
mass = 5.000000
type = Starboard_Fin
hit_pts = 163
root_health_proxy = true
[Simple
nickname = li_fighter_dmg_portfin_cap
DA_archetype = ships\liberty\li_fighter\li_fighter_dmg_portfin.3db
material_library = ships\liberty\li_playerships.mat
mass = 5.000000
LODranges = 0, 100, 1000
[Simple
nickname = li_fighter_dmg_starboardfin_cap
DA_archetype = ships\liberty\li_fighter\li_fighter_dmg_starboardfin.3db
material_library = ships\liberty\li_playerships.mat
mass = 5.000000
LODranges = 0, 100, 1000
[Simple
nickname = li_fighter_dmg_engine_cap
DA_archetype = ships\liberty\li_fighter\li_fighter_dmg_engine.3db
material_library = ships\liberty\li_playerships.mat
mass = 5.000000
LODranges = 0, 100, 1000
</font></pre>

Edited by - Argh on 3/6/2005 7:33:31 AM

Post Tue Aug 16, 2005 8:47 am

Nice one Argh, didn't realise these were so important. Wondered why FLExplorer didn't put them in.

Thx

Buck Rogers
Server Admin
Colours Elite UK
www.colourselite.co.uk

Post Tue Feb 14, 2006 1:45 pm

well i did like you said but sometimes it just does this:

for example

[Power
blabla...
blads...[Power
ablala..
bkala[Power

and so on, it seems that this just crashes my Freelancer badly , i'm still trying to figure how to do it right

found out why, i had a silly option turned on (in the editor)

Edited by - Engine Of Darkness on 2/14/2006 2:50:06 PM

Post Sat Mar 17, 2007 9:10 am

If you are seriously this desperate to streamline code for stability or whatever then you should consider the following. Compressed ini files are faster than non-compressed files. Compressed files have no blank lines and that is where Argh got the idea from for removing blank lines in the non-compressed files. But for the sake of having less work you should forget removing blank lines from everything and just compress all those files for your releases. You can use our INI Mass Converter to do it.

Return to Freelancer Editing Tutorial Forum