• Welcome to SC4 Devotion Forum Archives.

LTEXT Files - Definition and Tutorial (How to add LText files with Reader)

Started by RippleJet, February 23, 2007, 09:18:14 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RippleJet

LTEXT Files - Definition and Tutorial

How to add LText files with Reader

By RippleJet

For understanding this it is assumed that you have at least limited modding experience and that you have acquainted yourself with iLive's Reader

Definition

The following definition for LTEXT files was given by karybdis

LText or Language Text files are a UNICODE text format used by Simcity 4 to give language specific text simply and quickly for use in any part of the world. UNICODE of course makes this much easier since the vast numbers 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!

More information about the LText format and their Group ID's can be found at sims2wiki.

TGI Pointers

LText files are referred to by pointers addressing the LText file's TGI (Type, Group, Instance). The Type ID of an LText file is always 0x2026960B. The Group ID and Instance ID should be randomly selected, eg. using the TGI Generator included in iLive's Reader (in the Tools menu).

There are two ways to point to an LText file through its TGI address:

1. From an exemplar file using a Key Property. A key property contains all three elements of the address, Type ID, Group ID and Instance ID:

  • User Visible Name KeyThe most commonly used naming property, which points to an LText file containing the name of a building or prop, or even foundations, disasters, terrain, graphs, etc.
  • Item Description KeyAnother commonly used property, which points to an LText file containing the description seen when hovering with the mouse over the item in a menu. An Item Desciption Key can be used in building exemplars for all ploppable buildings and other menu items.
  • Name KeyA property similar to the User Visible Name Key, but used only in Ordinance Exemplars.
  • Description KeyA property similar to the Item Description Key, but used only in Ordinance Exemplars.
  • Label (Crime)A property similar to the User Visible Name Key, but used only in Crime Exemplars.
  • My Sim: Name res keyA property similar to the User Visible Name Key, but used only for personal names of sims.

    2. From a query using a Resource Field. A resource field contains only the Group ID and the Instance ID of the address:

  • captionresGZWinText and GZWinBtn legacies in queries may contain a resource field called captionres, which is used for displaying text (a caption) in a query or within a button.
  • tipresGZWinBtn legacies in queries may also contain a resource field called tipres, which is used for text (a tip) shown when hovering with the cursor above a button in a query.

    LText (Language Text) files is the way Maxis provides descriptions and names of buildings and props in the game. LText files offer several benefits compared to the use of string properties (Item Description, Item Name or Exemplar Name) or string fields in queries (caption or tiptext). LText files allow the inclusion of special characters, line breaks, LUA tokens and an easy way to include multilingual support, thanks to the Unicode format. Note however, that the Reader does not include support for editing full unicode text.(such as certain Polish and all Far Eastern characters).

    Tutorial - Adding an LText file in Reader

    If you want to create your own LText files for a User Visible Name Key or an Item Description, I recommend using iLive's LEProp. With LEProp the addition of the LText is automatic and there is no need for editing TGI addresses.

    However, if you want to add LText files for any Key Property belonging to an exemplar file not being a building (props, ordinances, vehicles, etc.), or for a Resource Field in a query, I recommend using iLive's Reader. Eg. props may contain a User Visible Name Key, but the prop's SC4Desc file can not be edited in LEProp. This tutorial shows how to add an LText file for the Item Description Key, with the same result as if it would have been added in LEProp. The same procedure can be followed for adding other LText files.

    In the example below I've used a building batted by Bobbo662, the Pizza Hut. Thank you Bobbo662, for letting me use this building as an example!

    The building is a ploppable building, contained in a SC4Lot file called Pizza Hut-n_92ac0394.SC4Lot. This file can be called a container file (the file you would see in Windows Explorer). The picture below shows this container file opened in the Reader. To the left there is a list of files contained in the container file and to the right you will see the content of the selected file. In the picture below, the Exemplar file for the building is selected (the second property, Exemplar Type, says "Buildings"). When an exemplar file is selected, all properties contained in the Exemplar are shown to the right. The property highlighted is the Exemplar Name, having the value "Pizza Hut", which in this case is the name of the building shown in the game.

    The first thing we will do is to add the property Item Description Key. Right-click anywhere among the properties of the building exemplar and select Add Property. A property window as shown below will pop up. First locate the Property called Item Description Key from the scroll down list (1). Secondly, add 0,0,0 in the Values as text field (2). Press the Apply button to the right (3) and finally the Apply button at the bottom (4) to add an Item Description Key pointing to the address 0x00000000,0x00000000,0x00000000.

    After this we need to add an LText file. This is best done by copying an existing LText file from elsehwere. If you know a lot with a pleasing description and want to use that as a template, just open up that lot in Reader. Otherwise, the best source for an LText file is the file simcitylocal.dat, which contains localized (translated) versions of all LText files used in the game. In order to access this file, click Simcity DAT in the left panel (1), and select the last container file found in there (2). Click Fill the List if you see that button to the right in the Reader, and you will see a long list of LText files. Any of these files will do as a template. In the example below the first LText file is selected. Now, press Ctrl-C, or right-click and select Copy File(s), to copy this file.

    Now, return to your file by clicking Loaded DAT in the left panel (1). If needed, select your container file (2). Now, click on the spot where you want the LText file to appear. In the example shown in the window below I have selected the Building Exemplar (3). If you now press Ctrl-V, or right-click and select Paste File(s), your recently copied LText file will appear after the selected Building Exemplar. Note that the address (Type, Group and Instance) is unchanged from the file copied in simcitylocal.dat (4).

    This address of the LText file must be changed, otherwise your copy will only replace the original file contained in simcitylocal.dat. The address of the LText file must be a unique, randomly selected one. You can use the TGI Generator found under the Tools menu to generate random group and instance ID's.

    However, since the address for the building exemplar itself has been randomly generated, the recommended practice for the Item Description Key is to use the same Group ID and Instance ID for the LText file containing the description as for the Building Exemplar. This is the way an LText file created in LEProp is addressed too. If you're creating an LText file for other purposes, you would have to make sure you are not giving the LText file the same address as any existing LText files.

    The procedure explained below, is my way (not the only way) of changing the address of the LText file. First select the building exemplar (marked below with the X). Right-click and select Copy Entry ID (or select it from the Sub Files menu as shown below). This copies all three elements of the address (Type ID, Group ID and Instance ID).

    Now, select the LText file (marked below with the X). Right-click and select Paste Entry ID (or select it from the Sub Files menu as shown below). This will cause the LText file to get an identical address as the Building Exemplar (you might have to click the LText file in order to see the changes). Don't stop reading here, because you will screw up the lot if you have two files with the same address.

    Since we only wanted the Group ID and Instance ID to be the same as for the Building Exemplar, we need to edit the Type ID. As you already know, the Type ID for LText files should always be 0x2026960B. This is a number you will soon remember, if you start adding LText files to buildings.

    In order to edit the Type ID of the LText file, first make sure the file is selected (1). Then select TGI Editor from the Tools menu on top, which will open up the window shown below. Now, change the ######## in the Type field into 2026960B (2). Then select the file you wish to edit (3). At this stage you need to be careful. Note, that the files are identified only by their address and that they are listed in reverse order compared to the list of files seen on the left. The DIR file is not included at all (you cannot change the address of that). When you're certain you've got the correct file selected, press Apply (4) and close the TGI Editor (5).

    Verify that you did indeed change the address of the LText file and not the Building Exemplar. If something went wrong at this stage, I would recommend exiting Reader without saving and restarting from the beginning.

    Now it is time to edit the content (1) of the LText file (X). This can be done in the right-hand side window of Reader. However, it is probably easier to make the editing in Notepad and then paste the content into Reader's editor window. If you want full control of the editing, you could use an editor supporting Unicode. After you're done with the editing, remember to press Apply (2), otherwise you will have to remake it...

    Now, there is only one thing missing, and that is to change the address of the Item Description Key to point to our LText file. If you remember, the first thing we did was to add this property in the Building Exemplar. At that stage we gave it an address of 0x00000000,0x00000000,0x00000000, which means it doesn't point anywhere. We could have waited and added the Item Description Key at this stage, but since there are several building available having an Item Description Key of only zeroes, I decided to make the guidelines like this.

    Now, make sure you have the Building Exemplar selected (X) and double-click on the property Item Description Key (1), which will open up the window seen below. You now need to edit the numbers in the bottom field, Values as text, to correspond exactly to the address of the LText file (underlined in red). When they correspond, click the Apply button to the right (2). This will copy the content of the Value as text field up to the Values above (3). You could also have edited these values directly, if you find that to be easier. Finish the editing by pressing the bottom-most Apply button (4).

    After this, do remember to save your lot. You should probably have done that regularly all along too!Test your lot in game and see that the item description shown when hovering above the icon of the building in the menu is correct.


    dedgren

    RJ-  This is great (both content and timing)!  I'm a few days away from doing the Reader portion of my ongoing Creating Large Seasonal Woods Lots tutorial [shameless linkie, sorry] in 3RR and you have addressed many of the fine points in wonderful detail here.  I will be pointing readers of my tutorial at this thread for that information, as you have covered it so well.

    Thanks for all the hard work for the community here.  A grasp of basic Reader techniques can add so much enjoyment to the game.


    David
    D. Edgren

    Please call me David...

    Three Rivers Region- A collaborative development of the SC4 community
    The 3RR Quick Finder [linkie]


    I aten't dead.  —  R.I.P. Granny Weatherwax

    Skype: davidredgren

    superhands

    QuoteIn order to edit the Type ID of the LText file, first make sure the file is selected (1). Then select TGI Editor from the Tools menu on top, which will open up the window shown below. Now, change the ######## in the Type field into 2026960B (2). Then select the file you wish to edit (3). At this stage you need to be careful. Note, that the files are identified only by their address and that they are listed in reverse order compared to the list of files seen on the left. The DIR file is not included at all (you cannot change the address of that). When you're certain you've got the correct file selected, press Apply (4) and close the TGI Editor (5).


    thanks Ripple jet. this ID section has helped me greatly.
    i found i had to have Caps lock 'On' in order for the editor to accept code.
    dave