The API is no longer being updated here until further notice. |
Main Menu |
---|
|
Many UI elements that display text on the screen support a special escape sequence.
Most likely to prevent interference with the C / LUA escape sequences, Blizzard decided to start those sequences with the pipe character (|).
Supported Escape Sequences
- |cAARRGGBB
- Sets text color. Text following this escape sequence will be drawn in this color. Each pair of digits represents a color value (plus the alpha value, however the alpha value is currently ignored and should always be FF) as a hexadecimal number.
- |cFFFF0000 - Red text
- |cFF00FF00 - Green text
- |cFF0000FF - Blue text
- |cFFFFFF00 - Yellow text
- etc.
- |r
- Reset the color, all text following this sequence will be drawn in the default color of the text.
- |Hlinkid|hLinktext|h
- for Hyperlinks, while the only currently known links are item, enchant, quest and player links.
- |Hitem:ItemString|hLinktext|h
- for Item Links (ItemString must be the full ItemString, ie. d:d:d:d:d:d:d:d style)
- |Henchant:EnchantID|hLinktext|h
- for Enchant Links
- |Hplayer:Name|hLinktext|h
- for Player Links (Click to whisper, CTRL-Click to select and Shift-Click to do a /Who Name)
- |Hquest:QuestID:QuestLevel|hLinktext|h
- for Quest links.
- |n
- Possibly as newline in some cases.
- number |1singular;plural;
- Will choose a word depending on whether the digit preceding it is 0, 1 or not. (i.e. 1,11,21 return the first string). Note that unlike |4 singular and plural forms are separated by semi-colon.
- |2text
- Before vowels outputs d' (with apostrophe) and removes any leading spaces from text, otherwise outputs de (with trailing space)
- |3-formid(text)
- Displays text. Processed by C code, data used for parsing isn't available to UI, all events fire with the data already processed.
- number |4singular:plural; -or- number |4singular:plural1:plural2;
- Will choose a form based on the number preceding it. Client locale dependant. More than two forms (separated by colons) may be required by some locales (i.e. Russian requires 3 forms), if too many forms provided they are ignored, if needed form isn't provided empty string will be used instead. Note that unlike |1 singular and plural forms are separated by colon. (added with 2.4.2)
- |TTexturePath:width:height:xoffset:yoffset|t
- Will insert a texture into a font string. If height is omitted, it will match the width to create a square. The offsets are optional and will shift the texture from where it would normally be placed.
- ||
- Output "|" regardless of if whatever follows it looks like a valid escape.
A "|" followed by something that is not a valid escape sequence will be displayed as-is.
Examples
Text color
|cFFFF0000This is red text |rthis is normal color
Should result in
This is red text this is normal color
Note that color here is 4-channel (aarrggbb).
Gotchas
If you are using an in-game text editor, it is not wholly unlikely that the editor is trying to being "helpful" by replacing "|" with "||" for you without you seeing it. If you are trying to use escape sequences and just keep getting pipe chars, that's why. Try using "\124" instead of "|". 124 is the ascii code escape for the pipe character, and will work regardless of what your editor is trying to do.