Put a clickable professoin link on a frame
Hi, I'm developing a guild addon for wow wotlk. I wanted to know if it is possible to put the link of a profession on a frame and make it clickable. When I try to insert with a generic :SetText(professionLink); and I try to click on it, it doesn't work and the professional panel doesn't open. Can anyone kindly help me plz:)
|
|
You could also take a look at https://www.wowinterface.com/downloa...ofessions.html which was based on my initial mage portals addon. If memory serves it opens the crafting frame.
Hopefully this old example and Fizzle's more recent page links will help you in some way. |
Thank you Fizzlemizz and Xrystal for replies. I had already tried with Frame:SetHyperlinksEnabled and EditBox:SetHyperlinksEnabled but it seems doesn't work.
Code example: Code:
Alternatively, is there an API/function that, having the profession link (of another player), opens the tradeSkill? I would like to specify that the profession link belongs to another player, not mine professions. |
Managed to rig up a simple addon and can confirm that the SetHyperlinksEnabled isn't working as is on a frame .. maybe something else is needed. Will investigate further.
Lua Code:
Second Attempt after some research is as follows: The Profession Link works fine as if you had clicked in the chat frame, but I had problems getting it to accept the individual recipe link in the same manner. Fizzle's post will hopefully help in that regard. Main addition is the Hyperlink line based on info on https://warcraft.wiki.gg/wiki/UIHAND...HyperlinkClick Lua Code:
|
Lua Code:
Login and: Code:
-- 376530 Wildercloth Bolt or use a recipe ID you have |
You could use the OnHyperlinkClick to open the profession frame instead of using a separate button:
Lua Code:
Updated my original example to include clicking on the hyperlink also opens the profession frame (and waiting for a link if the recipe is not cached) |
So what we have so far is ...
A way to open direct to a recipe page via a recipe id And A way to open the professions page from a hyperlink. What we need now is a way to find out the recipe id from a recipe link which hopefully will be figureoutable from this page : https://warcraft.wiki.gg/wiki/Hyperlinks Ah never mind, looks like the recipe links are either item links or enchant links. Looking at the tradeskill window itself, it only allows people to link their whole profession not a recipe, so you might only be able to open to a particular recipe page using a known recipe ID. Unfortunately the only way I could see to get both a recipelink and recipeid automagically was by reading the recipes from the tradeskill page. The last known recipe in my example was the Enchant Vellum I could craft with my Inscription Gal. The recipe ID for it is 52739 but none of the numbers in the Enchant Vellum recipe link contains that number. Instead it has 38682 which is the actual item id and 70:266 which I assume is the player level and specialization id who provided the link and the next numbers that appear are 1:3524 which don't provide any clues to me but could be the number of bonsuses and a bonus id - if I am reading the info on https://warcraft.wiki.gg/wiki/ItemLink correctly. Anyway, this is my last attempt, and is the best I could do using both the info Fizzle provided and what I tracked down and hopefully gets you part way at least. Lua Code:
|
Thank you, you were very kind to answer me. Unfortunately, however, I don't think the solutions work. From the addon channel with SendAddonMessage(MyChannelAddon_channel, msg, "WHISPER", sender) I receive the profession link of the other guildmate For example [Tailoring]. I have to put this link on a frame that collects all the links that I receive from other guildmate.
For now the only way I've found is to put a chat frame on the frame (see screen): Code:
screen: https://ibb.co/GxWJcMb but unfortunately I find chat frames unpredictable. Sometimes it disappears for no reason and i can't really hide ButtonFrame, EditBox and tab of the chat. I will try to find another way, thank you very much! You have been very kind!:) |
You could save a table of itemID to recipeID as you set the hyperlink text(s). But it's no good for opening the professons frame if your character doen't know the profession/recipe.
|
Ah, that's how you are receiving the link.
Your addon is being used by your friends and allows them to send an addon message to your addon regarding their tradeskill. Now I am assuming that if you then monitor the chat for those messages, you should be able to get the link you need to use. All you then need to do is put that link in your frame ( which I am assuming you have been doing, but are having a problem clicking on it ). The Hyperlink code we've been using should resolve that problem. I've never used the addon message system myself so unsure of exactly what its limits are and benefits etc. But if you have that part working as expected and have a link from that source. Then things should work with the examples we've provided. But, out of my working example the following code is what does the work Lua Code:
When you click the link it works just like the ChatFrame and opens the profession frame to the profession linked. I've never used these myself so was quite happy to see how easy it was to work with. So I am happy to say I learned something new. |
Quote:
|
Quote:
Although I agree with the Open to Recipe option - but I don't think this is what they are wanting unless I misunderstood what they wanted. |
Quote:
|
Quote:
|
I stopped looking when it became apparent it wasn't for official servers ;).
|
Quote:
|
Quote:
This works in 10.2.5 so hopefully it will work for you How this example addon works is when you first log in / reload the ui you can open the tradeskill of your choice and it will automatically grab the skill link and send it via addonmessage to the chatframe. The addon then stops checking for the tradeskill frame being opened and closes the window. It then sees there is an addon message and grabs the link sent earlier and puts it into the fontstring set up for it. Clicking on that link will then bring up the trade skill window ( showing the name of the link sender - in my case me ). Looking at the tradeskill frame there is no option for WHISPERing the tradeskill link automatically as an addon message with a special prefix. So I had to use this roundabout route to get the tradeskill link and send it manually via addonmessage with the prefix. It adds a clickable profession link to a font string so does what you are asking, you might just have to do some additional work, to make it work in your addon. If my example doesn't work for you in 10.2.0 or 10.2.5 then mayhap something is not working right at your end and could explain the problems you are having. And as Fizzle says, we cannot help with addons not designed to work on official servers. Lua Code:
|
Quote:
Wow thanks Xrystal!! this solution works but I don't know why (I'm a beginner addon developer :P)! You are very kind! Thanks a lot Fizzlemizz too for time and advice! Good community:) |
All times are GMT -6. The time now is 06:10 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI