Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Pettifogging Legalist!
retired moderator
Original Poster
#1 Old 21st Feb 2016 at 6:03 PM Last edited by justJones : 6th May 2018 at 11:15 PM.
Default How to add a custom string resource (STBL) to something
I'm using a custom(ised) object for this example but this also applies to, say, tuning mods or anything else that needs custom strings.

If you need to manage a lot of strings and their translations, you might be better off using something like DP's STBL Editor -- but when you just need to add one string in the course of editing other stuff too, this is is probably a quicker way.

For general resource naming conventions (why/when to set the high bits and so on), see the Maxis CC guide (see also link in sticky in Modding Discussion in case they ever move that).

The most recent version of s4pe is available here.

--

The object in my example already has strings for the name and description, but the description reads "**DEBUG**" so I'm changing it to a custom one instead:

  1. First create a new STBL (string table) resource: in the top menu, select Resource > Add.




  2. This opens a popup to specify what you want to add exactly. In the first field type "st" and select "STBL 0x220557DA" from the dropdown that comes up, in the second field put "0x80000000" for the group, then put a sensible name in the Name field, hit the FNV64 button, and change the first two digits of the instance (third field) to the locale that you use (00 for US English). See this post for a list of locale codes + some other info on STBL.




  3. Now you will need a new, unique key to use for your description. Go to top menu > Tools > FNV hash, type a name to use for the string hash key in the top field, hit Calculate, hit "Set High Bit". Copy the value from FNV32 (in my case, "0xC4CAFFDB"). You can also use tools like fogity's toolbox for this, or an online calculator like this one.




  4. Select the newly added STBL and hit "Grid". In the data grid window that opens, hit the three buttons next to "Entries" to add a new entry.




  5. Paste your FNV32 hash into the KeyHash field and type the text you want into the StringValue field.




  6. Hit "OK", hit "Commit". Now the preview of your STBL shows the newly added entry.




  7. To use this as a description for an obect, open the COBJ resource and in "DescriptionHash", paste the key of your new string entry (0xC4CAFFDB in this case. Or if the string is referred to in some XML tuning, paste the key in there.




When you're done adding all the strings you need and have made sure there's no leftover typos in them, and you want to upload your mod somewhere, you (probably) need to create STBLs for the other languages too. Copy the one you have, rightclick > paste, and change the locale code in the instance to match the missing locales as you go. A list of the locale codes that are currently supported is in the Maxis post linked above.

Again this is the simple manual way -- see the link above (STBL Editor) for a tool that can generate the translations automatically.
Screenshots

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
2 users say thanks for this. (Who?)
Back to top