Buy from a vendor the first time
Hi all. There is a code that currently works as follows: When contacting a vendor, he buys the specified items. In this case, you need to contact the vendor twice (he does not buy the goods the first time).
Lua Code:
As planned: Purchasing items when first contacting the vendor. |
It might be because it is processing things a bit too soon.
You could see if using the MERCHANT_UPDATE event ( at least the first time around ) will be the best time to do any semi automatic transactions. Looking at the MerchantFrame Blizzard code ( https://github.com/Gethe/wow-ui-sour...chantFrame.lua ) The updating of the merchant frame doesn't occur until the end of the Merchant_Show function. So it is possible that the following is happening. Lua Code:
Depending on how often MERCHANT_UPDATE triggers, you might need to UnRegister it when it first triggers and have registering it happen when the MERCHANT_SHOW event triggers. For example: Lua Code:
-- OR -- If that doesn't work. You could try hooking into the MerchantFrame_MerchantShow function to add your functionality in place. For example: Lua Code:
|
So it will be like this?
Lua Code:
|
Not quite - I wasn't sure what the following was for so my updated version doesn't have it in
Lua Code:
Give this a go. As a reminder, event watching only frames technically don't need to be named. I have clearly separated the sections of the code you posted so that it makes it easier to see which items you can put in separate files if and when you need to. At the moment it's small enough in the one file. Lua Code:
|
Thank you very much, now the item is purchased the first time.
|
MERCHANT_SHOW doesn't seem to be used by the retail client anymore and has been replaced with PLAYER_INTERACTION_MANAGER_FRAME_SHOW with the value of Enum.PlayerInteractionType.Merchant. This then calls MerchantFrame_MerchantShow(). MERCHANT_SHOW may still fire, but I'm getting a whiff of deprecation here.
|
Quote:
When the time comes / or if Hubb feels like making the addon somewhat future proof now, they might be able to replace the MERCHANT_SHOW event check to that PLAYER_INTERACTION_MANAGER_FRAME_SHOW event and check for that value you mentioned before continuing on with the rest of the functionality. |
I didn't bother creating a new topic. I decided to ask a question in this thread.
How do I find out the "criteria ID" for achievements? Can this be done via https://wago.tools/, if so, how? Or are there other easier ways? Using the example of achievements. https://www.wowhead.com/achievement=16462/ (For example, how can you find out the “ID criterion” for "River camp to Eaglewatch Outpost") https://www.wowhead.com/achievement=16400/ (For example, how can you find out the “ID criterion” for "Ruby Life Pools") |
This is a good site to bookmark for helping with addon stuff.
https://warcraft.wiki.gg/wiki/Warcra..._customization Gethe also keeps a copy of the Blizzard API Code available online at https://github.com/Gethe/wow-ui-source which many of us utilise to help us. You can also download your own copy following these instructions https://warcraft.wiki.gg/wiki/Viewin...interface_code. That said, the following is where you can see the Achievement specific set of functions on the site https://warcraft.wiki.gg/wiki/World_...I#Achievements With this one probably being the first one I would try. https://warcraft.wiki.gg/wiki/API_Ge...ntCriteriaInfo You will likely have to make sure Blizzard_AchievementUI addon is loaded and available by either setting it up as a required dependency addon in your addons TOC file so that it loads before your addon and testing for https://warcraft.wiki.gg/wiki/API_C_....IsAddOnLoaded before doing any Achievement related functions. |
That's not exactly what I was looking for. Here's an example:
Achievement Glorious!, kill criterion Urobi the Walker it (criteria = 21083). But how was he recognized? And how do I find out the criterion ID? |
You have an achievement you want identify the criteria IDs for ?
At the top of that GetAchievementCriteriaInfo page I linked is the set of values returned by that function criteriaString, criteriaType, completed, quantity, reqQuantity, charName, flags, assetID, quantityString, criteriaID, eligible = GetAchievementCriteriaInfo(achievementID, criteriaIndex [, countHidden]) It also explains how to get the criteriaIndex on the same page criteriaIndex number - Index of the criteria to query, ascending from 1 up to GetAchievementNumCriteria(achievementID). So, you have the achievementID from wowhead. After you have ensured the AchievementUI blizzard addon is loaded ( to get access to these functions ) as I explained. You can then use: Lua Code:
In your addon. Other tasks to do before doing this would be Set up your addon's toc file so that it has a line Lua Code:
Watch for ADDON_LOADED as usual and when your addon is loaded, immediately check and make sure that "Blizzard_AchievementUI" is loaded using Lua Code:
And as in the other addons you have done, you can then use the functions your addon needs at this point to do their work. The code block above is a good starting point. |
In response to the question about wago.tools I don't know as I have never used that site.
Maybe someone that has will be able to answer that question. |
That is, if I understand correctly, I need to create a LUA file in which to add the achievement ID (from Wowhead). And when I open this achievement in the game, will I see the “ID criteria” for this achievement?
Lua Code:
|
It depends on what you wanted your addon to do.
The information I provided will allow you to get the information you might need. How you get that information on the screen is dependent on what you wanted. Some people adjust a Blizzard frame with added information ( I have never done that myself ), others create their own display similar to your other addons. That for loop code block essentially cycles through the list of criteria the achievement in question might have and grabs the information for the criteria, like the name, description, etc. While in that for loop you will need to decide what to do with that information. |
I need criteria for completing the following achievements:
https://www.wowhead.com/achievement=6351/ https://www.wowhead.com/achievement=6975/ https://www.wowhead.com/achievement=6977 https://www.wowhead.com/achievement=6979/ https://www.wowhead.com/achievement=6969/ https://www.wowhead.com/achievement=6976/ https://www.wowhead.com/achievement=6978/ (I understand that this is too long a list. That’s why I want to figure it out on my own, but I don’t understand anything about it). I know how I can add this to my addon so that it works, but I don’t know where to get the criteria (I only found criteria for rare monsters) It will work something like this (it works with rare monsters) Lua Code:
My addon is that when you kill a rare monster or open an area on the map, it removes the hint mark from the map. Like HandyNotes Pandaria which contains not only rare monsters and treasures, but also all the achievements. For example, I got to the "Dread Wastes" location in the "Zan'vess" area. From which the criterion for the achievement "Explore Dread Wastes" was fulfilled. It must have the ID of this execution. I need to figure out how to view these “ID criteria” for achievements. I already know what to do with them next. |
Okay, so what I gave you will do what you want. All you need to do is utilise what I did for 1 achievement to make it work for multiple achievements.
For example: Initialisation Stage You could use that for loop to add to a list of achievement id, criteria id items. Processing Stage You could then go through the generated list of achievement/criteria ids and do what you want with them. Here's what might work to get the first part of it working. Lua Code:
I added the assetID into the mix as you may find this useful At the bottom of the wiki.gg page for the criteriainfo function it shows a table highlight what the assetID will be based on the type. https://warcraft.wiki.gg/wiki/API_Ge...ntCriteriaInfo For example: A criteriaType of 0 will mean that this is a monster kill and the assetID will be the monsterID. The monsterID may be it's current GUID ( the GUID gets reset periodically for some things so it may be different week to week or month to month ). A criteriaType of 43 denotes an exploration criteria and the assetID might be an ID that represents the location. Maybe a mapID, zoneID or subZone etc They don't seem to be 100% sure of this so you might find it out through testing. Hopefully that will help you with that first part of your addon. |
It looks like we just misunderstand each other. You know English better than me, I'm from the Czech Republic and use Google Translate. =(
As I understand it, a table should appear in which data would be displayed when the achievement criterion was met? But the table does not appear. Or should she not appear? I sent the character to the desired location and the character filled out the achievement criteria. But nothing happened. I also filled out the file “myaddon.TOK” as you said in the example above. I still don’t understand how I can look at the achievement ID criteria. I tried to find this out using the "/etrace" command but it does not display this data. |
My understanding was that ..
1. You want to know the criteria ID for an achievement's criterias. - That is what that code does 2. You wanted to be able to use that criteria information to change stuff on the map - I supplied the criteria information, you said you knew what you had to do with it so I didn't look into how to use it This line of code is the criteria information for a single criteria for a single achievement Lua Code:
This block of code is extracting key information and putting it into the data table / array for later use Lua Code:
Essentially that almost complete addon code I posted yesterday is only missing the functionality you said you knew what to do. I gave you the code to get any criteria for any achievement you want in a table/array you can access like you have done in your previous addons. You just need to add the code that uses that criteria information. Quote:
|
What might be missing to help you is how to access the table of information for a particular criteria.
So let's see. Let's use the achievement 6351 ( Explore Jade Forest ). We would have something like. uhoh .. missed a vital bit of code out .. my code will only ever store one criteria. Let me do some coding with testing and get back to you with some examples on how it can be used - like for exploration etc. |
I found a solution to my problem. And I publish it here:
Addon "idTip" and Addon "idTip Community Fork". Thank you all very much for your help in my project. |
Excellent.
It is a learning curve. I've been writing addons since 2008 I think, maybe earlier but there are still areas I haven't even looked at ( including the stuff I needed to write this test addon rofl ) and with Blizzard changing stuff most expansions, it's time to learn again rofl. But, seriously, those links I posted before you will find useful. At least bookmark the wiki.gg link I posted as even us veterans visit it when we need to rofl. |
I add all the topics with my questions to my browser bookmarks. This is a very good forum, with helpful people.
|
Quote:
Option 1) - remove these inscriptions. Option 2) - so that the inscription is correct. Any option suits me. |
It would depend on the reason for failing.
Are the correct items per vendor set up correctly ? Did you investigate and see which ones it didn't purchase ? Did you check to see if there was a miss spell somewhere that meant it couldn't find the item to purchase ? Did you run out of currency to purchase the item ? Finding out why it happened will put you in the direction of identifying what needs to be done. It could be as simple as removing a non existent item, correct a spelling mistake or coding a stop or skip when the required currency is no longer availablw. |
Quote:
For example Lua Code:
|
It should already be ignoring the other items.
Also, looking at your line for BuyMerchantItem - the wiki page doesn't say it returns a value, so it will always be false I suspect. This could be the cause of your problem https://warcraft.wiki.gg/wiki/API_BuyMerchantItem Lua Code:
|
All times are GMT -6. The time now is 06:12 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI