Difference between revisions of "LTEXT"

From SC4D Encyclopaedia
Jump to navigation Jump to search
sc4e>CasperVg
m (cat)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''LText''' files are used to make lots multilingual or as a proper replacement for the User Visible Name Key and the Item Description Key.
+
'''LTEXT''' or '''Language Text''' files are a Unicode text format used by [[SimCity 4]] to give language specific text strings simply and quickly for use in any part of the world. Unicode of course makes this much easier since the vast number of characters can't always be written in standard text. LTEXT files cover everything from news to building and prop names to tool names in the game. They are queried by [[Instance ID]], so make sure your instance is unique when creating new ones!
  
==File Structure==
+
LTEXT files are partially controlled by the [[Delocalizers]] file, which gives the game instructions about converting text into the local language, or not.
  
The file has a 2 byte header and then each character is UTF-16 (I think)
+
LTEXT files are also related to the User Visible Name Key and Item Description Key in [[exemplar]]s.  They can also contain HTML code that is used by the game.  LTEXTs can also contain variables, to be filled in by the game with the appropriate value.
  
Here is a PHP function that returns the string enclosed in an LTEXT file
+
LTEXT files can be found in SimcityLocale.dat, as well as both Maxis and user-created plugin files. They are generally seen as an LTEXT or XA file by [[Reader]].
  
<pre>function ltextThing($data){
+
==Format Specification==
 +
===File Format===
 +
 
 +
WORD - Number of 2 byte characters in the LTEXT.
 +
WORD - 0x0010 - Start of Text control character.
 +
WORD - (Repeating) - 2 Bytes for each character, simply use the Unicode character for the
 +
        value of these two bytes to see its visible in-game form.
 +
 
 +
In English, decoding this is easy since non-compressed files will appear as an English character followed by a period in most hex editors. Other languages may be harder, i.e. Chinese, Korean. Compressed files do not have this same benefit.
 +
 
 +
==PHP Function==
 +
Here is a PHP function that returns the string enclosed in an LTEXT file:
 +
 
 +
<pre>
 +
function ltextThing($data){
 
/*ExemplarFile
 
/*ExemplarFile
 
typeID: 6534284a
 
typeID: 6534284a
Line 18: Line 32:
 
}
 
}
 
return $return;
 
return $return;
}</pre>
+
}
 +
</pre>
 +
 
 +
== File Properties ==
 +
=== Tags ===
 +
'Tags', enclosed with Hashes (#), can be included in an LTEXT file to mark where a writer wants dynamic content to be inserted into the text in-game. This can include the City Name or Monthly Costs, among other things.
 +
 
 +
{|width="90%" border="1" cellpadding="1" cellspacing="1" class="wikitable sortable"
 +
|-
 +
!Tag
 +
!Content
 +
!Example Usage
 +
|-
 +
|#m:{{var|nnnnnnnn}}#
 +
|The content of a linked Exemplar Property ''as Currency'' (200 is inserted as §200)
 +
|#m:ea54d286# inserts the Monthly Cost of a building into the Item Description in a Menu Balloon
 +
|-
 +
|#d:{{var|nnnnnnnn}}#
 +
|The content of a linked Exemplar Property ''as it appears'' (200 is inserted as 200)
 +
|#d:27812852# inserts the Power Generation of a building into the Item Description in a Menu Balloon</br>#d:4aa60ebc# inserts the Catalogue Capacity of a building into the Item Description in a Menu Balloon
 +
|}
  
[[category:File Formats/SC4]]
+
{{navbox/FORMAT}}
 +
[[Category:File Formats/SC4]]
 +
[[Category:MTS2]]

Latest revision as of 08:34, 30 August 2019

LTEXT or Language Text files are a Unicode text format used by SimCity 4 to give language specific text strings simply and quickly for use in any part of the world. Unicode of course makes this much easier since the vast number of characters can't always be written in standard text. LTEXT files cover everything from news to building and prop names to tool names in the game. They are queried by Instance ID, so make sure your instance is unique when creating new ones!

LTEXT files are partially controlled by the Delocalizers file, which gives the game instructions about converting text into the local language, or not.

LTEXT files are also related to the User Visible Name Key and Item Description Key in exemplars. They can also contain HTML code that is used by the game. LTEXTs can also contain variables, to be filled in by the game with the appropriate value.

LTEXT files can be found in SimcityLocale.dat, as well as both Maxis and user-created plugin files. They are generally seen as an LTEXT or XA file by Reader.

Format Specification

File Format

WORD - Number of 2 byte characters in the LTEXT.
WORD - 0x0010 - Start of Text control character.
WORD - (Repeating) - 2 Bytes for each character, simply use the Unicode character for the
       value of these two bytes to see its visible in-game form.

In English, decoding this is easy since non-compressed files will appear as an English character followed by a period in most hex editors. Other languages may be harder, i.e. Chinese, Korean. Compressed files do not have this same benefit.

PHP Function

Here is a PHP function that returns the string enclosed in an LTEXT file:

function ltextThing($data){
/*ExemplarFile
	typeID: 6534284a
	$value = the 'content' array key*/

	$thing = str_split($data);
	foreach ($thing as $char => $word){
		if ($char % 2 == int and $char != 2)
			$return .= $word;
	}
return $return;	
}

File Properties

Tags

'Tags', enclosed with Hashes (#), can be included in an LTEXT file to mark where a writer wants dynamic content to be inserted into the text in-game. This can include the City Name or Monthly Costs, among other things.

Tag Content Example Usage
#m:nnnnnnnn# The content of a linked Exemplar Property as Currency (200 is inserted as §200) #m:ea54d286# inserts the Monthly Cost of a building into the Item Description in a Menu Balloon
#d:nnnnnnnn# The content of a linked Exemplar Property as it appears (200 is inserted as 200) #d:27812852# inserts the Power Generation of a building into the Item Description in a Menu Balloon
#d:4aa60ebc# inserts the Catalogue Capacity of a building into the Item Description in a Menu Balloon