Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
(→‎Hyperlinks: Merging from other pages.)
Tag: WoW API docs
No edit summary
Tag: WoW API docs
 
(108 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
{{uitech}} {{tocright}}
 
{{uitech}} {{tocright}}
Many UI elements that display text on the screen support a special escape sequences starting with the | pipe character.
+
Many UI elements that display text on the screen support special escape sequences starting with the | pipe character.
   
{{warning}} If you are using the chat window or an in-game text editor, then <code>"|"</code> will most likely be replaced with <code>"||"</code>. Try using <code>"\124"</code> instead of <code>"|"</code>. 124 is the ASCII code escape for the pipe character, and will work regardless of what the editor is trying to do.
+
{{api ambox|border=red|image=Trade_engineering|size=48|format=tiny|If you are using the chat window or an in-game text editor, then <code>&#124;</code> will be escaped.<br>Try using <code>\124</code> instead which is the ASCII code for the pipe character.}}
   
 
== Escape Sequences ==
 
== Escape Sequences ==
 
=== Coloring ===
 
=== Coloring ===
 
|cAA<font color=FF0000>RR</font><font color=00FF00>GG</font><font color=0000FF>BB</font>text|r
 
|cAA<font color=FF0000>RR</font><font color=00FF00>GG</font><font color=0000FF>BB</font>text|r
* 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. The <code><nowiki>|r</nowiki></code> escape sequence pops nested color sequences in-order<ref>https://github.com/Stanzilla/WoWUIBugs/wiki/9.0.1-Consolidated-UI-Changes</ref>.
+
* 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. The <code>|r</code> escape sequence pops nested color sequences in-order.<sup>[https://github.com/Stanzilla/WoWUIBugs/wiki/9.0.1-Consolidated-UI-Changes#notable-changes]</sup>
  +
<syntaxhighlight lang="lua">
 
/run print("this is \124cFFFF0000red and \124cFF00FF00this is green\124r back to red\124r back to white")
+
/run print("this is \124cFFFF0000red and \124cFF00FF00this is green\124r back to red\124r back to white")
  +
</syntaxhighlight>
 
> this is <span style="color: #ff0000">red and</span> <span style="color: #00ff00">this is green</span> <span style="color: #ff0000">back to red</span> back to white
 
> this is <span style="color: #ff0000">red and</span> <span style="color: #00ff00">this is green</span> <span style="color: #ff0000">back to red</span> back to white
   
  +
==== Global Colors ====
'''''Classic'''''
 
   
  +
|cn<font color="#ecbc2a">colorname</font>:<font color="#80ff80">text</font>|r
{{Patch 1.13.2|note=The <code><nowiki>|r</nowiki></code> escape sequence resets the text to the default color instead of popping nested colors in-order.}}
 
  +
* {{Df-inline}} Renders a text string with a named [https://wow.tools/dbc/?dbc=globalcolor global color].
 
  +
<syntaxhighlight lang="lua">
/run print("this is \124cFFFF0000red and \124cFF00FF00this is green\124r back to white")
 
  +
/run print("Normal Text \124cnPURE_GREEN_COLOR:Green Text \124cnPURE_RED_COLOR:Red Text\124r Green Text\124r Normal Text")
> this is <span style="color: #ff0000">red and</span> <span style="color: #00ff00">this is green</span> back to white
 
  +
</syntaxhighlight>
  +
> Normal Text <span style="color: #00ff00">Green Text <span style="color: #ff0000">Red Text</span> Green Text</span> Normal Text
   
 
=== Textures ===
 
=== Textures ===
|T<font color="#ecbc2a">path</font>:<font color="#80ff80">height</font>[:<font color="#8080ff">width</font>[:<font color="#ff8080">offsetX</font>:<font color="#ff8080">offsetY</font>:[<font color="#C79C6E">textureWidth</font>:<font color="#C79C6E">textureHeight</font>:leftTexel:rightTexel:topTexel:bottomTexel[:<font color="#FF0000">rVertexColor</font>:<font color="#00F00">gVertexColor</font>:<font color="#0000FF">bVertexColor</font>]]]]|t
+
|T<font color="#ecbc2a">path</font>:<font color="#80ff80">height</font>[:<font color="#8080ff">width</font>[:<font color="#ff8080">offsetX</font>:<font color="#ff8080">offsetY</font>[:<font color="#C79C6E">textureWidth</font>:<font color="#C79C6E">textureHeight</font>:leftTexel:rightTexel:topTexel:bottomTexel[:<font color="#FF0000">rVertexColor</font>:<font color="#00F00">gVertexColor</font>:<font color="#0000FF">bVertexColor</font>]]]]|t
 
: Will insert a texture into a font string. Parameter <code>'''<font color="#8080ff">width</font>'''</code> is optional (see below). The offsets are optional and will shift the texture from where it would normally be placed. <code>'''''<font color="#ffff80">TextHeight</font>'''''</code> is based on size of the font used - this is used to automatically scale icons based on the size of the text.
 
: Will insert a texture into a font string. Parameter <code>'''<font color="#8080ff">width</font>'''</code> is optional (see below). The offsets are optional and will shift the texture from where it would normally be placed. <code>'''''<font color="#ffff80">TextHeight</font>'''''</code> is based on size of the font used - this is used to automatically scale icons based on the size of the text.
 
:*<code>'''<font color="#80ff80">height</font>''' == 0; '''<font color="#8080ff">width</font>''' omitted: '''Width''' = '''Height''' = '''''<font color="#ffff80">TextHeight</font>'''''</code> (always square!)
 
:*<code>'''<font color="#80ff80">height</font>''' == 0; '''<font color="#8080ff">width</font>''' omitted: '''Width''' = '''Height''' = '''''<font color="#ffff80">TextHeight</font>'''''</code> (always square!)
Line 36: Line 39:
 
:* When you need to display a rectangular image in the string (Blizzard logo), use aspect ratio version: <code>|T''path'':''<font color="#80ff80">0</font>'':''<font color="#8080ff">aspectRatio</font>''|t</code>
 
:* When you need to display a rectangular image in the string (Blizzard logo), use aspect ratio version: <code>|T''path'':''<font color="#80ff80">0</font>'':''<font color="#8080ff">aspectRatio</font>''|t</code>
   
==== Texture atlas ====
+
=== Texture atlas ===
 
{{Main|AtlasID}}
 
{{Main|AtlasID}}
 
Atlases allow for easily getting part of a texture without having to use tex coords.
 
Atlases allow for easily getting part of a texture without having to use tex coords.
|A<font color="#ecbc2a">atlas</font>:<font color="#80ff80">height</font>:<font color="#8080ff">width</font>[:<font color="#ff8080">offsetX</font>:<font color="#ff8080">offsetY</font>]|a
+
|A:<font color="#ecbc2a">atlas</font>:<font color="#80ff80">height</font>:<font color="#8080ff">width</font>[:<font color="#ff8080">offsetX</font>:<font color="#ff8080">offsetY</font>[:<font color="red">rVertexColor</font>:<font color="green">gVertexColor</font>:<font color="blue">bVertexColor</font>]]|a
   
'''''Examples'''''
+
=== Examples ===
  +
* Both slash <code>/</code> or escaped backslashes <code>\\</code> are valid file separators.
  +
* Parameters that are zeros can be omitted in between <code>:</code>characters.
 
{| class="darktable"
 
{| class="darktable"
 
! colspan="2" | Coloring
 
! colspan="2" | Coloring
 
|-
 
|-
 
| <syntaxhighlight lang="lua">"|cFFFF0000This is red text|r this is normal color"
 
| <syntaxhighlight lang="lua">"|cFFFF0000This is red text|r this is normal color"
WrapTextInColorCode("This is red text", "FFFF0000")</syntaxhighlight>
+
WrapTextInColorCode("This is red text", "FFFF0000").." this is normal color"</syntaxhighlight>
 
| <font color=red>This is red text</font> this is normal color
 
| <font color=red>This is red text</font> this is normal color
 
|-
 
|-
 
! colspan="2" | Texture
 
! colspan="2" | Texture
 
|-
 
|-
| The file path or [[FileDataID]] can be used. Both slash <code>/</code> or escaped backslashes <code>\\</code> are valid file separators.<br><syntaxhighlight lang="lua">"|T133784:16|t Coins"
+
| Accepts a file path or [[FileDataID]].<br><syntaxhighlight lang="lua">"|T133784:16|t Coins"
 
"|TInterface\\Icons\\INV_Misc_Coin_01:16|t Coins"
 
"|TInterface\\Icons\\INV_Misc_Coin_01:16|t Coins"
 
CreateTextureMarkup("Interface/Icons/INV_Misc_Coin_01", 64, 64, 16, 16, 0, 1, 0, 1)</syntaxhighlight>
 
CreateTextureMarkup("Interface/Icons/INV_Misc_Coin_01", 64, 64, 16, 16, 0, 1, 0, 1)</syntaxhighlight>
| [[Image:INV_Misc_Coin_01.png|16px]] Coins<sup>[https://wow.tools/files/#search=interface/icons/inv_misc_coin_01]</sup>
+
| [[File:inv_misc_coin_01.png|16px]] Coins<sup>[https://wow.tools/files/#search=interface/icons/inv_misc_coin_01]</sup>
  +
|-
  +
| <syntaxhighlight lang="lua">"|TInterface\\Icons\\INV_Misc_Coin_01:16:16:0:0:64:64:4:60:4:60|t Coins (cropped)"</syntaxhighlight>
  +
| [[File:INV_Misc_Coin_01_crop.png|16px]] Coins (cropped)
 
|-
 
|-
 
| Sets the vertex color of the texture to green (73:177:73).<br><syntaxhighlight lang="lua">"|TInterface\\ChatFrame\\UI-ChatIcon-ArmoryChat:14:14:0:0:16:16:0:16:0:16:73:177:73|t Reckful"</syntaxhighlight>
 
| Sets the vertex color of the texture to green (73:177:73).<br><syntaxhighlight lang="lua">"|TInterface\\ChatFrame\\UI-ChatIcon-ArmoryChat:14:14:0:0:16:16:0:16:0:16:73:177:73|t Reckful"</syntaxhighlight>
| [[Image:RemoteChat_Icon.png|16px]] Reckful<sup>[https://wow.tools/files/#search=UI-ChatIcon-ArmoryChat]</sup>
+
| [[File:RemoteChat_Icon.png|16px]] Reckful<sup>[https://wow.tools/files/#search=UI-ChatIcon-ArmoryChat]</sup>
 
|-
 
|-
 
! colspan="2" | Texture atlas
 
! colspan="2" | Texture atlas
 
|-
 
|-
| The [[AtlasID|Atlas]] name or ID can be used.<sup>[https://wow.tools/dbc/?dbc=uitextureatlasmember#search=groupfinder-icon-role-large-tank]</sup> Parameters can be omitted in between colon characters.<syntaxhighlight lang="lua">"|A:4259:19:19|a Tank"
+
| Accepts an [[AtlasID|Atlas]] name or ID.<sup>[https://wow.tools/dbc/?dbc=uitextureatlasmember#search=groupfinder-icon-role-large-tank]</sup><syntaxhighlight lang="lua">"|A:4259:19:19|a Tank"
 
"|A:groupfinder-icon-role-large-tank:19:19|a Tank"
 
"|A:groupfinder-icon-role-large-tank:19:19|a Tank"
 
"|Tinterface\\lfgframe\\groupfinder:19:19:::1024:1024:915:944:785:814|t Tank"
 
"|Tinterface\\lfgframe\\groupfinder:19:19:::1024:1024:915:944:785:814|t Tank"
 
CreateAtlasMarkup("groupfinder-icon-role-large-tank", 16, 16)</syntaxhighlight>
 
CreateAtlasMarkup("groupfinder-icon-role-large-tank", 16, 16)</syntaxhighlight>
| [[Image:Atlas_groupfinder-icon-role-large-tank.png|16px]] Tank<sup>[https://wow.tools/files/#search=interface/lfgframe/groupfinder]</sup>
+
| [[File:Atlas_groupfinder-icon-role-large-tank.png|16px]] Tank<sup>[https://wow.tools/files/#search=interface/lfgframe/groupfinder]</sup>
 
|}
 
|}
   
:Utility functions:
+
: Utility functions:
 
:* [https://www.townlong-yak.com/framexml/go/WrapTextInColorCode WrapTextInColorCode()]
 
:* [https://www.townlong-yak.com/framexml/go/WrapTextInColorCode WrapTextInColorCode()]
:* [https://www.townlong-yak.com/framexml/9.0.1/Color.lua#55 ColorMixin:WrapTextInColorCode()] - Adds the color escape sequences from a [[ColorMixin]].
 
 
:* [https://www.townlong-yak.com/framexml/go/CreateTextureMarkup CreateTextureMarkup()]
 
:* [https://www.townlong-yak.com/framexml/go/CreateTextureMarkup CreateTextureMarkup()]
 
:* [https://www.townlong-yak.com/framexml/go/CreateAtlasMarkup CreateAtlasMarkup()]
 
:* [https://www.townlong-yak.com/framexml/go/CreateAtlasMarkup CreateAtlasMarkup()]
   
 
=== Protected strings ===
 
=== Protected strings ===
Also known as Kstrings, they prevent strings from being parsed in addons.
+
Also known as Kstrings - they prevent strings from being parsed. For example addons/scripts only see the string <code>|Kq1|k</code> instead of the actual displayed name.
  +
* <code>q</code> for the confidentiality of Battle.net account names in {{api|C_BattleNet.GetFriendAccountInfo}}().
 
  +
* <code>r</code> for the name and comment in group finder listings in {{api|C_LFGList.GetSearchResultInfo}}() and {{api|C_LFGList.GetActiveEntryInfo}}().
* '''Battle.net'''
 
  +
* <code>u</code> prevents using the message history as a persistent data storage in {{api|C_Club.GetMessageInfo}}() and {{api|C_Club.GetMessagesInRange}}().
:: The <code>q</code> variant e.g. <code>|Kq1|k</code> is used for the confidentiality of Battle.net account names. The number represents the Battle.net friend ID.
 
  +
* <code>v</code> for the message in {{api|t=e|CHAT_MSG_COMMUNITIES_CHANNEL}}.
:: ''Known sources: {{api|C_BattleNet.GetAccountInfoByID}}()''
 
 
* '''Group Finder'''
 
:: The <code>r</code> variant e.g. <code>|Kr14|k</code> is used for the name and comment in group finder listings to prevent addons like [https://www.curseforge.com/wow/addons/worldquestgroupfinder World Quest Group Finder].
 
:: ''Known sources: {{api|C_LFGList.GetSearchResultInfo}}() and {{api|C_LFGList.GetActiveEntryInfo}}()''
 
 
* '''Communities'''
 
:: The <code>v</code> variant e.g. <code>|Kv1|k</code> is used for [[Guild & Communities|Community Channels]] to prevent addons from using it as a shared, persistent data storage. The number represents a chat message line ID.
 
:: ''Known sources: {{api|t=e|CHAT_MSG_COMMUNITIES_CHANNEL}}''
 
   
 
=== Grammar ===
 
=== Grammar ===
  +
====Korean====
;<code>''number'' |1''singular'';''plural'';</code>: 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, as will 0,10,40). Note that unlike |4 singular and plural forms are separated by semi-colon.
 
  +
<code>text|1A;B;</code> is for [[Wikipedia:Korean postpositions|Korean postpositions]].<sup>[https://wow.tools/dbc/?dbc=globalstrings&locale=koKR#search=%7C1]</sup> For example object particles - Eul 을 is used following a consonant, Reul 를 is used following a vowel.
;<code>|2''text''</code>: Before vowels outputs <i>d'</i> (with apostrophe) and removes any leading spaces from ''text'', otherwise outputs <i>de </i> (with trailing space)
 
  +
print("라면|1을;를;") -- 라면<font color="#ecbc2a">을</font> ramyeon<font color="#ecbc2a">eul</font>
;<code>|3-''formid''(''text'')</code>: Displays ''text'' [[wikipedia:Declension|declined]] to the specified form (index ranges from 1 to {{api|GetNumDeclensionSets}}()). Processed by C code, data used for parsing isn't available to UI, all events fire with the data already processed.
 
  +
print("나무|1을;를;") -- 나무<font color="#ecbc2a">를</font> namu<font color="#ecbc2a">reul</font>
;<code>''number'' |4''singular'':''plural'';</code> -or- <code>''number'' |4''singular'':''plural1'':''plural2'';</code>: 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)
 
   
=== Other ===
+
====French====
  +
<code>|2 text</code> is for [[Wikipedia:Contraction_(grammar)#French|French prepositions]] - '''de''' before a consonant and '''d'''' before a vowel. Having zero, one or multiple trailing spaces after |2 does not matter for the end result.
;<code>|n</code>: Newline, if the widget supports it. Similar behavior as <code>\n</code>
 
  +
<syntaxhighlight lang="lua">
  +
print("|2 fraise") -- de fraise
  +
print("|2 avion") -- d'avion
  +
</syntaxhighlight>
   
  +
====Russian====
;<code>||</code>: Escapes the "|" character.
 
  +
<code>|3-id(text)</code> is for the [[wikipedia:Russian_declension#Nouns|Russian declension]] of nouns (including proper names) which take different forms based on their usage in a sentence.<sup>[https://wow.tools/dbc/?dbc=globalstrings&locale=ruRU#search=%7C3]</sup> See also {{api|DeclineName}}().
  +
<syntaxhighlight lang="lua">
  +
print("|3-1(Кролик)") -- Кролика
  +
print("|3-2(Кролик)") -- Кролику
  +
print("|3-3(Кролик)") -- Кролика
  +
print("|3-4(Кролик)") -- Кроликом
  +
print("|3-5(Кролик)") -- Кролике
  +
</syntaxhighlight>
   
  +
====Plural====
;<code>|</code>: "|" followed by something that is not a valid escape sequence will be displayed as-is or is otherwise undefined behavior.
 
  +
<code>number |4singular:plural;</code> ''or'' <code>number |4singular:plural1:plural2;</code> for ruRU. This assigns the singular or plural form depending on the number.
  +
<syntaxhighlight lang="lua">
  +
print("1 |4car:cars;") -- 1 car
  +
print("2 |4car:cars;") -- 2 cars
  +
print("3 blue |4car:cars;") -- 3 blue cars
  +
</syntaxhighlight>
   
  +
<code>number |7singular:plural;</code> behaves the same as |4 but appears to only work while on certain non-english locales.
== Hyperlinks ==
 
  +
<syntaxhighlight lang="lua">
: ''See also: {{api|GameTooltip_SetHyperlink|GameTooltip:SetHyperlink}}() and [https://www.townlong-yak.com/framexml/go/ExtractHyperlinkString ExtractHyperlinkString()].
 
  +
print("1 |7Million:Millionen;") -- 1 Million
: ''Implemented in [https://www.townlong-yak.com/framexml/live/ItemRef.lua FrameXML/ItemRef.lua]''
 
  +
print("2 |7Million:Millionen;") -- 2 Millionen
Hyperlinks are clickable (chat) links, combining several UI escape sequences with a colon-delimited payload to share information.
 
  +
</syntaxhighlight>
|cffxxxxxx|HlinkType:linkString|h[Text]|h|r
 
   
  +
====A or an====
Each kind of hyperlink has the following format:
 
  +
<code>|5 text</code> is for [[wikipedia:English_articles#Distinction_between_a_and_an|indefinite articles]], '''a''' is used before words starting with a consonant sound, '''an''' is used before words starting with a vowel sound.
* <code>|cffxxxxxx</code> - Sets the font color
 
  +
<syntaxhighlight lang="lua">
* <code>|H</code> - Hyperlink introduction
 
  +
print("|5 banana") -- a banana
* <code>linkType:linkString</code> – A colon-delimited payload
 
  +
print("|5 apple") -- an apple
* <code>|h</code> - Hyperlink payload concluded, text follows
 
  +
</syntaxhighlight>
* <code>[Text]</code> - Text using the sender's language in a chat window
 
  +
<!-- print("|5 university") -- an university (wrong but minor detail) -->
* <code>|h</code> - Hyperlink conclusion
 
* <code>|r</code> - Returns font color to normal
 
   
  +
====Lowercase====
The client expects certain combinations of color, payload and text; the chat window may reject invalid entries.
 
  +
<code>|6 TEXT</code> appears to convert only the next word to lowercase.
 
{| class="darktable mw-collapsible mw-collapsed"
 
!HOWTO: Accessing a hyperlink's text&nbsp;&nbsp;
 
|-
 
|
 
From a chat window:
 
/dump <font color=71D5FF>[Flash Heal]</font>
 
 
> |cff71d5ff|Hspell:2061:0|h[Flash Heal]|h|r
 
 
From an addon:
 
hooksecurefunc("SetItemRef", function(link, text)
 
print(link, text:gsub("|", "||"))
 
end)
 
 
> "spell:139:0", "|cff71d5ff|Hspell:139:0|h[Renew]|h|r"
 
|}
 
 
=== achievement ===
 
{{Seealso|AchievementString}}
 
achievement : achievementID : guid : completed : month : day : year : criteria1 : criteria2 : criteria3 : criteria4
 
* <code>guid</code> The player's [[GUID]].
 
* <code>completed</code> 1 for earned, 0 for unearned achievements.
 
* <code>month:day:year</code> Date the achievement was earned or 0:0:-1 if not earned.
 
* <code>criteria1-4</code> 32-bit bitmask fields for completed criteria, or 0:0:0:0 if not completed.
 
: Example:
 
: <code>"|cffffff00|Hachievement:10671:Player-1096-06DF65C1:1:2:16:17:4294967295:4294967295:4294967295:4294967295|h[Level 110]|h|r"</code>
 
: <code>"|cffffff00|Hachievement:12544:Player-1096-06DF65C1:0:0:0:-1:0:0:0:0|h[Level 120]|h|r"</code>
 
 
=== api ===
 
{{Seealso|APILink}}
 
Shows [https://www.townlong-yak.com/framexml/live/Blizzard_APIDocumentation API Documentation] from the [[MACRO_api|/api]] command.
 
api : type : name : [parentName]
 
: Example:
 
: <code>"|cffff55dd|Hapi:system:MapUI:|hMapUI|h|r"</code>
 
: <code>"|cff55ddff|Hapi:function:GetMapInfo:MapUI|hC_Map.GetMapInfo()|h|r"</code>
 
: <code>"|cff77ff22|Hapi:event:ZoneChanged:MapUI|hEvent.MapUI.ZoneChanged|h|r"</code>
 
: <code>"|cff55ffdd|Hapi:table:UiMapDetails:MapUI|hUiMapDetails|h|r"</code>
 
 
=== azessence ===
 
[[:Azerite]] Essence link
 
azessence : essenceID : rank
 
: Example: <code>"|cffa335ee|Hazessence:12:3|h[The Crucible of Flame]|h|r"</code>
 
: See also: {{api|C_AzeriteEssence.GetEssenceInfo}}()
 
 
=== battlepet ===
 
battlepet : speciesID : level : breedQuality : maxHealth : power : speed : battlePetID
 
: Example: <code>"|cff1eff00|Hbattlepet:202:25:2:1435:267:240:BattlePet-0-000000CC9EA1|h[Baby Blizzard Bear]|h|r"</code>
 
 
=== battlePetAbil ===
 
battlePetAbil : abilityID : maxHealth : power : speed
 
: Example: <code>"|cff4e96f7|HbattlePetAbil:348:1435:267:240|hBash|h|r"</code>
 
 
=== calendarEvent ===
 
calendarEvent : monthOffset : monthDay : index
 
: Example: <code>"|HcalendarEvent:0:12:1|hSpring Balloon Festival|h"</code>
 
: See also: {{api|C_Calendar.GetDayEvent}}()
 
 
=== channel ===
 
Opens the chat window to a specific /channel.
 
channel : channelType : [channelID]
 
: Example:
 
: <code>"|Hchannel:channel:2|h[2. Trade - City]|h"</code>
 
: <code>"|Hchannel:PARTY|h[Party]|h"</code>
 
 
=== clubFinder ===
 
[[Guild Finder]] (8.2.5) invite link.
 
clubFinder : clubFinderId
 
: Example: <code>"|cffffd100|HclubFinder:ClubFinder-1-19160-1598-53720920|h[Guild: Happy Leveling]|h|r"</code>
 
: See also: [https://www.townlong-yak.com/framexml/go/GetClubFinderLink GetClubFinderLink]()
 
 
=== clubTicket ===
 
[[Guild_%26_Communities|WoW communities & Blizzard Groups]] invite link.
 
clubTicket : ticketId
 
: Example: <code>"|cffffd100|HclubTicket:oxPbMfv2R|h[Join: test]|h|r"</code>
 
: See also: [https://www.townlong-yak.com/framexml/go/GetClubTicketLink GetClubTicketLink]()
 
 
=== community ===
 
Community link in [[Quick Join]] requests.
 
community : clubId
 
 
=== conduit ===
 
[[Conduit]] link
 
conduit : id : [rank]
 
: Example: <code>"|cff71d5ff|Hconduit:5:1|h[Stalwart Guardian]|h|r"</code>
 
: See also: {{api|C_Soulbinds.GetConduitHyperlink}}()
 
 
=== currency ===
 
currency : id : [amount]
 
: Example: <code>"|cffffffff|Hcurrency:1744|h[Corrupted Memento]|h|r"</code>
 
 
=== death ===
 
Opens the [[API_GetDeathRecapLink|Death recap]] overview.
 
death : recapID
 
: Example: <code>"|Hdeath:1|h[You died.]|h"</code>
 
 
=== enchant ===
 
Opens the [[Profession|Tradeskill]] window for a recipe.
 
enchant : spellID
 
: Example: <code>"|cffffd000|Henchant:162206|h[Draenor Engineering: World Shrinker]|h|r"</code>
 
 
=== garrfollower ===
 
garrfollower : followerID : quality : level : itemLevel : ability1 : ability2 : ability3 : ability4 : trait1 : trait2 : trait3 : trait4 : spec1
 
: Example: <code>"|cffa335ee|Hgarrfollower:856:4:110:900:457:777:0:0:684:758:0:0:354|h[Calia Menethil]|h|r"</code>
 
 
=== garrfollowerability ===
 
garrfollowerability : abilityID
 
: Example:
 
: <code>"|cff4e96f7|Hgarrfollowerability:354|h[Discipline]|h|r"</code>
 
: <code>"|cff4e96f7|Hgarrfollowerability:457|h[Holy Nova]|h|r"</code>
 
 
=== garrmission ===
 
garrmission : missionID : missionDBID
 
: Example: <code>"|cffffff00|Hgarrmission:1610:000000000238f82d|h[Withered Straining]|h|r"</code>
 
: Note: This link type can also be used for securely implementing custom links by posthooking <code>SetItemRef()</code> since it silently fails on non-numbers, whereas custom link types would [https://www.townlong-yak.com/framexml/8.2.5/ItemRef.lua#363 error] out. It does not work on actual chat messages through {{api|SendChatMessage}}() as the server won't show the message.
 
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
  +
print("|6 HELLO WORLD") -- hello WORLD
hooksecurefunc("SetItemRef", function(link)
 
local linkType, addon, param1 = strsplit(":", link)
 
if linkType == "garrmission" and addon == "SomeAddon" then
 
if param1 == "foo" then
 
print(link)
 
end
 
end
 
end)
 
 
</syntaxhighlight>
 
</syntaxhighlight>
print("|cFFFFFF00|Hgarrmission:SomeAddon:foo|h[Some Clickable Message]|h|r")
 
   
=== instancelock ===
+
=== Word Wrapping ===
  +
|W<font color="#ecbc2a">text</font>|w
Opens the [[Raid_lockout|/raidinfo]] list.
 
  +
Hints that word wrapping of <font color="#ecbc2a">text</font> should be avoided where possible. If the text would require wrapping the client will prefer to wrap before the start of the sequence instead of breaking it up. If the text is still too large, the hint may be ignored and the text broken up regardless.
instancelock : guid : instanceID : difficulty : defeatedEncounters
 
* <code>guid</code> The player's [[GUID]].
 
* <code>instanceID</code> The instance's [[InstanceID]]
 
* <code>difficulty</code> The instance's [[DifficultyID]]
 
* <code>defeatedEncounters</code> Bitfield indicating the encounters that have been defeated. e.g. 7 means that the first 3 encounters have been cleared.
 
: Example: <code>"|cffff8000|Hinstancelock:Player-3296-000957C8:543:2:4|h[Hellfire Citadel: Ramparts]|h|r"</code>
 
   
=== item ===
+
=== Other ===
  +
: <code>|n</code>: Newline, if the widget supports it. Similar behavior as <code>\n</code> and <code>\r</code>
item : itemString
 
  +
: <code>||</code>: Escapes the "|" character.
* <code>itemString</code> must be minimum 18 params when used in {{api|SendChatMessage}}: i.e. <code>%d:::::::::::::::::</code>
 
  +
: Any invalid escape sequences will be displayed as-is or is otherwise undefined behavior.
: Example:
 
: <code>"|cffffffff|Hitem:2592:::::::::::::::::|h[Wool Cloth]|h|r"</code>
 
: See also: [[ItemLink]]
 
 
=== journal ===
 
Opens the [[Adventure Guide]].
 
journal : journalType : journalID : difficulty
 
* <code>journalType</code> 0=Instance, 1=Encounter, 2=Section.
 
* <code>journalID</code> InstanceID, [[JournalEncounterID|EncounterID]], or [https://wow.tools/dbc/?dbc=journalencountersection SectionID].
 
* <code>difficulty</code> [[DifficultyID]] of the instance.
 
: Example:
 
: <code>"|cff66bbff|Hjournal:0:1031:14|h[Uldir]|h|r"</code>
 
: <code>"|cff66bbff|Hjournal:1:2147:14|h[G'huun]|h|r"</code>
 
: <code>"|cff66bbff|Hjournal:2:18068:14|h[Titan Spark]|h|r"</code>
 
: See also: {{api|EJ_HandleLinkPath}}()
 
 
=== levelup ===
 
levelup : level : levelUpType : [petName]
 
: Example:
 
: <code>"|cffFF4E00|Hlevelup:2:LEVEL_UP_TYPE_CHARACTER|h[Level 2]|h|r"</code>
 
: <code>"|cffFF4E00|Hlevelup:2:LEVEL_UP_TYPE_PET:Bear|h[Level 2]|h|r"</code>
 
 
=== lootHistory ===
 
Opens the [[Loot#Loot_options:_Need.2C_Greed.2C_Disenchant_and_Pass|/loot]] window.
 
lootHistory : rollID
 
 
=== player ===
 
: Left-click: starts a whisper message
 
: Right-click: opens the player context menu
 
: Shift-click: sends a [[MACRO_who|/who]] query
 
player : name : [lineID] : [chatType] : [chatTarget]
 
* <code>lineID</code> Message ID for reporting.
 
: Example:
 
: <code>"|Hplayer:Fadeshift|h[Fadeshift]|h"</code>
 
: <code>"|Hplayer:Aquadoll-MoonGuard|h[Aquadoll]|h"</code>
 
: <code>"|Hplayer:Ketho-Anasterian:8:PARTY:|h[|cfffefefeKetho|r]|h"</code>
 
: <code>"|Hplayer:Kilastra-DefiasBrotherhood:90:CHANNEL:2|h[|cff8686ecKilastra|r]|h"</code>
 
: See also: [https://www.townlong-yak.com/framexml/go/GetPlayerLink GetPlayerLink()]
 
 
=== playerCommunity ===
 
playerCommunity : name : communityClubID : communityStreamID : communityEpoch : communityPosition
 
: Example: <code>"|HplayerCommunity:Ketho-Anasterian:333281:1:1557794365297000:5886997898769|h[|cfffefefeKetho|r]|h"</code>
 
 
=== BNplayer ===
 
Battle.net friend links.
 
BNplayer : name : bnetIDAccount : lineID : chatType : chatTarget
 
 
=== BNplayerCommunity ===
 
BNplayerCommunity : name : bnetIDAccount : communityClubID : communityStreamID : communityEpoch : communityPosition
 
 
=== quest ===
 
quest : questID : questLevel : unknown1 : unknown2 : unknown3
 
: Example:
 
: <code>"|cffffff00|Hquest:53370:-1:110:120:3|h[Hour of Reckoning]|h|r"</code>
 
: <code>"|cffff8040|Hquest:40746:113:110:255:0|h[One of the People]|h|r"</code>
 
: See also: [[QuestLink]]
 
 
=== shareachieve ===
 
Opens the Twitter [[MACRO_share|/share]] window for an achievement.
 
shareachieve : achievementID : earned
 
: Example: <code>"|cffffd200|Hshareachieve:964:1|h|TInterface\ChatFrame\UI-ChatIcon-Share:18:18|t|h|r"</code>
 
 
=== shareitem ===
 
Twitter item link.
 
shareitem : itemLink : earned
 
: Example: <code>"|cffffd200|Hshareitem:151428::::::::20:257:512:1:1:4068:20::::1|h|TInterface\ChatFrame\UI-ChatIcon-Share:18:18|t|h|r"</code>
 
 
=== sharess ===
 
Twitter screenshot link.
 
sharess : screenshotIndex
 
* <code>screenshotIndex</code>: index of the screenshot to autofill the Tweet with, counted from last login.
 
: Example: <code>"|cffffd200|Hsharess:1|h|TInterface\ChatFrame\UI-ChatIcon-Share:18:18|t|h|r"</code>
 
 
=== spell ===
 
spell : spellId : glyphId : [event]
 
: Example:
 
: <code>"|cff71d5ff|Hspell:2096:0|h[Mind Vision]|h|r"</code>
 
: <code>"|Hspell:589:0:SPELL_DAMAGE|hShadow Word: Pain|h"</code>
 
: See also: {{api|GetSpellLink}}()
 
 
=== storecategory ===
 
Opens the [[In-Game Store]].
 
storecategory : category
 
: Example: <code>"|cffffd000|Hstorecategory:games|h[Click To Upgrade]|h|r"</code>
 
 
=== talent ===
 
talent : talentID
 
: Example: <code>"|cff71d5ff|Htalent:21754|h[Circle of Healing]|h|r"</code>
 
: See also: {{api|GetTalentInfoByID}}()
 
 
=== trade ===
 
Shows the tradeskill window (from another player).
 
trade : guid : spellID : skillLineID
 
* <code>guid</code> The player's [[GUID]].
 
* <code>spellID</code> The tradeskill's Spell ID.
 
* <code>skillLineID</code> The [[TradeSkillLineID]].
 
: Example: <code>"|cffffd000|Htrade:Player-3296-000957C8:195128:185|h[Cooking]|h|r"</code>
 
: See also: [[TradeSkillLink]]
 
 
=== transmogappearance ===
 
transmogappearance : sourceID
 
 
=== transmogillusion ===
 
Previews a weapon enchant in the [[Dressing room]].
 
transmogillusion : sourceID
 
: Example: <code>"|cffff80ff|Htransmogillusion:5862|h[Titanguard]|h|r"</code>
 
: See also: {{api|C_TransmogCollection.GetIllusionSourceInfo}}()
 
 
=== transmogset ===
 
transmogset : setID
 
See also: {{api|C_TransmogSets.GetSetInfo}}()
 
 
=== unit ===
 
Shows the unit tooltip. Opens the combat log context menu on right-click.
 
unit : guid : [name]
 
: Example: <code>"|Hunit:Creature-0-2083-0-7-299-00005A0F91:Young Wolf|hYoung Wolf|h"</code>
 
Implemented in [https://www.townlong-yak.com/framexml/8.1.5/Blizzard_CombatLog/Blizzard_CombatLog.lua#3434 Blizzard_CombatLog.lua]
 
 
=== urlIndex ===
 
Opens a URL in the default web browser.
 
urlIndex : index
 
: Example: <code>"|HurlIndex:25|h|cff006995Frequently Asked Questions|r|h"</code>
 
 
=== worldmap ===
 
Opens the World Map to display a pinned waypoint.
 
worldmap : uiMapID : x : y
 
 
* <code>uiMapID</code> The [[UiMapID]] for the waypoint.
 
* <code>x</code> The X coordinate of the waypoint, multiplied by 10000.
 
* <code>y</code> The Y coordinate of the waypoint, multiplied by 10000.
 
   
  +
==Patch changes==
: Example: <code>"|cffffff00|Hworldmap:84:7222:2550|h[|A:Waypoint-MapPin-ChatIcon:13:13:0:0|a Map Pin Location]|h|r"</code>
 
  +
* {{Patch 9.0.1|note=The <code><nowiki>|r</nowiki></code> escape sequence pops nested color sequences in-order instead of resetting the text to the default color.}}
: enUS globalstring: <code>MAP_PIN_HYPERLINK = "|A:Waypoint-MapPin-ChatIcon:13:13:0:0|a Map Pin Location"</code>
 
  +
* {{Patch 5.4.1|note=Added the <code><nowiki>|W</nowiki></code> escape sequence (word wrapping).}}
: See also: {{api|C_Map.SetUserWaypoint}}()
 
  +
* {{Patch 4.0.1|note=Added the <code><nowiki>|K</nowiki></code> escape sequence (Kstrings).}}
   
==References==
+
==See also==
  +
* [[Hyperlinks]]

Latest revision as of 18:47, 20 September 2023

Many UI elements that display text on the screen support special escape sequences starting with the | pipe character.

Escape Sequences

Coloring

|cAARRGGBBtext|r
  • 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. The |r escape sequence pops nested color sequences in-order.[1]
/run print("this is \124cFFFF0000red and \124cFF00FF00this is green\124r back to red\124r back to white")
> this is red and this is green back to red back to white

Global Colors

|cncolorname:text|r
/run print("Normal Text \124cnPURE_GREEN_COLOR:Green Text \124cnPURE_RED_COLOR:Red Text\124r Green Text\124r Normal Text")
> Normal Text Green Text Red Text Green Text Normal Text

Textures

|Tpath:height[:width[:offsetX:offsetY[:textureWidth:textureHeight:leftTexel:rightTexel:topTexel:bottomTexel[:rVertexColor:gVertexColor:bVertexColor]]]]|t
Will insert a texture into a font string. Parameter width 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.
  • height == 0; width omitted: Width = Height = TextHeight (always square!)
  • height > 0;  width omitted: Width = Height = height (always square!)
  • height == 0; width == 0   : Width = Height = TextHeight (always square!)
  • height > 0;  width == 0   : Width = TextHeight; Height = height (height is height!!!)
  • height == 0; width > 0    : Width = width * TextHeight; Height = TextHeight (width is an aspect ratio and defines width!!!)
  • height > 0;  width > 0    : Width = width; Height = height
  • offsetX offsetY: Offset for the rendered image, in pixels
  • textureWidth textureHeight: Size of the source image, in pixels
  • leftTexel rightTexel topTexel bottomTexel: (x1 x2 y1 y2) Coordinates that identify the left/right/top/bottom edges, in pixels (see Texture:SetTexCoord() but non-normalized)
  • rVertexColor gVertexColor bVertexColor: RGB color values in the range 0-255 that are used to tint the texture
Notes:
  • When you need to display a square icon in the string (spell/item icon), use only |Tpath:0|t
  • When you need to display a rectangular image in the string (Blizzard logo), use aspect ratio version: |Tpath:0:aspectRatio|t

Texture atlas

Main article: AtlasID

Atlases allow for easily getting part of a texture without having to use tex coords.

|A:atlas:height:width[:offsetX:offsetY[:rVertexColor:gVertexColor:bVertexColor]]|a

Examples

  • Both slash / or escaped backslashes \\ are valid file separators.
  • Parameters that are zeros can be omitted in between :characters.
Coloring
"|cFFFF0000This is red text|r this is normal color"
WrapTextInColorCode("This is red text", "FFFF0000").." this is normal color"
This is red text this is normal color
Texture
Accepts a file path or FileDataID.
"|T133784:16|t Coins"
"|TInterface\\Icons\\INV_Misc_Coin_01:16|t Coins"
CreateTextureMarkup("Interface/Icons/INV_Misc_Coin_01", 64, 64, 16, 16, 0, 1, 0, 1)
Inv misc coin 01 Coins[2]
"|TInterface\\Icons\\INV_Misc_Coin_01:16:16:0:0:64:64:4:60:4:60|t Coins (cropped)"
INV Misc Coin 01 crop Coins (cropped)
Sets the vertex color of the texture to green (73:177:73).
"|TInterface\\ChatFrame\\UI-ChatIcon-ArmoryChat:14:14:0:0:16:16:0:16:0:16:73:177:73|t Reckful"
RemoteChat Icon Reckful[3]
Texture atlas
Accepts an Atlas name or ID.[4]
"|A:4259:19:19|a Tank"
"|A:groupfinder-icon-role-large-tank:19:19|a Tank"
"|Tinterface\\lfgframe\\groupfinder:19:19:::1024:1024:915:944:785:814|t Tank"
CreateAtlasMarkup("groupfinder-icon-role-large-tank", 16, 16)
Atlas groupfinder-icon-role-large-tank Tank[5]
Utility functions:

Protected strings

Also known as Kstrings - they prevent strings from being parsed. For example addons/scripts only see the string |Kq1|k instead of the actual displayed name.

Grammar

Korean

text|1A;B; is for Korean postpositions.[6] For example object particles - Eul 을 is used following a consonant, Reul 를 is used following a vowel.

print("라면|1을;를;") -- 라면 ramyeoneul
print("나무|1을;를;") -- 나무 namureul

French

|2 text is for French prepositions - de before a consonant and d' before a vowel. Having zero, one or multiple trailing spaces after |2 does not matter for the end result.

print("|2 fraise") -- de fraise
print("|2 avion")  -- d'avion

Russian

|3-id(text) is for the Russian declension of nouns (including proper names) which take different forms based on their usage in a sentence.[7] See also DeclineName().

print("|3-1(Кролик)") -- Кролика
print("|3-2(Кролик)") -- Кролику
print("|3-3(Кролик)") -- Кролика
print("|3-4(Кролик)") -- Кроликом
print("|3-5(Кролик)") -- Кролике

Plural

number |4singular:plural; or number |4singular:plural1:plural2; for ruRU. This assigns the singular or plural form depending on the number.

print("1 |4car:cars;")      -- 1 car
print("2 |4car:cars;")      -- 2 cars
print("3 blue |4car:cars;") -- 3 blue cars

number |7singular:plural; behaves the same as |4 but appears to only work while on certain non-english locales.

print("1 |7Million:Millionen;") -- 1 Million
print("2 |7Million:Millionen;") -- 2 Millionen

A or an

|5 text is for indefinite articles, a is used before words starting with a consonant sound, an is used before words starting with a vowel sound.

print("|5 banana") -- a banana
print("|5 apple")  -- an apple

Lowercase

|6 TEXT appears to convert only the next word to lowercase.

print("|6 HELLO WORLD") -- hello WORLD

Word Wrapping

|Wtext|w

Hints that word wrapping of text should be avoided where possible. If the text would require wrapping the client will prefer to wrap before the start of the sequence instead of breaking it up. If the text is still too large, the hint may be ignored and the text broken up regardless.

Other

|n: Newline, if the widget supports it. Similar behavior as \n and \r
||: Escapes the "|" character.
Any invalid escape sequences will be displayed as-is or is otherwise undefined behavior.

Patch changes

  • Shadowlands Patch 9.0.1 (2020-10-13): The |r escape sequence pops nested color sequences in-order instead of resetting the text to the default color.
  • Mists of Pandaria Patch 5.4.1 (2013-10-29): Added the |W escape sequence (word wrapping).
  • Cataclysm Patch 4.0.1 (2010-10-12): Added the |K escape sequence (Kstrings).

See also