-
Notifications
You must be signed in to change notification settings - Fork 2
Creating Mods ~ Text Strings
After [extracting game resources], each language's text strings can be found in the extracted "generated/binaryfile/strings/*.bfile" files. If you open "english.bfile" in a raw text editor, you'll see the following:
// string table
//
{
"
" "\t"
"#STR_SGL04_MAPBRIEF_THEGAUNTLET01" "Adjust the properties on doors in this level so you can walk from the start module to the exit without letting any demons hit the red triggers."
"#STR_SGL04_MAPDESC_THEGAUNTLET" "Learn how to work with doors and keycards"
"#STR_SGL04_MAP_THEGAUNTLET" "Doors and Keycards"
"#STR_SGL10_MAPBRIEF_MODULEMASTERY" "Find the module with the player start and connect it to the module with the exit"
[...]
"#str_dossier_arsenal_weapon_shotgun_desc" "Effective at medium and close range, the Shotgun is a versatile weapon for most encounters."
[...]
}
Ignoring the \t line, each string is comprised of two parts: The name ("#str_dossier_arsenal_weapon_shotgun_desc"), and the text ("Effective at medium and close range, the Shotgun is a versatile weapon for most encounters.").
Some strings also contain two numbers after the text ("#str_zion_weapon_shotgun" "Shotgun" "22" "22"), but this just seems to be a "preferable max string length" for localisers, and can be ignored.
To create custom text strings, create a raw text file at "generated/binaryfile/strings/english.bfile" in your mod, add a pair of curly brackets ({}), and add each string you want on a separate line between them. Example:
{
"#str_zion_weapon_shotgun" "Scatter Gun"
"#str_dossier_arsenal_weapon_shotgun_desc" "Powered by ^nRed Eco^z, packs a punch up close."
"#str_zion_weapon_heavy_rifle_heavy_ar" "Blaster"
"#str_dossier_arsenal_weapon_har_desc" "Powered by ^dYellow Eco^z, fires a long-range shot."
}
Tip
Changes to "english.bfile" will be applied to all languages. If you won't translate your text per-language, then you only need one file.
Note
You shouldn't include any unchanged strings in your mod.
// and /* ... */ comments are supported.
Quotes, backslashes, and line breaks must be escaped as \", \\, and \n, respectively.
Carets (^) can be used to change the text's colour. In the above example,
The colour is determined by the first character after the caret:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
| ^z: Reset to the default colour | ||||||||
If a caret is followed by any character besides 0-9, A-Z, a-p, z, and :;<=>?@[\]^_`, then the literal caret and the following character will be displayed without changing the text's colour.
Carets cannot be escaped. If you need to display a literal caret before any of those characters, U+02C6 Modifier Letter Circumflex Accent (ˆ) looks similar and can sometimes be used instead.
Warning
Lowercase letters will result in unexpected colours if the game displays your string as all caps. Use ^J-^O instead of ^a-^f in this case.
There's no uppercase equivalent for ^g-^p nor ^z.
Warning
A string can only change colour up to 20 times, or less in some cases.