Thread Tools Display Modes
12-19-09, 07:45 AM   #1
alimjocox
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 96
Tooltip help pls

Code:
local Tooltips = {GameTooltip, ItemRefTooltip, ShoppingTooltip1, ShoppingTooltip2, ShoppingTooltip3}
for i, v in ipairs(Tooltips) do
  v:SetBackdrop(backdrop)
  v:SetScale(scale)
  v:SetScript("OnShow", function(self)
    self:SetBackdropColor(bdcR, bdcG, bdcB)
    local name, item = self:GetItem()
    if(item) then
      local quality = select(3, GetItemInfo(item))
      if(quality) then
        local r, g, b = GetItemQualityColor(quality)
		    self:SetBackdropBorderColor(r, g, b)
      end
    elseif (UnitIsPlayer(unit)) then
      local r, g, b = GameTooltip_UnitColor(unit)
		self:SetBackdropBorderColor(r, g, b)
	end
  end)
end
Can someone explain to me why this isn't coloring my ToolTip border to the current class I have on my Tooltip? I've meddled with it endlessly, it works for the statusbars and unit names.. wtf @ borders.
  Reply With Quote
12-19-09, 10:48 AM   #2
Soeters
A Warpwood Thunder Caller
 
Soeters's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 97
You're using the upvalue unit here
Code:
    elseif (UnitIsPlayer(unit)) then
      local r, g, b = GameTooltip_UnitColor(unit)
And it hasn't been set before. Instead replace it with "mouseover" or unit = self:GetUnit()
__________________
  Reply With Quote
12-19-09, 11:54 PM   #3
alimjocox
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 96
Code:
    local name, item = self:GetItem()
    if(item) then
      local quality = select(3, GetItemInfo(item))
      if(quality) then
        local r, g, b = GetItemQualityColor(quality)
		    self:SetBackdropBorderColor(r, g, b)
      end
	local unit = self:GetUnit()
	 elseif (UnitIsPlayer(unit)) then
      local r, g, b = GameTooltip_UnitColor(unit)
		self:SetBackdropBorderColor(r, g, b)
		end
  end)
end
still doesn't like me.. :'(
  Reply With Quote
12-20-09, 03:16 AM   #4
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Could always hook GameTooltip's OnTooltipSetUnit, then you know the information is available. It's what I did.

http://wowprogramming.com/docs/scripts/OnTooltipSetUnit

Code:
GameTooltip:HookScript("OnTooltipSetUnit", function(self)
 local name, unit = self:GetUnit()

 ...
end)
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.

Last edited by v6o : 12-20-09 at 03:19 AM.
  Reply With Quote
12-20-09, 04:07 AM   #5
alimjocox
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 96
ugh.. sorry to be a pain that didn't work either..
Code:
	GameToolTip:HookScript("OnTooltipSetUnit", function(self)
 local name, unit = self:GetUnit()
	 if (unit) then
     local r, g, b = GameTooltip_UnitColor(unit)
		self:SetBackdropBorderColor(r, g, b)
		end
	  end)
i dont know if this will help.. but heres another extract
Code:
  GameTooltip_UnitColor = function(unit)
    local r, g, b;
    if (UnitIsPlayer(unit)) then
      local _, englishClass = UnitClass(unit)
      r = RAID_CLASS_COLORS[englishClass].r;
      g = RAID_CLASS_COLORS[englishClass].g;
      b = RAID_CLASS_COLORS[englishClass].b;
im a trial and error, Lua learning. so my actual programming knowledge is pretty slim
  Reply With Quote
12-20-09, 04:17 AM   #6
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,961
Originally Posted by alimjocox View Post
Code:
    
local name, item = self:GetItem()
    if(item) then
      local quality = select(3, GetItemInfo(item))
      if(quality) then
        local r, g, b = GetItemQualityColor(quality)
		    self:SetBackdropBorderColor(r, g, b)
      end
	local unit = self:GetUnit()
	 elseif (UnitIsPlayer(unit)) then
      local r, g, b = GameTooltip_UnitColor(unit)
		self:SetBackdropBorderColor(r, g, b)
		end
  end)
end
still doesn't like me.. :'(
This block doesn't look complete to me and thus looks incorrect. Whilst I haven't played with the class units coloring for anything it looks like that block of code is out of place. Try this instead.

Code:
local name, item = self:GetItem()
local unit = self:GetUnit()
if(item) then
  local quality = select(3, GetItemInfo(item))
  if(quality) then
    local r, g, b = GetItemQualityColor(quality)
    self:SetBackdropBorderColor(r, g, b)
  end
elseif (UnitIsPlayer(unit)) then
  local r, g, b = GameTooltip_UnitColor(unit)
  self:SetBackdropBorderColor(r, g, b)
end
In the code example you gave unit was never set as it looked to be inside the item code block.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
12-20-09, 04:27 AM   #7
alimjocox
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 96
thx Xrystal that fixed it.
zomg.. really appreciate the help all. sorry for my noobness
  Reply With Quote
12-20-09, 06:08 AM   #8
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,961
rofl, we were all noobs once upon a time And glad it resolved your problem.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Tooltip help pls


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off