1. #1

    [lua] oUF_Experience question

    hey together,

    working out my oUF layout and havin' trouble with oUF_Experience.

    i wan't to show the xp text on entering and hide on leaving but only get an error

    Code:
    ----------------------------------------------
    -- EXPERIENCE --------------------------------
    ----------------------------------------------
    self.Experience = CreateFrame("Statusbar", nil, self)
        self.Experience:SetFrameStrata("BACKGROUND")
        self.Experience:SetFrameLevel(0)
        self.Experience:SetPoint("BOTTOMLEFT", UIParent)
        self.Experience:SetPoint("BOTTOMRIGHT", UIParent)
        self.Experience:SetHeight(30)
        self.Experience:SetStatusBarTexture(PlayerBar)
        self.Experience:SetStatusBarColor(0.0235,0.1825,0.3058)
        self.Experience:SetAlpha(0.5)
    
            self.Experience.Text = self:CreateFontString()
                self.Experience.Text:SetFont(font1, 15, "OUTLINE")
                self:Tag(self.Experience.Text,"[curxp]|r | [maxxp]|r XP")
                self.Experience.Text.frequentUpdates = FreqUpdate
                self.Experience.Text:SetJustifyH("CENTER")
                self.Experience.Text:SetPoint("TOP",UIParent, 0, -4)
                self.Experience.Text:Hide()
     
    self.Experience:SetScript("OnEnter", function(self) self.Experience.Text:Show() end)
    self.Experience:SetScript("OnLeave", function(self) self.Experience.Text:Hide() end)

    could somebody please help me. i'm no pro in lua programming

  2. #2
    Code:
    self.Experience:SetScript("OnEnter", function(self) self.Experience.Text:Show() end)
    In this function's body, self refers to the StatusBar frame (which you refer to as self.Experience outside of the function body). Either change the function signature (from function(self)) or use self.Text inside the function body.

    PS: Same thing goes for OnLeave.
    UI & AddOns expert | Interface & Macros moderator - My work

  3. #3
    ok, it's working now. but i swear i tried it before and i got an error... who cares...

    thank you Treeston you are my lua superhero

Posting Permissions

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