• 0

    posted a message on Skada-like frame
    Hello,

    I am trying to create a simple frame which should look like skada/recount at the end: A transparanet background with bars which are updated depending on some calculated values. I managed to do the most of the work, but now I am stuck at one really dumb thing: How to add a text in a statusbar? Percentages and updating are working correctly, but I want them to be shown as actual numbers on top of statusbars.

    Here is a piece of the code:

    f = CreateFrame("Frame",nil,UIParent)
    	f:SetFrameStrata("BACKGROUND")
    	f:SetWidth(208)
    	f:SetHeight(112)
    	t = f:CreateTexture(nil,"BACKGROUND")
    	t:SetTexture(0, 0, 0, 0.5)
    	t:SetAllPoints(f)
    	f.texture = t
    
    	f:SetPoint("CENTER",200,200)
    	f:Show()
    
    
    	self.UndefinedStatusBar = CreateFrame("StatusBar", nil, f)
    	self.UndefinedStatusBar:SetStatusBarTexture("Interface\\TargetingFrame\\UI-StatusBar")
    	self.UndefinedStatusBar:GetStatusBarTexture():SetHorizTile(false)
    	self.UndefinedStatusBar:SetMinMaxValues(0, 100)
    	self.UndefinedStatusBar:SetValue(teston:GetPercentage("WorldExploration"))
    	self.UndefinedStatusBar:SetWidth(200)
    	self.UndefinedStatusBar:SetHeight(14)
    	self.UndefinedStatusBar:SetPoint("TOPLEFT",4,-4)
    	self.UndefinedStatusBar:SetStatusBarColor(0,1,0)
    	self.UndefinedStatusBar:SetScript("OnUpdate",function()    self.UndefinedStatusBar:SetValue(teston:GetPercentage("WorldExploration"))end)


    Code is only representing the first bar, but the image is showing actual state.



    So, once again my question is: How to show the percentage (and additional text) over statusbars? Thanks in advance
    Posted in: Lua Code Discussion
  • 0

    posted a message on One event handler for multiple events
    Thanks, exactly what i was looking for. I'm feeling so dumb right now for not looking int RegisterEvent a bit deeper. :D
    Posted in: AddOn HELP!
  • 0

    posted a message on One event handler for multiple events
    Hello,

    this is my first post and i am stuck with one thing: I don't want my code to be messy, and i am registering a bunch of events with self:RegisterEvent(). Most of my event handlers are doing exactly the same thing, hence their code is identical. So my question is: is there a way to make a generic event handler which will be called by multiple events? Example:

    self:RegisterEvent("event1)
    self:RegisterEvent("event2)
    self:RegisterEvent("event3)
    self:RegisterEvent("event4)

    And now i want one event handler to handle... lets say events 1,3,4. No arguments need to be processed, they are working with static values.

    Thank you!
    Posted in: AddOn HELP!
  • To post a comment, please or register a new account.