Brush up on region codes

Forester1

Well-known member
As I am fixing faulty assets, I frequently find a faulty region code that is the valid two-letter code given in the Trainz wiki for region codes. So somewhere along the way, those have become invalid codes, and I am trying to figure out what is valid now. If I use the number in the table for each country, that seems to be acceptable, but is that actually valid for that country, for example Great Britain = 12, Australia =14? The reason I asked is that several very different countries worldwide seem to have the same numbers but different letter codes. So I am posting to find out if there is a link to a correct table of codes? Here is the link I am using:

https://en.wikibooks.org/wiki/Trainz/tags/category-region_tag

I realize this has probably been asked before, but it doesn't Google, so I wanted to se if I could get the right codes.

Thanks!
 
As I am fixing faulty assets, I frequently find a faulty region code that is the valid two-letter code given in the Trainz wiki for region codes. So somewhere along the way, those have become invalid codes, and I am trying to figure out what is valid now.
You should be looking at the Trainz Wiki, not Wikibooks. The codes are listed here:
http://online.ts2009.com/mediaWiki/index.php/Category_Region

Numeric codes are not valid. What two character codes are being reported as invalid?

A common fault is a blank character following the code.
 
Other common faults from the old days were USA instead of US and ALL which was eventually dealt with by the invention of 00 (zero zero) as a "universal" region.

As far as I know, 00 is the only numeric region code, although I can't find it listed in the Wiki. Maybe that should be checked for validity.


.
 
Last edited:
There are 2 different types of region tags. For all types of assets, except type map, the 2 character country codes are used. For type map the kuid of an asset of type region is required.

Peter
 
What is annoying, is having to search twice, because of the use of 'GB' & 'UK', when 'UK' would suffice & cover both.
 
What is annoying, is having to search twice, because of the use of 'GB' & 'UK', when 'UK' would suffice & cover both.

I agree, it's overly anglo-centric isn't it? I was reluctant to say anything for fear of igniting some kind of war but instead wrote myself a little script that AssetX can run to automatically remove GB from a whole bunch of open-for-edit assets.

Here is the code if anyone wants to use it.

Code:
[FONT=Verdana];Removes the annoying GB;UK region and replaces it with UK.[/FONT]
[FONT=Verdana]-If|category-region=GB;UK
 -Update|category-region|UK
-Endif

Just copy that text into Windows Notepad and save it as something descriptive like RemoveGB.axm. Note the file extension needs to be .axm, not .txt.

Put that file in a folder where AssetX keeps its scripts. For me, it's; C:\Program Files (x86)\PEVSoft\AssetX\scripts\4_Cleanups\Category-Region but you could use a different sub-folder below ..\scripts.
[/FONT]
 
Last edited:
Thanks very handy, shame though that we can't fix all the built-in / DLC stuff that's using GB UK.....

As for 00 presumably still valid as it is listed in \Trainz Railroad Simulator 2019\resources\validation\category-region.txt, as are GB and UK.
Time for a suggestion me thinks although not sure United is very appropriate now given the current mess we are in. :eek:
 
Last edited:
Validation - Category-Region.axm

Note this also deals automatically to all pesky trailing spaces

;TARDIS
;VALIDATION
;as at 1 Jan 19
;
-Info|START of VALIDATION - CATEGORY-REGION
;
;xxxxxx
;STATUS
;xxxxxx
;
-Info|Approved
;
;
;xxxxxxxx
;CATEGORY - REGION
;xxxxxxxx
;
;xxxxxx
;RENAME - ORIGIN
;xxxxxx
;Note that some tag 'origin' use invalid codes. This next section corrects the known errors.
;
-If|origin="AUS"
-Update|origin|AU
-Endif
;
-If|origin="CAN"
-Update|origin|CA
-Endif
;
-If|origin="DEU"
-Update|origin|DE
-Endif
;
-If|origin="NLD"
-Update|origin|NL
-Endif
;
-If|origin="SWE"
-Update|origin|SE
-Endif
;
-If|origin="USA"
-Update|origin|US
-Endif
;
-If|origin="South Africa"
-Update|origin|ZA
-Endif
;
-If|origin="Third_Party_FRA"
-Update|origin|FR
-Endif
;
-If|category-region="00"
-Delete|category-region
-Rename|origin|category-region
-Endif
;
;xxxxxx
;origin
;xxxxxx
;
-If|trainz-build>3.4
;
-Delete|origin
;
-Endif
;
;xxxxxxxxxxxxx
;UPDATE FORMAT from category-region-0 to category-region.
;xxxxxxxxxxxxx
;CAUTION
;This wipes out category-region if value is "all".
;
-If|category-region="all"
;
-Info|category-region invalid
-Update|category-region|"00"
-Category|category-keyword|_GLOBAL
;
-Endif
;
-UpdateCategoryRegion
;
;xxxxxx
;RENAME - INVALID CATEGORY-REGION
;xxxxxx
;
;Adds a region representing global application if no region stated or value is missing.
;
-If|category-region="B;B;*"
;
-Info|category-region invalid
-Update|category-region|"00"
-Category|category-keyword|_GLOBAL
;
-Endif
;
-If|category-region="AU "
;
-Info|category-region invalid
-Replace|category-region|"AU "|"AU"
;
-Endif
;
-If|category-region="CA "
;
-Info|category-region invalid
-Replace|category-region|"CA "|"CA"
;
-Endif
;
-If|category-region="ES "
;
-Info|category-region invalid
-Replace|category-region|"ES "|"ES"
;
-Endif
;
-If|category-region="painted_origin"
;
-Info|category-region invalid
-Replace|category-region|"painted_origin"|"00"
;
-Endif
;
-If|category-region="GB;UK"
;
-Info|category-region consolidate
-Replace|category-region|"GB"|"UK"
;
-Endif
;
-If|category-region="US "
;
-Info|category-region invalid
-Replace|category-region|"US "|"US"
;
-Endif
;
-If|category-region=0
;
-Info|category-region invalid
-Update|category-region|"00"
-Category|category-keyword|_GLOBAL
;
-Endif
;
-If|category-region=" "
;
-Info|category-region empty
-Replace|category-region|" "|"00"
-Category|category-keyword|_GLOBAL
;
-Endif
;
;xxxxxxx
;WARNING
;xxxxxxx
;
-If|category-region="NO"
;
-Info|category-region may be invalid and not Norway
-Category|category-keyword|CHECK_CAT-REGION_NO
;
-Endif
;
;xxxxxxxxxxxxxxx
;Changes default TRS2004 region from "to" or "TO" to "00". Tonga has no railways.
;xxxxxxxxxxxxxxx
;
-If|category-region="to"
;
-Info|category-region "to" invalid
-Delete|category-region
;
-Endif
;
-If|category-region="TO"
;
-Info|category-region "TO" most likely invalid
-Delete|category-region
;
-Endif
;
;xxxxxxx
;MISSING
;xxxxxxx
;
-IfNot|category-region@
;
-Update|category-region|"00"
;
-Info|GLOBAL - category-region set to "00". You may want to change this.
-Category|category-keyword|_GLOBAL
;
-Endif
;
;xxxxxx
;GLOBAL
;xxxxxx
;
-IfNot|category-region="00"
;
-Category|category-keyword||_GLOBAL
;
-Endif
;
;xxxxxxxxxxxx
;WORLD-ORIGIN
;xxxxxxxxxxxx
;activate if you have this script. Covers all regions.
;
-If|trainz-build>3.3
;
; -Callscript|TARDIS\MASTER\WORLD-ORIGIN MASTER.axm
;
-Endif
;
;xxxxxxxxxxxxxxxxx
;EXPAND CONTAINERS
;xxxxxxxxxxxxxxxxx
;
-Expand|bogeys
;
-Expand|mesh-table
;
-Expand|attached-track
;
-Expand|track
-Expand|track\track-lod-tree\
;
-Expand|endcap-prev
-Expand|endcap-prev\track-lod-tree\
;
-Expand|endcap-next
-Expand|endcap-next\track-lod-tree\
;
-Expand|obsolete-table
;
-Expand|extensions
;
-Expand|region
;
-Expand|smoke?
;
-Expand|thumbnails
;
-Expand|kuid-table
;
;xxxxxxxxxxx
;COMPLETION
;xxxxxxxxxxx
;
;completes repairs
;
;Saves the config file for consistency and ease in maintenance and creation. See AssetX\bin\SortOrder.txt.
;
-Sort
;
-Saveconfig
;
-Info|END of VALIDATION - CATEGORY-REGION
;
-EXIT
;
;xxxxxxxxxxx
;DEVELOPMENT
;xxxxxxxxxxx
;
;TBD
;
-EXIT
;
;xxxx
;HELP
;xxxx
;For further information on tags and containers for each KIND refer to TrainzWiki.
;
 
Last edited:
Sailor Dan's link takes me to the same table as my link, so to clarify, that is for "category-region-0", not the "region" tag. So to be clear, this is for faulty "region" tags in T:ANE SP3. It appears to ONLY take numerics and it doesn't really seem to care what. For example:

<kuid2:5562:20011:2> Rosworth Vale SP2 had faulty region tag "GB". I changed it to "12" and now it is OK.
<kuid:131986:240943> SampleSchedules had faulty region tag "AU". I changed it to "14" and now it is OK
region "14"
A do note that this second one has a category-region-0 of "UK" and that appears to be OK.
So the tag making the assets faulty is the "Region" tag. Not sure why it would need to have one of each...
 
So the tag making the assets faulty is the "Region" tag. Not sure why it would need to have one of each...

Both those assets are routes. Routes have a region, not a region code. The region is the KUID of a region asset. See:
http://online.ts2009.com/mediaWiki/index.php/KIND_Map#region
http://online.ts2009.com/mediaWiki/index.php/KIND_Region

'category-region-0 is obsolete and should not be used. Use 'category-region instead. See:
http://online.ts2009.com/mediaWiki/index.php/KIND_TrainzBaseSpec#category-region

The Wikibooks link that you have been using might be similar to the Trainz Wiki in this case, but in most cases it is likely to seriously mislead, as has happened here.
 
Pretty sure the 'region' tag was the original and is long obsolete...
 
Last edited:
Yes region is still valid for a route, specifying a kind region asset. It used to be allowed in other assets to specify a region code.
 
Last edited:
There was also 'origin'. So it's a bit confusing. Presumably the 'origin' and non route related 'region' became category-region.
 
Last edited:
What a mess Auran created with the changing fortunes of origin, region, category-region-x and category-region. As to 14 = Australia? Region and category-region were never numerical (apart from 00) as far as I am aware. Why do numbers not trigger a fault, or do they? Little wonder people get confused.


 
Why do numbers not trigger a fault, or do they? Little wonder people get confused.
We are talking about the 'region' tag in a route - references to category-region-x and category-region are irrelevant. For a route at build 2 a number is accepted because the parser will try to read it as a KUID. OP should be updating the asset to a much newer build by loading and saving from a newer version. That will either remove or alert to these sorts of error.
 
SailorDan, your last link takes me here:
[h=1]I...IND Map[/h]

Jump to: navigation, search
There is currently no text in this page.You can search for this page title in other pages,or search the related logs.


But I did search region and find something here: http://online.ts2009.com/mediaWiki/index.php/Region
The region tag is a legacy tag valid when defined in pre-TRS2006 Trainz versions, but depending upon the Trainz-build version will be obsolescent (may give a warning or just be ignored) or obsolete (will generate an error) in newer releases of Trainz.




Rob, the numbers I used are just the numbers in front of the letters for each country in the table. I have no idea what it means to TRAINZ if anything, but it apparently is valid for the region tag. AND, if it really is obsolete, why does Trainz not just ignore it instead of making the asset faulty? I still don't know what to replace the letters with, but random numbers appear to work... :O)
 
It is indeed a bit confusing because in the past there have been different uses of the tag 'region'.

'region' specifying a code such as "USA" or "Britain" crops up in a lot of old assets of all kinds and is actually present in some example configs in the TRS2004 ccg.

category-region-x is introduced in the TRS2004 ccg. At some point that got shortened to category-region where several regions can be specified by the one tag e.g. category-region "RU;UA;BY;SU".

A route can have category-region for the sake of search/filtering, and 'region' for the kuid of the kind:region asset. It wasn't always done this way so on a very old route you can find e.g. region "USA" and no reference to the kind:region asset at all.

To hopefully make things simple:

If the error is something like: "the tag 'region' in the container scenery is obsolete" then change it to category-region.

If the error is: "the tag 'region' does not contain a valid kuid", then it's a route and wants a kind:region asset.

You can sort by type in CM to find the installed kind:region assets.
 
Last edited:
Thanks Rob. It sounds like I want to use your last sentence there when fixing existing assets. At least I should be able to get an actual correct value, I hope. In the meantime if there is a link to a table with these "kind region asset" codes, I think that would be worth having out there. Thanks to all of you for your help in this! I wish my fixes could be good for everyone instead of just for me!
 
Back
Top