View Single Post
11-15-16, 07:45 PM   #28
_Max_Cavalera_
A Fallenroot Satyr
 
_Max_Cavalera_'s Avatar
Join Date: Dec 2007
Posts: 28
So, I'm already adding functionality, made a tooltip so that when I add more info I won't get it 100% of the time on the screen.

Lua Code:
  1. local function OnEnter(self)
  2.     GameTooltip:SetOwner(self, "ANCHOR_BOTTOM");
  3.     GameTooltip:SetText("Artifact Weapon name going here");
  4.     GameTooltip:AddLine("Move Artifact Knowledge info here and only keep one line on main frame");
  5.     GameTooltip:Show();
  6. end
  7.  
  8. local function OnLeave(self)
  9.     GameTooltip:Hide();
  10. end
  11.  
  12. frame:SetScript("OnEnter", OnEnter);
  13. frame:SetScript("OnLeave", OnLeave);

It's working as it is, easy enough. Now I wonder, since I need to use variables I already have inside the frame:SetScript("OnEvent", function(self, event, ...), should I put the tooltip code inside? Return the variables from that one so I can use them outside? Or just remake new ones outside?

What would be the correct way of doing it? The proper, efficient code way xD

I think I should return them and put it outside just because adding more and more stuff to that frame:SetScript("OnEvent", function(self, event, ...) isn't probably a good idea? But on the other hand, the info that goes in the tooltip needs to be up to date with those Events.

I donno... that's why I'm learning

Last edited by _Max_Cavalera_ : 11-15-16 at 07:51 PM.
  Reply With Quote