titles.txt is a text file used to define preset text messages that can be displayed to the player. These messages are displayed using an
env_message entity.
Because this file is a generic file placed in the mod folder (e.g.
half-life/valve), editing this file is discouraged unless you are using it in a custom mod. Otherwise, if you were to distribute this file with your maps, players would need to replace their existing titles.txt, which they may be unwilling to do if they have edited that file themselves. If you want to show text messages to the player outside of a custom mod, you should use a
game_text entity.
Usage
Parameters
The file uses a set of parameters that, once defined, will be active upon all the messages listed afterwards until they are redefined. These parameters are:
- $position x y - Defines where on the screen the message will appear. x and y are variables between 0 and 1 that specify how far along the respective axis the message will be, with 0 being left / top and 1 being right / bottom. If set to -1, the message will appear in the center of that axis.
- $effect x - Sets how the message will appear. x can be:
- 0 - The message will simply fade in and fade out.
- 1 - The message will fade in and out, and will flicker with the highlight colour.
- 2 - The message will appear letter by letter, typewriter-style, with each letter appearing as the highlight colour before changing to the normal colour.
- $color r g b - Sets the colour of the message.
- $color2 r g b - Sets the highlight colour of the message.
- $fadein x - Sets how many seconds the message takes to fade in. If using effect 2, this will set how long each letter takes to appear.
- $fxtime x - If using effect 2, this sets how long each letter will take, in seconds, to change from the highlight colour to the normal colour as they appear.
- $holdtime x - Sets how many seconds the message will remain on-screen for. For effect 2, this time starts after the last letter appears.
- $fadeout x - Sets how many seconds the message takes to fade out.
Messages
The messages themselves are defined in a simple layout. The layout should be as follows:
Message_Name
{
Message contents, that can span
multiple lines if necessary.
Messages with multiple lines will use
centered formatting.
}
Example
Here is a sample section of a titles.txt file as an example.
$position -1 0.7
$effect 2
$color 100 100 100
$color2 240 110 0
$fadein 0.5
$fxtime 0.1
$holdtime 2
$fadeout 2
Test_Message
{
What a mess.
}
$position -1 0.8
$effect 1
Test_Message_2
{
Who'll clean this up?
Not me.
}
Test_Message will be a typewriter-style message, appearing near the bottom-middle of the screen. The letters will appear as orange for a split second before before changing to a basic grey text. The letters will appear fairly slowly.
Test_Message_2 will appear slightly lower than Test_Message did, and will use the flickery effect rather than the typewriter-style.
Notes
- The game will crash if a message entry contains more than 256 characters.
I tested the Korean version. Its titles.txt comes in UTF16LE encoding, but it looks like the engine fails to parse this encoding, so all env_messages just displays their message names instead of the message's contents. And of course it all uses default values for the
$
settings.