WoW:API UnitXP: Difference between revisions
Jump to navigation
Jump to search
m (→Info) |
m (Move page script moved page API UnitXP to API UnitXP without leaving a redirect) |
||
(5 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{wowapi}} | |||
Return the current XP of a "unit" - only seems to work with "player". | Return the current XP of a "unit" - only seems to work with "player". | ||
Line 19: | Line 18: | ||
XP = UnitXP("player") | XP = UnitXP("player") | ||
XPMax = UnitXPMax("player") | XPMax = UnitXPMax("player") | ||
DEFAULT_CHAT_FRAME:AddMessage("Your XP is currently at "..floor( (XP / XPMax)*100 ).."%." | DEFAULT_CHAT_FRAME:AddMessage("Your XP is currently at "..floor( (XP / XPMax)*100 ).."%.",1,0,0) | ||
== Info == | == Info == | ||
Line 36: | Line 35: | ||
== Note == | == Note == | ||
This | This does '''not''' work for hunter pets, use [[API GetPetExperience|GetPetExperience()]] for that. | ||
Latest revision as of 04:47, 15 August 2023
Return the current XP of a "unit" - only seems to work with "player".
XP = UnitXP("unit")
Parameters[edit]
Arguments[edit]
- ("unit")
- unit
- String - The UnitId to select as a target.
Returns[edit]
- XP
- XP
- Numeric - Returns the current XP points of the "unit".
Example[edit]
XP = UnitXP("player") XPMax = UnitXPMax("player") DEFAULT_CHAT_FRAME:AddMessage("Your XP is currently at "..floor( (XP / XPMax)*100 ).."%.",1,0,0)
Info[edit]
DEFAULT_CHAT_FRAME:AddMessage("text",r,g,b)[edit]
- ScrollingMessageFrame:AddMessage("text",r,g,b,id)
- Valid Frame names:
DEFAULT_CHAT_FRAME
ChatFrame1 - ChatFrame7
UnitXPMax("unit")[edit]
- UnitXPMax("unit") - Returns the number of experience points the specified unit needs to reach their next level.
floor(value)[edit]
- floor(value) - Returns the floor of value.
Note[edit]
This does not work for hunter pets, use GetPetExperience() for that.