How does C_EncounterJournal work?
If I run this piece of code:
EJ_SelectInstance(1182) numLoot = EJ_GetNumLoot() for i = 1, numLoot do itemInfo = C_EncounterJournal.GetLootInfoByIndex(i) end it only works after I reload my UI. So I start WoW, I get a lua error, then I reload, and now it works until I restart WoW. Why? How do I make it work without the need of reloading? What I try to accomplish is: I want to select armour-type and stats to get items that match the stats I want. Everything works fine, except the return of items on the "first load". People on the Discord don't seem to understand me, so I thought I might give this forum a try. |
At what point are you running that code ? It might be that the information you are asking for isn't available at login but is available by the time the player is entering the world.
What event are you watching for before you use that code segment ? Also, it might need the EncounterJourmal loaded ( I think its a blizzard addon) before it will work. Yes it is Blizzard_EncounterJournal. Have that as a pre-requisite of your addon so that it loads before your addon does and things may work then. |
I am running that code when someone selects via a drop-down menu what he/she looks for. So its not executed right away.
I also tried this "LoadAddOn("Blizzard_EncounterJournal")", but it didn't work. It indeed seems to have some trouble loading the Journal because when friends test it, it usually works. I assume they have already looked or opened the journal so it's already loaded. |
Hmm can't see why it wouldn't work if it is only actioned after LoadAddOn is called and the user has interacted with the game.
|
Ok, thanks for clarifying that it should work, I will play around then and see if I can get it to work.
|
Quote:
Okay, first attempt using it as a required addon in the TOC came up with the following error with the journal. Code:
3x ...s\Blizzard_EncounterJournal\Blizzard_LootJournal.lua:158: Usage: GetSpecializationInfoForSpecID(specID[,sex]) So, time to check the EncounterJournal code to see what else it does before showing the journal itself. |
This is about the best I could do.
It seems that when you first request a look up it doesn't get it all even on callback. However, another request a short time later it will work. I tried to request it a second time on callback but it still doesn't work. But requesting it manually it does. However, you could use the callback that returns the items ID to use the item functions GetItemInfo(itemID) to get the item details. What the Encounter Journal does is look at the scroll list in the encounter journal for that itemID to get the index in the encounter for that item to get the original index. I tried to simulate this by storing the last index requested but it didn't work. When it successfully finds the items and their details using the Encounter Loot function it returns a handful of items ranging from greens, blues, even oranges. However, when it didn't succeed and the event callback had to be used, the items returned at that point are the ones from the original list but also others that weren't in that initial list. This could be because of the waiting time that is in place so maybe some were ready immediately and others weren't. Saving to a savedvariables file to see if the same items do eventually appear with their details may be useful. Anyway give this a play for testing purposes and change it to fit your requirements. At least until someone comes along with a better solution :) Lua Code:
|
All times are GMT -6. The time now is 08:54 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI