WoW:API GetTrackingInfo: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
mNo edit summary
m (Move page script moved page API GetTrackingInfo to API GetTrackingInfo without leaving a redirect)
 
(One intermediate revision by one other user not shown)
Line 19: Line 19:
;:''active'' : If the track is active, it will return 1 but otherwise nil.
;:''active'' : If the track is active, it will return 1 but otherwise nil.


;:''category'' : Track category, returns "spell" if the tracking method is a spell in the spellbook or "npc" if it's a static tracking method.
;:''category'' : Track category, returns "spell" if the tracking method is a spell in the spellbook or "other" if it's a static tracking method.


----
----
Line 33: Line 33:
  DEFAULT_CHAT_FRAME:AddMessage(name.." ("..category..")");
  DEFAULT_CHAT_FRAME:AddMessage(name.." ("..category..")");
  end
  end
== Notes ==
* If you have any tracking items in your spellbook (Find Minerals, Find Treasure, etc), [[API GetNumTrackingTypes|GetNumTrackingTypes]] and [[API GetTrackingInfo|GetTrackingInfo]] will be wrong if used too early.
-- in this example, the character has Mining.
local name = GetTrackingInfo(1);
-- at VARIABLES_LOADED
name == "Repair"
-- at PLAYER_ENTERING_WORLD
name == "Find Minerals"

Latest revision as of 04:46, 15 August 2023

WoW API < GetTrackingInfo

Returns information regarding the specified tracking id.

GetTrackingInfo(id);

Arguments
When opening the tracking menu, the top option is 1, followed by 2, 3, and so on. The "None" function does not have a id assigned.

Returns
name
Track name.
texture
Track texture.
active
If the track is active, it will return 1 but otherwise nil.
category
Track category, returns "spell" if the tracking method is a spell in the spellbook or "other" if it's a static tracking method.

Example

Gathers information for the first option on the tracking list and lists it in the default chatframe:

local name, texture, active, category = GetTrackingInfo(1); DEFAULT_CHAT_FRAME:AddMessage(name.." ("..category..")");

Lists all tracking methods, name and category in the default chatframe:

local count = GetNumTrackingTypes();
for i=1,count do 
	local name, texture, active, category = GetTrackingInfo(i);
	DEFAULT_CHAT_FRAME:AddMessage(name.." ("..category..")");
end

Notes[edit]

-- in this example, the character has Mining.
local name = GetTrackingInfo(1);

-- at VARIABLES_LOADED
name == "Repair"

-- at PLAYER_ENTERING_WORLD
name == "Find Minerals"