- Registered User
Member for 5 years and 11 months
Last active Sun, Dec, 15 2013 21:50:09
- 0 Followers
- 3 Total Posts
- 0 Thanks
Dec 13, 2013WOW! I was not expecting such a detailed response! You put some time and effort into this! You answered my questions and then some haha. Cleared up a lot of stuff that I had only a vague understanding of. Thank you so much! :D Really appreciate the effort.Posted in: Need Help?
Dec 12, 2013Hi I am new to coding in general and even more new to lua and the WoWAPI.Posted in: Need Help?
I've been trying to find solutions for tasks I find tedious in game, to just practice code. The current one problem I am working on is basically the same as any of the "Sell Junk" type addons. Except for instead of junk if my character cannot disenchant, then I want to vendor all soulbound green weapons/armor. I have used various SellJunk type addons in the past but...why not make my own? :)
Anyways, I have been googling around for a few days now and am still stuck on working with GAMETOOLTIPS.
My end goal is to check if an item is soulbound, and return a boolean, though I am stuck with just getting the text from the tooltip...I know there is the "isHeroic" function floating around, but copying and pasting code isn't gonna help me understand it. From what I've gathered, the only way to check if an item is soulbound is via the gametooltip, and the common theme in tooltip scanning appears to use "invisible"(to the user) GameTooltips.
So far this is what I have for trying to get text from the Gametooltip.
local tip = myTooltip or CreateFrame("GAMETOOLTIP", "myTooltip") local L = L or tip:CreateFontString() local R = R or tip:CreateFontString() L:SetFontObject(GameFontNormal) R:SetFontObject(GameFontNormal) tip:AddFontStrings(L,R) tip:SetOwner(WorldFrame, "ANCHOR_NONE") tip:ClearLines() local link = select(2, GetItemInfo(GetContainerItemLink(0,1))) tip:SetHyperlink(link) local lines = tip:NumLines() local text = GameTooltipTextLeft2:GetText() print(lines) print(text) print(link)
From what I understand, I am checking to see if myTooltip exists, and if it does not, I am creating a new Frame of the type GAMETOOLTIP, named "myTooltip". From what I understand GameTooltips must have a left and right FontString, which does not get appended until you call AddFontStrings()? Then set the location (SetOwner()) to to the worldframe with no anchor and then call ClearLines() for safety since some SetX() functions don't clear it? Then I declare a variable called "link" which is set to the itemLink of the first item in my first bag. (when I use 0,0 it appears to return me my 5th bag, -1 returns the 4th and so on)
This is where I am iffy. I then use the GameTooltips function SetHyperlink() and pass my itemlink into it. WowWiki says that SetHyperlink() "will replace the currently showing tooltip with one containing the information for the given item".
...What information is added? Is it the information I can see in game when I mouse over the item?
How can I print this information to the console to see what data was given?
At the end I am just trying to see what information I have. Here is what it gives me:
>>Run the current script
Calling the GameTooltipTextLeft1:GetText() gives me "Run". GameTooltipTextLeft3/4 are nil. TextRight are also nil.
I am pretty sure I am referencing the global GameTooltip, and I need to be calling "myTooltip". But I am confused on how to go about this.
Here is the script I am referencing. I have also seen a persons version of this that checks if it is soulbound. I am trying to understand everything instead of just copy and paste >.>
I noticed he has declared an array called "leftside" but I don't really understand what he's doing with it. It looks like in create(), he is first setting the first 2 elements of leftside to his left FontObject? I don't understand what his "tip.leftside = leftside" is doing. I realize create returns a frame. In his isHeroic() I don't understand why he can say "t = tooltip.lefts:GetText()....
- To post a comment, please login or register a new account.