Thread Tools Display Modes
11-19-23, 06:59 AM   #1
wisocko
A Murloc Raider
Join Date: Nov 2023
Posts: 6
C_TaskQuest.GetQuestTimeLeftMinutes

I'm trying to get expirations on certain world quests as soon as I log in. Any ideas why print() step 4 below is failing? If I wait for 10-15 sec and run lines 4-8 again from a function, it reports the minutes as expected. It also succeeds if I have been logged in for 10-15 sec and /reload. It only fails when first logging in. I have tried all of the RegisterEvent() options listed in the login sequence of the addon loading process.

Lua Code:
  1. local f=CreateFrame("Frame");
  2. f:RegisterEvent("PLAYER_LOGIN");
  3. f:SetScript("OnEvent",function(self,event,...)
  4.     print(1)
  5.     print(2,C_TaskQuest.GetQuestInfoByQuestID(65143))
  6.     print(3,GetTaskInfo(65143))
  7.     print(4,C_TaskQuest.GetQuestTimeLeftMinutes(65143))
  8.     print(5)
  9. end);

Last edited by wisocko : 11-19-23 at 07:02 AM.
  Reply With Quote
11-19-23, 08:35 AM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Sounds like there is another event you have to wait for.

You could try the following event and its linked function call.

https://warcraft.wiki.gg/wiki/QUEST_DATA_LOAD_RESULT

https://warcraft.wiki.gg/wiki/API_C_...tLoadQuestByID
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
11-21-23, 04:33 PM   #3
wisocko
A Murloc Raider
Join Date: Nov 2023
Posts: 6
Originally Posted by Xrystal View Post
Sounds like there is another event you have to wait for.
Agreed; if someone knows which event, I'd like to know what it is.

Originally Posted by Xrystal View Post
None of these did the trick, unfortunately. Still stymied on this one.
  Reply With Quote
11-21-23, 09:04 PM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
The only ones I would check next would be

UNIT_QUEST_LOG_CHANGED - https://warcraft.wiki.gg/wiki/UNIT_QUEST_LOG_CHANGED

And then ...
TASK_PROGRESS_UPDATE - https://warcraft.wiki.gg/wiki/TASK_PROGRESS_UPDATE
QUEST_LOG_UPDATE - https://warcraft.wiki.gg/wiki/QUEST_LOG_UPDATE

Otherwise I would use the /etrace command to see what events trigger soon after you log in
https://warcraft.wiki.gg/wiki/MACRO_eventtrace
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
11-23-23, 04:08 PM   #5
wisocko
A Murloc Raider
Join Date: Nov 2023
Posts: 6
Originally Posted by Xrystal View Post
The only ones I would check next would be

UNIT_QUEST_LOG_CHANGED - https://warcraft.wiki.gg/wiki/UNIT_QUEST_LOG_CHANGED

And then ...
TASK_PROGRESS_UPDATE - https://warcraft.wiki.gg/wiki/TASK_PROGRESS_UPDATE
QUEST_LOG_UPDATE - https://warcraft.wiki.gg/wiki/QUEST_LOG_UPDATE

Otherwise I would use the /etrace command to see what events trigger soon after you log in
https://warcraft.wiki.gg/wiki/MACRO_eventtrace
No go on the event options, but /etrace is amazing! I had no idea it was a thing. I'll give it a shot next login. Thanks!
  Reply With Quote
11-23-23, 07:16 PM   #6
wisocko
A Murloc Raider
Join Date: Nov 2023
Posts: 6
Originally Posted by Xrystal View Post
Otherwise I would use the /etrace command to see what events trigger soon after you log in
https://warcraft.wiki.gg/wiki/MACRO_eventtrace
I'm not finding documentation on how to fire /etrace on login. By the time I can enter it in chat, lots of events have gone by. EventTrace:SetLoggingPaused(false) doesn't seem to help. I have the "log events when hidden" option turned on in the /etrace window, but no events register that occurred before the window opens. If I can find some way to open it programmatically on ADDON_LOADED, that would be early enough for me.

Last edited by wisocko : 11-23-23 at 07:21 PM. Reason: formatting
  Reply With Quote
11-24-23, 12:14 AM   #7
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Yeah, etrace is a nightmare to unravel. But you can *remove* events you don't want to see - at least I remember doing that when I last played with it an expansion or two back. And it will stop showing them allowing you to narrow it down to events that triggered just after you logged in that you weren't tracking in your addon. Until you see which events were first firing after the PLAYER_LOGIN and PLAYER_ENTERING_WORLD ( which triggers on any reload ) events you won't know which ones to check on.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
11-24-23, 02:26 AM   #8
wisocko
A Murloc Raider
Join Date: Nov 2023
Posts: 6
Originally Posted by Xrystal View Post
Yeah, etrace is a nightmare to unravel. But you can *remove* events you don't want to see - at least I remember doing that when I last played with it an expansion or two back. And it will stop showing them allowing you to narrow it down to events that triggered just after you logged in that you weren't tracking in your addon. Until you see which events were first firing after the PLAYER_LOGIN and PLAYER_ENTERING_WORLD ( which triggers on any reload ) events you won't know which ones to check on.
I actually don't mind the unraveling part, and I did notice the ability to filter unwanted events, which is good. What is not good is that early events like PLAYER_LOGIN and PLAYER_ENTERING_WORLD are never showing up in the event log, because it doesn't start tracing events until /etrace is executed. What I'm hoping for is a way to start /etrace and open the trace window via a .lua call of some sort, so it's already open at the earliest possible event. The first few events that fire are listed in wowpedia, so I can trigger opening the /etrace window programmatically on the first event in the login chain. I just need to find the .lua method for opening /etrace.

Last edited by wisocko : 11-24-23 at 02:28 AM. Reason: clarification
  Reply With Quote
11-24-23, 09:14 AM   #9
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
The only thing I can think of, is registering for all events and save it out to a saved variables table. And then check what events fired, when and with what values.

https://warcraft.wiki.gg/wiki/API_Fr...isterAllEvents
https://warcraft.wiki.gg/wiki/API_Fr...isterAllEvents

Basically set up a saved variable table like EventDebug. And in the event callback function add the information to the table.

An untested example would be something as follows. Just log in, then log out and see what it is in the table. I've used something like this in the past when I've had similar puzzles to solve. If you find it useful and want to add it to your addons you can always include and use a slash command to turn off and on the registering of all events or have a variable at the top of the file that is checked before registering the events.

Lua Code:
  1. SV_EVENTDEBUG = {}  
  2. -- Make sure this table is added as a saved variable table in the toc file
  3.  
  4. local function OnEvent(self, event, ...)
  5.     local eventData = {}
  6.     eventData[event] = { ... }
  7.     table.insert(SV_EVENTDEBUG, eventData)
  8. end
  9.  
  10. local f = CreateFrame("Frame")
  11. f:RegisterAllEvents()
  12. f:SetScript("OnEvent", OnEvent)
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » C_TaskQuest.GetQuestTimeLeftMinutes


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off