Questie

Questie

116M Downloads

Question about API usage

Arby69 opened this issue ยท 4 comments

commented

Question

I want to extend a guide addon with data from Questie. So I added the line
local QuestieDB = QuestieLoader:ImportModule("QuestieDB")
and in the appriopriate function I use:
if QuestieDB then local quest = QuestieDB:GetQuest(qid)
The qid is a valid Quest-ID, but nevertheless, I get the following error:

Message: Interface/AddOns/Questie/Database/QuestieDB.lua:687: attempt to call field 'QueryQuest' (a nil value)
Time: Sat Feb 11 18:09:55 2023
Count: 1
Stack: Interface/AddOns/Questie/Database/QuestieDB.lua:687: attempt to call field 'QueryQuest' (a nil value)
[string "=(tail call)"]: ?
[string "=(tail call)"]: ?
[string "=(tail call)"]: ?
[string "@Interface/AddOns/Questie/Database/QuestieDB.lua"]:687: in function `GetQuest'
...

Did I misunderstand the usage of Questie API? What could go wrong here?

commented

It is installed, active and the command
/dump QuestieLoader:ImportModule("QuestieDB"):GetQuest(456)
ingame dumps the correct information.

Actually, I seem to have two issues: At first, the code that leads to the error message from above, is executed directly after my addon is loaded, so it seems to be that the QuestieDB objject is not fully initialized yet?
(Sorry, the second one is solved. The QuestId parameter seems to be a number, the function cannot handle a number inside a string.)

commented

Just to clarify - is Questie actually installed+running at the same time as your addon, or are you simply trying to include it like a dependency?

commented

Yes, Questie takes a little bit of time to initialize after game load. I'm not sure what the best way to check/wait for it to be loaded is - someone else is going to have to chime in here.

commented

Thanks for clarification. I think I found the mechanism and I was also able to find the place in "my" addon where I could check the field Questie.started and delay the progress with the help of a C_Timer. It seems to work now. (Closed)