|

楼主 |
发表于 2009-3-6 11:32:59
|
显示全部楼层
Lesson Four: Understanding the PANEL.CFG File
BackgroundFlight Simulator\'s PANEL.CFG file is a special purpose document called a configuration file. Configuration files are used everwhere in computer games, programs, and other home and businesss software products. They store information used to set up programs to some predetermined state or condition. When a program ends, changes made to the program\'s configuration while the program was running are often written into the program\'s startup configuration file.
For example, when you select an aircraft to fly in Flight Simulator, the program uses information in your selected aircraft\'s PANEL.CFG file to set up the instrument panel and views from inside the aircraft. If you happen to change the default airport while you were running the program, that change will be written into your Flight Simulator version\'s startup configuration file (e.g. FLTSIM98.CFG, FS9.CFG, etc.) File FormatPanel configuration files are documents. A panel configuration file is a page of instructions in a document that your Flight Simulator program reads to set up the instrument panels of aircraft you want to fly.
Like other documents, configuration files have paragraphs, paragraph headings, and sentences. Like legal papers and other types of specialized documents, configuration files have their own special format and grammar rules. Paragraph headings are called section names, paragraphs are called sections, and sentences in the paragraphs are called entries.
From a programmer\'s point of view, configuration files are text files that use only ASCII (American Standard Code for Information Interchange) characters. ASCII characters are all the printable characters you see on your computer keyboard, plus the space and tab keys. The text in a configuration file is arranged in a series of orderly rows of ASCII characters called strings. The end of every string is marked by an end-of-line(EOL) code generated when the Enter key is pressed. A string can have one or more ASCII characters, or none at all (called a null string). Every time you select a new aircraft to fly, Flight Simulator uses functions in your Windows operating system to read the strings in that aircraft\'s panel configuration file. Grammar Rules for Section Names and EntriesThe grammar rules for section names and entries is called a protocol or syntax. The syntax for section names is that they must (a) always be enclosed in square brackets, and (b) be valid names recognized by Flight Simulator. Other syntax rules for section names is that spaces are ignored, and any text following the right bracket of a section name is treated as a comment. The following are the valid section names for Flight Simulator 98 and Flight Simulator 2000 ):
[Window Titles] [Window] [Fixed Window] [Views] [8 Bit Colors] [Default View][size=+0]
Three new section names were added to the list of valid section names with the release of Flight Simulator 2002 and subsequent versions. The additional sections names are:
[[VCockpit]] [Color] [Strings]
An entry has two parts, a key name and a key value. A key name is sometimes called a keyword or variable. If a key value has only one value, the value is often called a parameter. If a key value has more than one value (as it often does), the values are usually called a parameter list.
The syntax for an entry is determined by the entry\'s key name. A key name identifies some Flight Simulator item or function, like a gauge or the position of a view window. The syntax for key names is that they must (a) be names recognized by Flight Simulator, and (b) have an equal (=) sign as the last character. Some examples of valid entries are: [Window01](first row)gauge12= IMPORT/CFS1/Bf109E!Airspeed,190,429,75gauge13= Bell_206B.Clock,228,370,54gauge14= IMPORT/ARMY/SuperKingAir_Airspeed,270,377,87(second row)gauge21= Cessna!Tachometer, 273,475,75gauge22= Cessna_182.Directional_gyro,355,469,90[window06]file= NAS Pensacola runways.bmpwindowsize_ratio= 1.10ident= NAS Pensacola[window07]file= Doreen pix.bmpwindowsize_ratio= 0.100position= 8 (lower right)ident= my sweetheart[Fixed window11]file= Startup checklist.bmpvisible= 0 (overlayed on default view when selected)/visible= 1 /nomenu= 1nomenu= 0 (will be on the instrument panel list)render_3d_window= 1window_pos= 0.25, 0.25window_size= 0.50, 0.50ident= 11You can only use a key name once in a section, but you can use the same key name again in other sections of the file. For example, you can use the key name gauge00= in several different sections, and can use the same or different key values if you\'d like.
An entry\'s key name determines the syntax for its key value. Key values can have one or more parameters, or none at all (called a null value). When key values have more than one parameter the parameters must be listed in the order specified by the key value\'s syntax, and they must be separated by commas. The parameters for key values must be data types (integers, decimal values, characters, etc.) related to the key value\'s function.
A key value might have a mix of required and optional parameters. You have to give values to required parameters, but not to optional parameters. If you don\'t give a value to an optional parameter then the parameter\'s default value will automatically be used. If you want to list all of the parameters of a key value that has default parameters you can use a blank (called a null) or a space to indicate where a default parameter is being used. File Order of Sections and EntriesSection names don\'t have to be listed in any particular order. The only exception is that the [Window Titles] section has to be the first section in the file. If any other section name comes before this one a file error will be flagged when the aircraft is selected. The [Default View] section and at least one [Window] section also always have to be included in the file. All the remaining section names are optional; only the sections that are actually being used need to be listed.
Although section names don\'t have to be listed in any particular order, it\'s a good practice to do so. If you get into modifying a lot of configuration files it\'ll be a lot easier for you to find the section name you\'re looking for if you follow a consistent system to list the sections in your files. What\'s in Each of These SectionsEach of the sections in a panel configuration file have a specific function or purpose.
[Window Titles]You use this section to (1) specify the window that you want to be visible when you select and aircraft, and (2) give identifying titles to your [Window] and [Fixed Window]. These are the titles listed when you click on the Views → Instrument Panel main menu option. Flight Simulator automatically makes the first window in the list visible when you select an aircraft.
The key values in this section are literal strings, that is, all characters in the string (including tabs and spaces) are included in the key value and will be listed. Here\'s an example of some valid entries for this section: [Window Titles]Window01= front seat (IFR panel)Window02= FS95 Chicago sectional eastWindow03= FS2K Chicago sectional eastWindow04= Maryland airmap Dover AFB sectionWindow05= US/DOT Airport-Facilities Directory, Pensacola dataWindow06= NAS Pensacola (from Pensacola street map)Window07= my sweetheartFixed Window11= Start checklist(Click here to see how this looks in Flight Simulator) Reference: ([url=file:///D:/模拟飞行插件/FS2004/设计应用工具/面板设计/Simple%20Panel%20Design(PDToot)/Tutorial/Lessons/Lesson%2004/[Window%20Titles]%20variables%20table.html]Table 4.1. Window Titles Keywords and Key Values[/url])
[Window00] … [Window63]The most common use of this type of section is to show an aircraft\'s main instrument panel, and also for showing subpanels that hold instruments, switches, or flight controls that are only needed temporarily. These sections will be listed in the Views → Instrument Panel main menu option only if you\'ve listed them in the [Window Titles] section.
These windows can be used for more than just flight instruments and controls. You can use any bitmap graphics file (any file having a .BMP file extension) that you think would be great to be able to see while you\'re flying your aircraft. You can, for example, use Paint to write post-takeoff and pre-landing check lists, lists of runway numbers (headings) for your most often used destination fields or airports, or write frequency lists for your com/nav radios, and use those files in these windows.
If you have a scanner (even a small one) you can scan and make bitmap files of airport approach diagrams and other useful information in FAA or other flight publications, scan flight maps (even gas station or auto club road maps) and use those files in these window sections so they can be toggled on and viewed whenever you need them.
You can use any two-digit number in the range 00 through 63 to number these windows. The numbers you use don\'t have to be consecutive or in any particular numeric order. However, authors typically use [Window00] to display an aircraft\'s main instrument panel, if for no other reason than Flight Simulator automatically makes that window visible when you select an aircraft.
You don\'t have to start off with [Window00] if you don\'t want to. You can just as easily use use [Window01] or any other window number you like. But if you do that, there are a couple of things you need to be aware of. First of all, Flight Simulator will automatically display [Window00] on startup no matter where you put it physically in your configuration file. Second, when you select an aircraft Flight Simulator will also automatically display the first [Window] section it comes to, no matter what number you\'ve given it. So if you\'re not careful, it\'s possible that you could have two [Window] sections showing at the same time after you\'ve started Flight Simulator or when you\'ve selected an aircraft to fly.
Flight Simulator assigns the first nine sections of this type in your configuration file (in ascending order as they appear in the file) to the keyboard number key combinations SHIFT+1 through SHIFT+9. These keys are toggles that reverse the visible= keyword\'s value to either make the window visible or to hide it. Higher numbered key combinations always take priority over lower ones. For example, a window that Flight Simulator assigned to SHIFT+6 will overlay any of the windows that were assigned to key combinations SHIFT+1 through SHIFT+5. But that window will itself be overlaid by any of the windows assigned to the key combinations SHIFT+7 through SHIFT+9. You have to keep this fact in mind when you\'re designing subpanels.
If there are more than nine sections of this type in the file you have to select the rest of the windows from the Views → Instrument Panel option on the main menu. The priority rule for the windows in that list is that windows lower down in the list will overlay the windows higher up in the list.
Here\'s an example of a valid [Window] section with three sample gauge entries: [Window01]file=t28coin.bmpsize_mm=800windowsize_ratio=1position=7visible=1/ident=0ident=VFR panel(first row)gauge12=IMPORT/CFS1/Bf109E!Airspeed,190,429,75(second row)gauge21=Cessna!Tachometer, 273,475,75(third row)gauge31=IMPORT/CFS1/P47D!Thrust_Controls,96,512,68(see a PANEL.CFG text example) Reference: ([url=file:///D:/模拟飞行插件/FS2004/设计应用工具/面板设计/Simple%20Panel%20Design(PDToot)/Tutorial/Lessons/Lesson%2004/[WindowXX]%20Variables%20table.html]Table 4.2. [Window] Keywords and Key Values[/url])
[Fixed Window00] … [Fixed Window63]These sections are almost always used to superimpose some kind of interior view over one of Flight Simulator\'s eleven exterior views from inside an aircraft. They are always linked to one of the exterior views available in the [Views] section. If you don\'t link a [Fixed Window] section to one of those views then your window won\'t be displayed.
Gauge entries aren\'t valid in [Fixed Window] sections. If you do try to put gauges in one of these sections your entries will be ignored.
You can define up to sixty-four [Fixed Window] sections. You can use any number in the range 00 through 63 for your window numbers. The numbers you use don\'t have to be sequential or in any particular numeric order. You\'ll find that in most files the authors usually start with [Fixed Window00]. But if you want to you can just as easily used [Fixed Window01] (or any other number in the range) for your first [Fixed Window] section. It makes no difference to Flight Simulator.
Microsoft\'s Flight Simulator developers always use the numbers 30 through 37 for their [Fixed Window] sections because it\'s a Microsoft convention. They always link these [Fixed Window] numbers to specific predefined view entries in the [Views] section. But you\'re free to use whatever numbers you like; you don\'t have to use those numbers if you don\'t want to.
[Fixed Window] sections are usually selected using the keypad numbers keys with Num Lock turned on. A [Fixed Window] section is only displayed while it\'s associated keypad key is being held down. Each keypad number key is linked to one of Flight Simulator\'s eleven predefined views from the cockpit. The linked views start with key 8 (forward view) and go clockwise around the number keys to key 7 (forward left view). Number pad key 5 in the center of the keypad keys can be linked to either of two views, up or down. [Fixed Window] sections can also be set up so they can be selected from the Views → Instrument Panel main menu option if you\'d like.
Like your [Window] sections, your [Fixed Window] sections can be used for other things besides superimposing an interior view bitmap on an exterior view. Any bitmapped graphics file that you\'d like to see in one of the predefined exterior views can be shown with a [Fixed Window] section.
Here\'s an example of a valid [Fixed Window] section which will display the FORWARD_RIGHT.bmp file when the NUM LOCK + keypad key 9 is pressed. To make this section work you have to link the section\'s ident= value to the forward right view in the [Views] section, like this: VIEW_FORWARD_RIGHT_WINDOWS= 1001. [Fixed Window09]file=FORWARD_RIGHT.bmpvisible=0nomenu=1render_3d_window=1position=window_pos=0.0,0.0window_size=1.00, 1.00ident=1001 Reference: ([url=file:///D:/模拟飞行插件/FS2004/设计应用工具/面板设计/Simple%20Panel%20Design(PDToot)/Tutorial/Lessons/Lesson%2004/[Fixed%20WindowXX]%20variables%20table.html]Table 4.3. [Fixed Window] Keywords and Key Values[/url])
[VCockpit00] … [VCockpit63]This is one of the new sections added in Flight Simulator 2002. Virtual cockpits have been a part of Flight Simulator since Flight Simulator 95. Up until the release of Flight Simulator 2002 the cockpit graphics displayed in the virtual cockpit view mode were a series of bitmapped graphics contained in the aircraft model (.MDL) file. The gauges on the panels in the virtual cockpits were painted replicas of gauge faces. They were designed to make the virtual cockpit views appear more realistic. The virtual cockpit graphics in these files were not accessible to users in the earlier versions.
Although you can move, replace, or delete instrument panel gauges, switches and other panel elements in the [Window] and [Fixed Window] sections in any version of Flight Simulator, it wasn\'t until the release of Flight Simulator 2002 that you could do the same thing with the instruments in the virtual cockpit view mode.
In Flight Simulator 2002 a major change was made to the virtual cockpit graphics system in the aircraft model file. In that version the virtual cockpit graphics were taken out of the aircraft model file and put in texture files. The virtual cockpit texture files are kept in the aircraft\'s TEXTURE folder along with the rest of the aircraft\'s texture files. It\'s beyond the scope of this tutorial to go into the details of how the aircraft model file supplies the graphics required in the virtual cockpt view mode, or how to create virtual cockpit texture files.
But the bottom line is that now you can do a lot more with the virtual cockpit views than you could before. In Flight Simulator 2002 the developers changed the .MDL file so that the instruments seen in the virtual cockpit views are functional, working instruments. No more painted replicas. The gauges you see in the virtual cockpit mode are the same gauges that you see on your main instrument panel. So if you change a gauge on the main panel for instance, you should also make that same change in the corresponding virtual cockpit view.
Other than changing and/or repositioning gauges in the virtual cockpit views, there\'s not much else that you can do with the [VCockpit] sections. Or very little point in doing so, really.
Reference: ([url=file:///D:/模拟飞行插件/FS2004/设计应用工具/面板设计/Simple%20Panel%20Design(PDToot)/Tutorial/Lessons/Lesson%2004/[VCockpitXX]%20variables%20table.html]Table 4.4. [VCockpit] Keywords and Key Values[/url])
[Views]The [Views] section is where you can assign one of Flight Simulator\'s exterior views around the aircraft to a window that you\'ve defined in one of your [Window] and/or [Fixed Window] sections.
Reference: ([url=file:///D:/模拟飞行插件/FS2004/设计应用工具/面板设计/Simple%20Panel%20Design(PDToot)/Tutorial/Lessons/Lesson%2004/[Views]%20variables%20table.html]Table 4.5. Views Keywords and Key Values[/url])
([url=file:///D:/模拟飞行插件/FS2004/设计应用工具/面板设计/Simple%20Panel%20Design(PDToot)/Tutorial/Lessons/Lesson%2004/[Views]%20variables%20table.html]Table 4.5.1 Views Keyword Modifiers[/url])
[8 Bit Colors]The entries in this section were used by the aircraft model file in Flight Simulator versions 95 and 98. The section was made obsolete by changes made to the aircraft model file for Flight Simulator 2000 and later versions.
In the earlier versions the entries in this section assigned RGB color value triplets to colorXX= keywords. You\'ll only find this section in panel configuration files for aircraft designed for Flight Simulator 95 or Flight Simulator 98. This section isn\'t used if you\'re flying FS95/FS98 aircraft in FS2000 and later versions, so you can delete this section from your panel configuration file if you want to.
[Color]This is one of the new sections added in the FS2002 release. The section has three keywords: day=, night=, and luminous=. The key values for these entries are RGB color triplets. Typical values used with these entries are: (for Cessna 208):day= 255, 255, 255 (white)night= 223, 72, 100luminous= 228, 64, 64
[Strings]This is another one of the sections addd in Flight Simulator 2002. This section is used for defining short aliases for any long key value strings that are used a lot in the file. Defining a short alias here avoids having to type out a long key value string over and over again if, for example, you use the same gauge in several different [Window] and VCockpit sections. An alias will also help avoid making mistakes when you type out the entry over and over again.
So, how do you use this section? Suppose you\'ve made up a lot of subfolders in you GAUGES folder to keep your gauges better organized. Now suppose that you want to replace the existing Cessna altimeter in an aircraft with one of the metric altimeters you have in one of your GAUGES subfolders. And let\'s also suppose that the Cessna altimeter is used in several of the [Window] and [VCockpit] sections in your file. Here\'s how you could use the [Strings] section to mimimize the keystrokes you\'d have to use to get your replacement gauge installed: [Strings]\"altimeter\"=IMPORT/CFS1/Metric gauges/German/BF109E!altimeter[Window00]/gauge11=Cessna!Altimeter, 100,100,100,,,,gauge11=%altimeter%,100,200,75[Window03]/gauge01=Cessna!altimeter,100,100,100gauge01=%altimeter%, 100, 200, 75[VCockpit01]/gauge02=Cessna!altimeter, 100, 100, 100gauge02=%altimeter%,10, 50,35[VCockpit02]/gauge21=Cessna!altimeter, 100, 100, 100gauge21=%altimeter%,10,50,35 As you can see, the alias can simplify your gauge entries. You\'d still have to type in your gauge\'s panel position and size parameters in the different windows, of course. But a lot of typing can be avoided by using an alias.
Using an alias for a string that\'s only repeated a couple of times in your file might not be worth the effort, since you have to type the complete alias string into the [Strings] section anyway.
You can\'t use an alias for keywords. This is because the percent symbol used to delimit the alias when you use it will turn the keyword into a comment. You can only use an alias as a substitute for a key value string.
[Default View]This section is used to define the width, height, and position of the default view (the forward view you see from your aircraft). the default view\'s width and height are stated in design units, with the upper left corner of the default window being the point of origin. The default view\'s position parameters locate the view\'s upper left corner, stated as a decimal percent along the view\'s x-axis and y-axis from the window\'s point of origin.
In the earlier versions of Flight Simulator which ran on slower computers the default view\'s height was often brought down just to the point where the main insturment panel started covering over the default view. Doing this helped reduce setup time, since the area covered over by an aircraft\'s main instrument panel didn\'t have to be painted and refreshed all the time. This is why you\'ll find many different values for the size= keyword\'s parameter. If you\'re using a reasonably fast computer with a reasonable amount of random access memory (RAM), you can set the size_x and size_y parameters to their maximum values, 8191 and 6144.
Notes and Comments in Your Configuration FilesNotes and comments are strings that you add to a configuration file to pass information on to a reader, or to make the file more organized and readable (sometimes called \'pretty printing\'). Since Flight Simulator ignores everything in a panel configuration file that isn\'t a valid section name or entry, you can add notes, comments, spaces, null strings, or dashed lines anywhere in the file where you think it will be helpful.
For example, you can write a paragraph (called a header) at the start of your file where you give anyone who reads the file some information about the file. You can set off your header with single- or double-dashed lines at the top and bottom. Between these two lines you can write a paragraph about which aircraft the file belongs to, when it was originally written and/or modified, who wrote it, and anything else you want the reader to know. There are lots of different formats used for file headers, but basically you can write a file header any way you like. After all, it\'s your file, isn\'t it?
(Click here to see a \"before\" and \"after\" example)
No special characters are necessary to tell Flight Simulator that the strings your are writing are comments. However, some authors with programming experience often use a single or double slash mark at the start of their comment strings. While it\'s not necessary to mark your comments this way, using some kind of easily recognizable symbol can often help to make your comments stand out.
Programmers often use comment symbols a lot when testing or debugging programs. A common use of comment symbols is to \"comment out\" sections of code that you want the program to ignore. Instead of deleting or overwriting sections and entries that you\'re changing, using comment symbols to comment out the original lines is a good way to save them in case you ever decide that you need to put them back again. You can restore original lines just by removing their comment symbols. You can then add comment symbols to comment out the changes you\'ve made. Commenting out instead of deleting or overwriting entries is a good way to keep a visual record of your work, especially when you\'re doing trial and error testing. |
|