TaFWeb Software
A UK Company
Error Correction
with TrainzObjectz
Home Page




Search this Site

Other UK Content

TaFWeb Software Home Page

Text-only version of web site (suitable for page readers)
Error Correction with TrainzObjectz
Error Correction with TrainzObjectz

Now that TRS2004 is a lot more particular about the config.txt files many of us will find that we need to correct errors in downloaded content. This tutorial aims to show you the sort of errors you are most likely to come across, and give hints on how to correct them. PLEASE NOTE: Always make sure that you have the LATEST version of TrainzObjectz (Version 6.0 Build 543) - some of the features mentioned below are not available in earlier versions. The earlier version of this tutorial which related to TrainzObjectz 5.0c Build 436 is still available here for those who need it. A copy of this file can also be downloaded in Acrobat PDF format (right-click the link and choose "Save Target As...").

The types of errors dealt with are as follows:

Unmatched Quotation Marks
Space Missing in Obsolete-Table or Kuid-Table entry
Missing Closing Bracket
Too Many Closing Brackets
Other Obsolete-Table Errors
Badly Formed KUIDs
Nightmode Errors
Commas Used As Decimal Point
Double Quotes Inside Double Quotes
Bad Spelling

Unmatched Quotation Marks

Unmatched Quotation Mark

You will be alerted to this type of error with the message shown above. On clicking "Yes", the configuration file will be loaded into TrainzObjectz internal editor as shown below.

Internal editor

The sections highlighted in blue show the text which occurs between successive quotation marks. Note that the highlighting starts immediately after the word username. It should end at the end of that line, but instead continues down until it get to the line which begins description. It is quite obvious that the author of the content did not intend the username to be "Test Piece category-region-0 UK category-era-0 1930s description". If you type a quotation mark at the end of the line which starts "username" then only the part which says "Test Piece" will remain highlighted, and this seems a much more likely username. The other highlighted sections also look a lot more reasonable! A related common error is to place a single quote ( ' ) at the end instead of a double quote ( " ). In this case the single quote should simply be replaced by a double quote.

Corrected file

Another common cause of this error is the description or license block of text having several, apparantly random, quotation marks inserted in them (see example below).

Mismatched quotes in LICENSE section

The easiest way to solve this kind of error is to highlight the whole of the text block as shown below, then right-click it and choose Enclose in single set of quotes from the pop-up menu:

Correcting error

This will delete all the existing quotation marks within the highlighted text and replace them with a single set at the beginning and end of the section:

The error after correction

Space Missing in Obsolete-Table or Kuid-Table Entry

Space Missing in Obsolete-Table Entry

This type of error occurs when the author has not left a space between the keyword obsolete-table and the following bracket ({). It does not always prevent the object from working in Trainz but should be corrected anyway since it can be corrected automatically by TrainzObjectz. Simply click the "Yes" button and TrainzObjectz will put the space where it is meant to be. Clicking "Yes to All" will correct any further errors of this type automatically during this session, while clicking "No to All" will stop TrainzObjectz asking you about any further errors of this type during the current session. A similar error can also occur with the kuid-table entry.

Missing Closing Bracket

Brackets ( { and } ) are used in configuration files to mark the beginning and end of more complex tags. Each opening bracket should be matched with a later closing bracket. If one of the closing brackets is missing then you will see the message shown below:

Missing Closing Bracket

TrainzObjectz is nearly always correct in its suggestion about where the missing closing bracket should be, and clicking the "Fix Automatically" button will let TrainzObjectz put the missing bracket in for you. If you prefer to check it yourself (or if TrainzObjectz cannot identify where the problem is), click the "Yes" button and TrainzObjectz will show the file in its internal editor:

Internal editor

You can see that TrainzObjectz has highlighted in red the sections between successive opening and closing brackets. It has also indented each section. The first set of brackets (starting with the line which begins kuid-table) is correct, but the second set (starting at obsolete-table) goes through to the end of the document without finding a closing bracket. In this case, the closing bracket needs to be placed in the blank line underneath 0 <kuid:1942:12234>. While most cases are (like this one) relatively simple, TrainzObjectz cannot always be sure where the closing bracket should go, so here you are on your own! If in doubt, have a look at some other (correct) config.txt files and see whether you can find one which looks very similar. The position can be complicated even further when you have brackets inside brackets, like the example below:

Internal editor

In this case (and it is by far the most common one) it is the final closing bracket which is missing, and should be placed just above the line "username "Example content"".

Too Many Closing Brackets

Too many closing brackets

This is the opposite of the case quoted above - there are too many closing brackets rather than not enough (or, just to complicate things, it could be a case of not enough opening brackets). The editor shows the file like this:

Internal editor

Here again the indenting helps us. We can see that, above the "username" line there are two brackets right against the edge of the screen. The first one is correct, but the second one is unnecessary and should be deleted.

Other Obsolete-Table errors

The obsolete-table entry is used when an object replaces a former version or versions. In this case the obsolete-table should look like this:

obsolete-table {
       0 <KUID:1942:12234>

Apart from missing the closing bracket and missing out the space between obsolete-table and the following bracket (which have been dealt with above), there are three other common errors which TrainzObjectz can pick up. The first is a missing space between the number (0 in the example above) and the following KUID number. TrainzObjectz will show this message when it comes across such an error:

Missing space between number and KUID

Click "Yes" to get TrainzObjectz to correct the error. Another common error is to use a piece of text instead of the number, or to have no number at all. In this case TrainzObjectz will show the following message:

Bad obsolete-table number

Again, clicking "Yes" will automatically correct the problem.

The third common error can occur not only in obsolete-tables but in other places in the configuration file as well; this is the badly formed KUID number. KUID numbers can have two formats:

<KUID:xxxxx:yyyyyy> and <KUID2:xxxxx:yyyyy:zz>

where xxxxx is the creator's reference (1942 in my case for example) and yyyyy is a item number allocated by the creator. This type of KUID is valid in all versions of Trainz. The second KUID format (usually referred to as the "KUID2 format") is valid only from TRS2004 onwards, and zz represents a number between 0 and 127. TrainzObjectz will show an error message if it finds that the main KUID number, (or a KUID number in the obsolete-table or kuid-table), does not follow one of these two formats:

Badly formed KUIDBadly formed KUID
Badly formed main KUID

Once again, clicking the "Yes" button will allow TrainzObjectz to correct the problem automatically. Note that TrainzObjectz may not pick up faulty KUID numbers in other parts of the configuration file.

Nightmode errors

The nightmode entry is used to tell Trainz when it should show the lights in scenery objects (if any). There are three possible modes - home, lamp and constant. Many creators appear to have been confused by this and have used other words. In this case TrainzObjectz will display the following error message:

Nightmode error

You can choose any of the three valid modes (we suggest using "lamp" if you are not sure which one to choose) and click "OK" to have TrainzObjectz make the change. If you prefer, you can click "Always change to 'lamp'" - TrainzObjectz will correct all similar errors during the current session by making the mode 'lamp' without asking you again.

Other Errors

Of course there are many other possible errors in config.txt files, and unfortunately TrainzObjectz is not always able to detect them. Some others errors to look out for are:

  • Commas used as decimal points:
    1,2 instead of 1.2
  • Double quotes used inside double quotes:
    description "The locomotive has a length: 95'6" and was first introduced in..."   -   (note the quotation mark used as an inch sign).
  • Bad spelling:
    compeny British Rail   -   (note the misspelled word company).
  • Badly formed KUID numbers (TrainzObjectz will pick up and correct the main KUID if it is badly formed):
    enginespec <KUID -1:42004201>   -   (note the missing colon between the word KUID and the-1 ).

I hope this will help you to correct any errors you come across. This guide, of course, cannot be comprehensive, and some errors will require a knowledge of configuration files to be able to correct them, but nearly all of the errors I have come across have been quite simple to sort out. Remember, it pays to look at correct configuration files because in this way you will build up your knowledge and be able more easily to spot the ones that are wrong. You should also realise that correcting one error may reveal another error, and so on. An example might be where the word KUID is misspelled as follows: <KIUD 12345:67890>. Correcting the spelling will then reveal that the KUID number format is incorrect (there should be a colon after the word KUID) and a further error will then be shown.

Finally, I would like to stress that not all errors cause the object to stop working completely in Trainz. The object may, in fact, appear to be working perfectly. In most cases, however, it is purely by chance that the object works, and it almost certainly is not working as the author intended, so it is usually worthwhile to correct any errors whether they are causing a problem or not.

TaFWeb Software
London, UK

This page URL: error_correction.html
Last major revision: 19 December 2004 at 02:00 GMT
Site created with PageBuilder

Web page created by TaFWeb Design © 2004