![]() |
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 sequences starting 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
- |r
- Reset the color, all text following this sequence will be drawn in the default color of the text.
- |Hlinktype:linkstring|hLinktext|h
- for hyperlinks: when linktext is clicked, a widget handler is invoked.
- |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.
- |Hspell:SpellID
- for spell links.
- |Htalent:TooltipID:Points
- for talent links.
- TooltipID seems to be a global talent id, not quite sure how it's encoded or stored.
- Points is how many points you've spent in that talent, zero based (3 points in it means '2') and -1 for no points.
- |Htrade:TradeSpellID:CurrentLevel:MaxLevel:PlayerID:Recipes|hLinktext|h
- for Trade links. Note that the TradeSpellID corresponds to the spell id from the spell found in the spellbook (e.g. "Cooking" has id 33359). See also TradeSkillLink.
- CurrentLevel: the current level of the player in the given trade-skill
- MaxLevel: the highest currently achievable skill (an apprentice will have 75 as max level, a grand master 450)
- PlayerID: API_UnitGUID of the player, stripped of all the leading zeroes (unlike GUID for Achievement below where the leading zeroes are included).
- Recipes: Base64-encoded list of learned recipes.
- |Hachievement:AchievementID:GUID:Completed:Month:Day:Year:Unknown1:Unknown2:Unknown3:Unknown4|hLinktext|h
- for achievement links.
- GUID is the API_UnitGUID of the player, without the starting '0x'.
- Completed is 0 for uncompleted achievements and 1 for completed.
- Month/Day/Year is the date the achievement was completed or 0 if not completed. Year is -1 if not completed.
- Unknown1-4 are unknown fields. They're often 0 for non-completed achievements.
- |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:size1:size2:xoffset:yoffset|t
- Will insert a texture into a font string. Parameter size2 is optional (see below). The offsets are optional and will shift the texture from where it would normally be placed. TextHeight is based on size of the font used - this is used to automatically scale icons based on the size of the text.
- size1 == 0; size2 omitted: Width = Height = TextHeight (always square!)
- size1 > 0; size2 omitted: Width = Height = size1 (always square!)
- size1 == 0; size2 == 0 : Width = Height = TextHeight (always square!)
- size1 > 0; size2 == 0 : Width = TextHeight; Height = size1 (size1 is height!!!)
- size1 == 0; size2 > 0 : Width = size2 * TextHeight; Height = TextHeight (size2 is an aspect ratio and defines width!!!)
- size1 > 0; size2 > 0 : Width = size1; Height = size2
- Notes:
- When you need to display square icon in the string (spell/item icon), use only |TTexturePath:0|t
- When you need to display rectangular image in the string (Blizzard logo), use aspect ratio version: |TTexturePath:0:aspectRatio|t
- To prevent potential abuse, raw texture links cannot be sent to other players.[1]
- You can send Raid target icons using texture tags:
- ||
- 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
Sequence | Result |
---|---|
|cFFFF0000This is red text |rthis is normal color | This is red text this is normal color |
|TInterface\\Icons\\INV_Misc_Coin_01:16|t Coins | ![]() |
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.
References
- ^ http://forums.worldofwarcraft.com/thread.html?topicId=2968233433&postId=44930053081&sid=1#293 Embedded Textures in FontStrings