1. #1

    Help: Adding Text to my Tooltips

    So I got tired of the way XP was displaying on my alt, and decided to code a tooltip to display it instead. But I can't get the tooltip to show and display the message, no Lua errors are displaying for assistance.

    Where did I go wrong?

    Code:
    local a = CreateFrame("Frame", "CalXP")
    a:RegisterEvent("CHAT_MSG_COMBAT_XP_GAIN")
    a:RegisterEvent("PLAYER_LOGIN")
    a:SetScript("OnEvent", function(self)
     local level = UnitLevel("PLAYER")
     local currXP = UnitXP("PLAYER")
     local nxtLevel = level + 1
     local playerMaxXP = UnitXPMax("PLAYER")
     local oldXP = currXP
    
     -- Should add a game tooltip to the main window
    GameTooltip:SetOwner(UIParent, "ANCHOR_PRESERVE")
    GameTooltip:SetTitle("calXP View")
    
    --[[ this didnt work
    GameTooltip:SetWidth = 60 
    GameTooltip:SetHeight = 18
    ]]--
    
    ShowUIPanel(GameTooltip)
    
    --
    
    	if level == 85 then
    			GameTooltip:AddLine("You have reached Max Level\n"..
    			"This mod is of no use to this character.")
    				else
    				GameTooltip:AddLine("You are " ..playerMaxXP - oldXP.. " experience points away from level: " ..nxtLevel)
    			end
    	
    	end
    Last edited by Calabera; 2011-02-23 at 01:10 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •