• 0

    posted a message on working with gametooltips; tooltip scanning
    WOW! 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?
  • 0

    posted a message on working with gametooltips; tooltip scanning
    Hi I am new to coding in general and even more new to lua and the WoWAPI.
    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()
    tip:SetOwner(WorldFrame, "ANCHOR_NONE")
    local link = select(2, GetItemInfo(GetContainerItemLink(0,1)))
    local lines = tip:NumLines()
    local text = GameTooltipTextLeft2:GetText()

    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:
    >> 4
    >>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 >.>
    http://forums.wowace.com/showthread.php?t=19154 (isHeroic)
    http://forums.wowace.com/showthread.php?t=19199 (isSoulbound)

    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[2]:GetText()....
    Posted in: Need Help?
  • To post a comment, please or register a new account.