Thanks for all of your help, especially Phanx. They code I posted above was directly from my addon. Next time I will postman or github them. For any wanting to know how I fixed it, posting below:This first section checks whether a quest is tracked and if so, untracked it. or just the opposite if is not tracked.
Code:
function qgc:ToggleWatch(index)
if not index then
index = GetQuestLogSelection()
end
if index>0 then
if IsQuestWatched(index) then -- already watched, remove from watch
RemoveQuestWatch(index)
QuestGuru.Track:SetText("Track")
else -- not watched, see if there's room to add, add if so
if GetNumQuestWatches() >= MAX_WATCHABLE_QUESTS then
UIErrorsFrame:AddMessage(format(QUEST_WATCH_TOO_MANY,MAX_WATCHABLE_QUESTS),1,0.1,0.1,1)
else
AddQuestWatch(index)
QuestGuru.Track:SetText("UnTrack")
end
end
end
end
and second section changes the button to Track/UnTrack depending if the quest is tracked or not:
Code:
function qgc:SelectQuestIndex(index)
SelectQuestLogEntry(index)
StaticPopup_Hide("ABANDON_QUEST")
StaticPopup_Hide("ABANDON_QUEST_WITH_ITEMS")
SetAbandonQuest()
if ( index == 0 ) then
qgc.selectedIndex = nil
QuestGuruDetailScrollFrame:Hide()
elseif index>0 and index<=GetNumQuestLogEntries() and not select(4,GetQuestLogTitle(index)) then
QuestGuruDetailScrollFrame:Show()
QuestInfo_Display(QUEST_TEMPLATE_LOG, QuestGuruDetailScrollChildFrame)
QuestGuruDetailScrollFrameScrollBar:SetValue(0) -- scroll to top
end
if IsQuestWatched(index) then -- already watched, remove from watch
QuestGuru.Track:SetText("UnTrack")
else -- not watched, see if there's room to add, add if so
QuestGuru.Track:SetText("Track")
end
qgc:UpdateLogList()
end
I thought this might be handy for others that may want a button to change depending on what is needed.
Cheers!