View Single Post
09-01-20, 10:20 AM   #4
Tair
A Deviate Faerie Dragon
Join Date: Aug 2020
Posts: 10
Okay, thanks again for that head start, SDPhantom. I used your demo as a guide and put together a hook that covers just about everything I wanted to do:

lua Code:
  1. hooksecurefunc("QuestWatch_Update",function()
  2.     local questIndex;
  3.     local watchTextIndex = 1;
  4.     local numObjectives;
  5.     local watchText;
  6.  
  7.     for i=1, GetNumQuestWatches() do
  8.         local questIndex = GetQuestIndexForWatch(i);
  9.         if (questIndex) then
  10.             numObjectives = GetNumQuestLeaderBoards(questIndex);
  11.             -- Quest title
  12.             if ( numObjectives > 0 ) then
  13.                 watchText = _G["QuestWatchLine"..watchTextIndex];
  14.                 -- Font
  15.                 watchText:SetFont("Fonts\\FRIZQT__.TTF", 15, "OUTLINE");
  16.                 watchText:SetShadowColor(0,0,0,0);
  17.                 watchText:SetAlpha(0.85);
  18.                 -- Adjust padding between quests
  19.                 if ( watchTextIndex > 1 ) then
  20.                     watchText:SetPoint("TOPLEFT", "QuestWatchLine"..(watchTextIndex - 1), "BOTTOMLEFT", 0, -12);
  21.                 end
  22.                 watchTextIndex = watchTextIndex + 1;
  23.             end
  24.             -- Quest objectives
  25.             for j=1, numObjectives do
  26.                 text = GetQuestLogLeaderBoard(j, questIndex);
  27.                 watchText = _G["QuestWatchLine"..watchTextIndex];
  28.                 watchText:SetText(text);
  29.                 -- Font
  30.                 watchText:SetFont("Fonts\\FRIZQT__.TTF", 13, "OUTLINE");
  31.                 watchText:SetShadowColor(0,0,0,0);
  32.                 watchText:SetAlpha(0.85);
  33.                 -- Adjust padding between objectives
  34.                 watchText:SetPoint("TOPLEFT", "QuestWatchLine"..(watchTextIndex - 1), "BOTTOMLEFT", 0, -4);
  35.                 watchTextIndex = watchTextIndex + 1;
  36.             end
  37.         end
  38.     end

And the result:



One question—the :SetJustifyH("RIGHT") parameter (not included in the above code) doesn't affect the quest titles or objectives. I'm thinking this could be due to the existing :SetPoint parameters that are used to position the text.

Is it possible to use :SetJustifyH or another method to right-align the titles and objectives without breaking the layout?

Thanks!

Edit: I had some success with getting right-aligned titles and objectives by adjusting the SetPoint parameters:

Lua Code:
  1. hooksecurefunc("QuestWatch_Update",function()
  2.     local questIndex;
  3.     local watchTextIndex = 1;
  4.     local numObjectives;
  5.     local watchText;
  6.  
  7.     for i=1, GetNumQuestWatches() do
  8.         local questIndex = GetQuestIndexForWatch(i);
  9.         if (questIndex) then
  10.             numObjectives = GetNumQuestLeaderBoards(questIndex);
  11.             -- Quest title
  12.             if ( numObjectives > 0 ) then
  13.                 watchText = _G["QuestWatchLine"..watchTextIndex];
  14.                 -- Font
  15.                 watchText:SetFont("Fonts\\FRIZQT__.TTF", 15, "OUTLINE");
  16.                 watchText:SetShadowColor(0,0,0,0);
  17.                 watchText:SetAlpha(0.85);
  18.                 -- Positioning
  19.                 watchText:ClearAllPoints();
  20.                 watchText:SetPoint("TOPRIGHT", QuestWatchFrame, "TOPRIGHT", -15, 0)
  21.                 -- Adjust padding between quests
  22.                 if ( watchTextIndex > 1 ) then
  23.                     watchText:ClearAllPoints();
  24.                     watchText:SetPoint("TOPRIGHT", "QuestWatchLine"..(watchTextIndex - 1), "TOPRIGHT", 0, -30)
  25.                 end
  26.                 watchTextIndex = watchTextIndex + 1;
  27.             end
  28.             -- Quest objectives
  29.             for j=1, numObjectives do
  30.                 text = GetQuestLogLeaderBoard(j, questIndex);
  31.                 watchText = _G["QuestWatchLine"..watchTextIndex];
  32.                 watchText:SetText(text);
  33.                 -- Font
  34.                 watchText:SetFont("Fonts\\FRIZQT__.TTF", 13, "OUTLINE");
  35.                 watchText:SetShadowColor(0,0,0,0);
  36.                 watchText:SetAlpha(0.85);
  37.                 -- Adjust padding between objectives
  38.                 watchText:ClearAllPoints();
  39.                 watchText:SetPoint("TOPRIGHT", "QuestWatchLine"..(watchTextIndex - 1), "TOPRIGHT", 0, -18);
  40.                 watchTextIndex = watchTextIndex + 1;
  41.             end
  42.         end
  43.     end
  44. end);

Thanks again for setting me on the right path.

Last edited by Tair : 09-01-20 at 08:34 PM.
  Reply With Quote