WoW:API GetQuestLogTitle: Difference between revisions

Added returned QuestID to GetQuestLogTitle(); Updated example code for new API and better readability
(Added returned QuestID to GetQuestLogTitle(); Updated example code for new API and better readability)
Line 1: Line 1:
{{wowapi}} __NOTOC__
{{wowapi}} __NOTOC__
Returns information about a quest in your quest log.
Returns information about a quest in your quest log.
  questTitle, level, questTag, suggestedGroup, isHeader, isCollapsed, isComplete, isDaily = GetQuestLogTitle(questID);
  questTitle, level, questTag, suggestedGroup, isHeader, isCollapsed, isComplete, isDaily, questID = GetQuestLogTitle(questLogID);


==Parameters==
==Parameters==
===Arguments===
===Arguments===
:;questID : Integer - The index of the quest you wish to get information about, between 1 and [[API_GetNumQuestLogEntries|GetNumQuestLogEntries()]]'s first return value. (This is not the ID as used in [[QuestString|QuestStrings]].)
:;questLogID : Integer - The index of the quest you wish to get information about, between 1 and [[API_GetNumQuestLogEntries|GetNumQuestLogEntries()]]'s first return value. (This is not the ID as used in [[QuestString|QuestStrings]].)


===Returns===
===Returns===
Line 16: Line 16:
:;isComplete : Integer - -1 if quest is (FAILED), +1 if quest is (COMPLETED), nil otherwise.
:;isComplete : Integer - -1 if quest is (FAILED), +1 if quest is (COMPLETED), nil otherwise.
:;isDaily : Integer - 1 if the quest is daily. (Added in 2.1.0). If questTag is not nil and isDaily is true, then questTag will be format with DAILY_QUEST_TAG_TEMPLATE and displayed in QuestLogFrame.
:;isDaily : Integer - 1 if the quest is daily. (Added in 2.1.0). If questTag is not nil and isDaily is true, then questTag will be format with DAILY_QUEST_TAG_TEMPLATE and displayed in QuestLogFrame.
:;questID : Integer - The quest identification number. This is the number found in GetQuestsCompleted() after it has been completed. It is also the number used to identify quests on sites such as Wowhead.com (Example: [http://www.wowhead.com/?quest=2158 Rest and Relaxation]) (added in 3.3.0)


<div id="questTag">questTag localization: </div>while the value of questTag is localized, it is stored in GlobalStrings.lua as ELITE, LFG_TYPE_DUNGEON, PVP, RAID and GROUP respectively.
<div id="questTag">questTag localization: </div>while the value of questTag is localized, it is stored in GlobalStrings.lua as ELITE, LFG_TYPE_DUNGEON, PVP, RAID and GROUP respectively.


==Example==
==Example==
   local i=1
   local i = 1
   while (GetQuestLogTitle(i) ~= nil) do
   while GetQuestLogTitle(i) do
   local questTitle, level, questTag, suggestedGroup, isHeader, isCollapsed, isComplete, isDaily = GetQuestLogTitle(i)
   local questTitle, level, questTag, suggestedGroup, isHeader, isCollapsed, isComplete, isDaily, questID = GetQuestLogTitle(i)
   if isHeader ~= 1 then
   if ( not isHeader ) then
     DEFAULT_CHAT_FRAME:AddMessage(questTitle .. " [" .. level .. "]")
     DEFAULT_CHAT_FRAME:AddMessage(questTitle .. " [" .. level .. "] " .. questID)
   end
   end
   i = i + 1
   i = i + 1
   end
   end
===Result===
===Result===
Prints the name and the level of all quests in your quest log.
Prints the name, level, and Quest ID of all quests in your quest log.
Anonymous user