CFML Coding

 
     
 

CFML FILES AND CODING


Before reading through this section be sure you have reviewed the basic part of the keymapper manual thouroughly.

     CFML files are your keymapper save files and also the name of the code used in those files. CRS created this code and it is XML based and really easy to learn. All CFML files that are used by the game are contained in the CFML Folder in the ww2ol\data folder. They cannot be in any subfolders or any other folder and be recognised by the game. If you do not have a CFML Folder, don't panic, just means you haven't run the game and changed a keymap [which is when the game creates the folder]. you can either simply create a folder named CFML in the ww2ol\data folder or run the game and go into the keymapper and change something. CFML files can be opened and edited with notepad or dreamweaver [or other html type program]. The CFML Folder also containes a file called global.calib, this is your calibration file for your joysticks and mouse.

 

How the game uses CFML files



     The CFML filing system is a tiered proprietary file system, meaning there are three basic files for control of a vehicle. default, category, and the specific vehicle. the defaults are hard coded and not shown as a file in a folder. What's contained in the CFML Folder is only what is changed from the defaults. If a function is not listed in the CFML category or specific vehicle file, the defaults are used. now a proprietary system means the functions assigned in a specific vehicles CFML will override the same assignment in the category cfml while the functions assigned in the category cfml override the hardcoded defaults.

     I know this sounds a little confusing but it's really not, think of it as an overlay where the same functions get covered over when you place a file overtop of another with the specific vehicle being on top, the category being in the middle, and the defaults being on the bottom [and not shown in a cfml file, so if there isn't a header for a function it means it's set to the defualts]. What shows through will be mapped to that specific vehicle. One thing to remember is that you have secondary buttons or keyboard axes for most functions, so you need to be aware that you might only be overriding one side of the two keymapper collumns. [the how to is explained further down].

Below is a highly simplified (i didn't use all of the functions) visual representation to help explain, we'll say we chose a truck to drive in game. Here's a really basic idea of how the game decides what is keymapped for it, let's say we chose to spawn the british laffy truck and in the keymapper we had mapped the truck ALL file {the map for every truck) like this..

And that we specifically mapped the Laffy this way...

remember, i do not show all of the code for the defaults just to keep it simple...

.

Default (hardcoded)

Truck Defaults

Category (tank.cfml, air.cfml, ect.)

truck.cfml

Specific Vehicle (pak36.cfml, ect.)

laffy.cfml

         
<control function="Canopy control">
<key>o</key>
</control>
<control function="Gas">
<joyaxis stick="1" halfaxis="+">y</joyaxis>
</control>
<control function="Center brake">
<joyaxis stick="1" halfaxis="-">y</joyaxis>
</control>
<control function="Steering">
<joyaxis stick="1">x</joyaxis>
</control>

<control function="Canopy control">
<joybutton stick="1" index="1"*>2</joybutton>
</control>
<control function="Gas">
<joyaxis stick="1">z</joyaxis>
</control>

* Index is used to tell the keymapper which collumn this is placed in on the screen. Remember that you can have more than one button mapped to a function at a time. 'index=0' would mean the first collumn but doesn't need to be added to the code. (note: see Index tag and Edit tag)

<control function="Canopy control">
<key></key>*
<joybutton stick="1" index="1">3</joybutton>
</control>

* this is the code that the keymapper puts in when you blank out a collumn with the 'clear keymap' button. What this does is ensure that no other keymap is used from any file lower in the file tier. It is displayed as 'no key' in the keymapper, in the proper collumn designated by the 'index' tab. (note: see Index tag and Edit tag)

 
What code the game actually uses when you choose the Laffy...
<control function="Canopy control">
<key></key>
<joybutton stick="1" index="1">3</joybutton>
</control>
<control function="Gas">
<joyaxis stick="1">z</joyaxis>
</control>
<control function="Center brake">
<joyaxis stick="1" halfaxis="-">y</joyaxis>
</control>
<control function="Steering">
<joyaxis stick="1">x</joyaxis>
</control>
 
What code the game would use if you didn't specifically keymap the Laffy...

<control function="Canopy control">
<key>o</key>
<joybutton stick="1" index="1">2</joybutton>
</control>
<control function="Gas">
<joyaxis stick="1">z</joyaxis>
</control>
<control function="Center brake">
<joyaxis stick="1" halfaxis="-">y</joyaxis>
</control>
<control function="Steering">
<joyaxis stick="1">x</joyaxis>
</control>

 
What code the game would use if you keymapped JUST the Laffy and NOT the ALL keymap...
<control function="Canopy control">
<key></key>
<joybutton stick="1" index="1">3</joybutton>

</control>
<control function="Gas">
<joyaxis stick="1" halfaxis="+">y</joyaxis>
</control>
<control function="Center brake">
<joyaxis stick="1" halfaxis="-">y</joyaxis>
</control>
<control function="Steering">
<joyaxis stick="1">x</joyaxis>
</control>
 
And of course you didn't map the All or Laffy keymap, it would just use the defaults...
Note: The Index and Edit tags are VERY important in what code gets 'replaced'. See Index tag and Edit tag..

 

     Category CFMLs are the ALL keymaps in the keymapper. they are named tank.cfml, air.cfml, atgun.cfml, sea.cfml, truck.cfml, infantry.cfml then there is the view.cfml and general.cfml. These effect all the vehicles in that category [unless overridden by a specific vehicles cfml]. Any function mapping in this CFML overrides the defaults.

    Specific Vehicle CFMLs are just that, the keymaps made for a specific vehicle. they are named for that vehicle, such as bf109e4.cfml ect.. The functions that are keymapped in this file, override the Category CFML and the Defaults.

     So defining what type of cfml a file is depends simply on what it's named. tank.cfml is a Category, pnzrIV.cfml is a Specific Vehicle, and the Defaults are hardcoded and do not appear in any file.

     The View and General CFMLs effect all vehicles exactly the same, they are global settings. They are directly related to the View and General tab in the keymapper and thier CFML file's use the functions found there. Note: the View and General CFML's can be overridden by a Category or Specific vehicle's CFML file simply by using the functions used in the View and General function list in the Category or Specific vehicle CFML.