Is it possible to obtain quest title by questID ?
Is it possible to obtain quest title by questID ?
I'm digging through API, but with no result so far. To clarify: Arbitrary questID. I have no idea, if character have the quest, or if it is even available to character. |
I have been wondering the same thing for quite a while and couldn't find anything either :(
Even addons like DataStore save the quest title to their database when accepting/completing quests or from the player's quest log. Same goes for QuestIsDaily and QuestIsWeekly (both only available on quest dialogs) and GetQuestLink (quest log based). Would love to have a GetQuestInfo(questID) function, but so far no luck. |
How about using this on a hidden tooltip object and reading the first line of the tooltip? http://wowprogramming.com/docs/widge...p/SetHyperlink
|
This is a perfect use-case for a metatable and tooltip scanning:
Code:
local MyScanningTooltip = CreateFrame("GameTooltip", "MyScanningTooltip", UIParent, "GameTooltipTemplate") Code:
print(QuestTitleFromID[30318]) You can use the same technique to get the localized name of anything else where there is no relevant API (eg. if you want item or spell names, just use GetItemInfo or GetSpellInfo). For example, there was recently a thread demonstrating this technique for getting localized NPC names from their mobIDs. |
When you set the tooltip to a quest ID it has to request the information from the server if it hasn't been cached yet, it's similar to getting item information.
You can use OnTooltipSetQuest which triggers when the tooltip actually receives new information. Note that the event can fire multiple times for the same quest because the tooltip may contain the name of items in the "Requirements" section and each item name requires another server request. I had written a more complicated example that retrieved the entire quest text but there probably isn't any point in posting it. |
Does that mean that I can do something like
Lua Code:
|
Aww, stupid... After bashing over a wall of air, it finally worked quite nicely.
Lua Code:
Tested on quest id:25323, it properly spit only one line. (Without unsetting OnTooltipSetQuest, it prints a second line, when quest item data is accessed, as semlar pointed out earlier.) |
If you don't need the quest name immediately (eg. you can wait for OnTooltipSetQuest to happen) then that will work, though I'd suggest cleaning it up some. In no particular order:
Code:
local frame = CreateFrame("GameTooltip", "MyPrivateStuff_QuestInfoTooltipFrame", UIParent, "GameTooltipTemplate") |
Quote:
Though, that previous example with metatable will be a little better for when I need to store and handle a list of quest names during a single session. Quote:
Code:
local argv = { strsplit(" ", strtrim(msg)) } Then how do you suggest I prepare it? I have no idea, how many words will be in parameters. Quote:
Quote:
Quote:
Quote:
Quote:
|
Quote:
Quote:
Quote:
Quote:
|
Quote:
Quote:
Quote:
Quote:
Yes, I don't need any more help, than you've provided already. Thank you. Even less I need to be spoon-fed with complete solutions. I'm not brain-damaged, and I still capable of producing my own solutions provided enough strarting information. Which you did. Thank you once more. You even helped me to realize subtle mistakes in my code, which I did not know, and pointed out a major oversight. Great thank you for that. You was of a very big help. Thank you once more. |
And this is why I love WoWInterface's developer community. Never thought of using the almighty SetTooltipHyperlink("quest:"..questID) treatment.
Here's another thank you! |
Quote:
|
Sorry, but your incrimination makes little sense. I posted my code, when it was written. I didn't held it back on purpose, or anything of that kind.
|
Sorry for pulling this thread out of hibernation, but I've encountered a problem with that "frame:SetScript" part(I guess) I'm not able to solve.
Quote:
As far as I (as a newbie) understand the code, the error should refer to the "frame:SetScript" statement, but I'm not sure on that and much less how to solve that. Error Message Code:
Message: Interface\AddOns\McR_Queststat\mcr_queststat.lua:28: ')' expected (to close '(' at line 20) near 'SLASH_MYPRIVATESTUFF1' McRoell |
Code:
frame:SetScript("OnTooltipSetQuest", function(self) |
I strongly suggest an editor capable of structure highlighting, not just keywords.
|
Quote:
I slightly guessed it but had an other issue with that code - usage - which was spoiling my efforts. Thanks to your confirmation I'm all-clear now. McRoell |
Maybe someone knows if it's possible somehow to obtain localized string on different installed languages for quest titles, descriptions, unit titles.
I think it's possible to do with Blizzard API https://develop.battle.net/documenta...game-data-apis But I wonder if it's possible for example GET quest Title, Description for es_ES, and de_DE ingame? I have an idea of making an addon that will help players to learn a foreign language, but I'm not sure what will be the best way to get multiple localization data at the same time. And make addon easy to maintain in case of new content and updates. |
Quote:
I don't think that's possible in-game. You'd only get the info for your current locale |
All times are GMT -6. The time now is 05:34 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI