12-01-05, 09:25 AM | #1 |
Scanning tooltips
Did post this on EU UI forums, but I don't believe I'll get an answer there (Wish I could post on US forums...)
Edit: I'm aware that in 1.9 I'll need to change :IsVisible() to :IsShown(). Hi there! I have a problem with scanning tooltips. I want to scan the exact tooltip of the items in several bags which will then be converted to strings for exporting. I've already got a functioning tooltip scanner, but it's not doing quite what I want it to. I've made a pseudo-code script to show you what I'm doing: Code:
tooltip:ClearLines(); -- This *should* be the correct method (right?) tooltip:SetBagItem(bag, slot); -- I don't want to use this, because it doesn't seem to contain instance-specific details _, _, link = string.find(GetContainerItemLink(bag, slot), "|H(item:%d+:%d+:%d+:%d+)|h"); tooltip:SetHyperlink(link); lines = tooltip:NumLines(); for i = 1, lines, 1 do textFrame = getglobal(tooltip:GetName() .. "TextLeft" .. i); if (textFrame:IsVisible()) then text = textFrame:GetText(); -- Process text end textFrame = getglobal(tooltip:GetName() .. "TextRight" .. i); if (textFrame:IsVisible()) then text = textFrame:GetText(); -- Process text end end The second one seems to work, but it doesn't contain instance-specific information. In other words, things such as "<Made by abc>", "Durability x/y" and even "<Right-click to open>" do not show up. Does anyone know what's wrong, or if I need to catch an event because the tooltip hasn't finished loading all the item data when I scan it? Here's the site which actually uses the exported data, to show you the resulting tooltips: http://andreasb.serveftp.com/WoW/bank/bank.html For exporting that data, I used SetBagItem and if the resulting number of lines was 0, I used SetHyperlink. On some of the objects, the "<Created by ...>" text has for some reason become pink with the text "00|r" (Indicates that the instance-specific lines are specified with in-line formatting, rather than setting the color of the tooltip text frame). Note that if you have IE 6, it is not capable of handling the CSS used in that document, so you need to either use another browser or IE 7 if you really want to see it in it's proper form. |
|
12-01-05, 10:12 AM | #2 |
Have you considered implementing a system to put a 0.1 delay between calling SetBagItem and parsing the tooltip? I believe there maybe some delay involved in retrieving the item information, and the SetBagItem function handles this process in another thread in the background. I may be wrong, but that is the only reason I can come up with as to why you would be getting an empty tooltip from SetBagItem for a non-empty slot.
|
|
12-01-05, 10:22 AM | #3 | |
Edit: I did find these, but I'm not sure what they mean, if at all related: ITEM_TEXT_BEGIN - Fired when an items text begins displaying. ITEM_TEXT_CLOSED - Fired when the items text has completed its viewing and is done. ITEM_TEXT_READY - Fired when the item's text can continue and is ready to be scrolled. Anyone got any ideas? Last edited by AndreasBlixt : 12-01-05 at 10:25 AM. |
||
12-01-05, 06:08 PM | #4 |
I've worked for a few hours on this, and have finally got it to work... kind of. For some reason, one item in my test (Shaman on 1.9 EU Test) always ends up returning a blank tooltip, no matter how many times I run the script. It's the axe in the second slot on the first row on this page: http://andreasb.serveftp.com/WoW/bank/bank.html (Its name is "Crude Battle Axe")
The script simply doesn't find a single row in the tooltip, but it works for all other gray, and otherwise, items. There seems to be a new bug with GetItemInfo in 1.9 that makes the quantity parameter always return the max stack size instead of the current number of items in stack (I assume it's a bug because in 1.8 I got the number of items in the specified stack). Also, the "<Made by ...>" tag is in the format "|cff00ff00<Made by ...>|r" instead of the tooltip row being colored, and only set to "<Made by ...>". I'd very much appreciate if the two above bugs would be posted on the US test realm forum (I still hate that I can't post on US forums :P). |
|
12-02-05, 08:36 AM | #5 |
It seems that I'm mostly talking to myself here, but I'll still post my recent findings. After making the addon output "Item xyz does not have a tooltip!" for every item that returned 0 lines for the tooltip, I noticed that it did so for every item in the main bank area. It did not for the bank bags however. I'll look into all the functions available setting the tooltip, as SetBagItem(-1, x) doesn't seem to work (-1 is the "bag" index for the main bank area and works for all the Container functions).
EDIT: Yay! After some snooping around in the BankFrame code I found they're converting the slots in the main bank area into an inventory slot on the player (Also known as an equippable slot such as Head, Chest, Main Hand etc). Very messy if you ask me, but this is what you should do if you ever need to get the *actual* tooltip (With durability, soulbound status and so on) for an item in the main bank area: Code:
if (container == -1) then -- The container we're scanning is the main bank area GuildBank_Tooltip:SetInventoryItem("player", BankButtonIDToInvSlotID(slot, nil)); else -- We're scanning a bag (On character or in bank bag slot) GuildBank_Tooltip:SetBagItem(container, slot); end Last edited by AndreasBlixt : 12-02-05 at 08:53 AM. |
|
WoWInterface » Developer Discussions » General Authoring Discussion » Scanning tooltips |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|