WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Help with ModifiedClick bindings (https://www.wowinterface.com/forums/showthread.php?t=46124)

fRodzet 03-27-13 08:35 AM

Help with ModifiedClick bindings
 
Greetings,

Lua Code:
  1. -- create a table which contains the index you'd like to show in your tooltip
  2. local supportedIndexType = {
  3.     item = true,
  4.     achievement = true,
  5.     quest = true,
  6.     unit = true,
  7.     enchant = true,
  8.     spell = true,
  9.     talent = true,
  10.     glyph = true,
  11.     }
  12. -- create a function which contains the scripts necessary to display the tooltip we need
  13. local function ChatlinkTooltip_Show(self, linkData)
  14.     local linkType = string.match(linkData, "(.-):")
  15.         if supportedIndexType[linkType] then
  16.             GameTooltip:SetOwner(self, "ANCHOR_CURSOR")
  17.             GameTooltip:SetHyperlink(linkData)
  18.             GameTooltip:Show()
  19.         end
  20. end
  21.  
  22. for frameType = 1, NUM_CHAT_WINDOWS do
  23.     local chatType = _G["ChatFrame" .. frameType]
  24.         chatType:HookScript("OnHyperLinkEnter", ChatlinkTooltip_Show)
  25.         chatType:HookScript("OnHyperLinkLeave", GameTooltip_Hide)  
  26. end

This is my lua code so far, i then added a ModifiedClick binding to the bindings.xml:

Lua Code:
  1. <Bindings>
  2.     <ModifiedClick action="COMPAREITEMS" default="SHIFT"/>
  3. </Bindings>

But it doesn't work the proper way, i know that i miss something in my lua code to make it show properly.

If i hold down shift before i enter the link in the chat, the tooltip for both the one in chat and the one i have equipped shows.. However, if i'm at my link and i click shift, nothing happends. How can i make this possible, thanks? :)

Phanx 03-27-13 02:04 PM

Code:

ItemRefTooltip:SetScript("OnTooltipSetItem", function(self, ...)
        if IsShiftKeyDown() then
                GameTooltip_ShowCompareItem(self, 1)
                self.comparing = true
        else
                self.comparing = nil
        end
end)

According to the code in tekKompare, you also need to have some extra hooks to prevent issues, since the ItemRefTooltip isn't really designed to work with compare tooltips:

Code:

ItemRefTooltip:SetScript("OnEnter", nil)
ItemRefTooltip:SetScript("OnLeave", nil)
ItemRefTooltip:SetScript("OnDragStart", function(self)
        ItemRefShoppingTooltip1:Hide()
        ItemRefShoppingTooltip2:Hide()
        ItemRefShoppingTooltip3:Hide()
        self:StartMoving()
end)
ItemRefTooltip:SetScript("OnDragStop", function(self)
        self:StopMovingOrSizing()
        ValidateFramePosition(self)
        if self.comparing then
                GameTooltip_ShowCompareItem(self, 1)
        end
end)


Seerah 03-27-13 02:11 PM

If you hold shift while clicking on an item link in chat, there are new compare tips that will appear with it. They are called ItemRefShoppingTooltip1-3.

/edit: maybe I misunderstood - but I'll leave this here, since many people don't realize this is in the game

Phanx 03-27-13 02:33 PM

He said the compare tooltips show up with Shift when hovering -- that's the behavior you're thinking of, Seerah. The problem he's having is getting them to show up with the tooltip that appears when you click on a link in chat -- that's the ItemRefTooltip, which doesn't support comparing by default.

Seerah 03-27-13 02:43 PM

No, when you shift-click an item link in chat now, you get the compare tips attached to the regular itemreftooltip open on your screen. I found this recently when updating TipTop and added them to the addon to be skinned. They weren't in the game previously.


All times are GMT -6. The time now is 12:37 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI