• 0

    posted a message on Mini-addon to track some of my procs
    Thanks for the feedback. Now I have working code for checking my Finger of Frost proc. Here it is:
    local buffs = {
    	[44544] = true, 
    	[57761] = true,
    --	[64343] = true,
    	
    }
    local frame = CreateFrame("Frame", "MyProcFrame", UIParent)
    local tempp
    local text = frame:CreateFontString(nil,"ARTWORK")
    		 	 text:SetFont(STANDARD_TEXT_FONT,18,"OUTLINE")
    			 text:SetTextColor(1,1,1,1)
    			 text:SetPoint("CENTER",frame,"CENTER",0,-30)
    
    frame:SetPoint("CENTER", UIParent, "CENTER", -90,-105)
    frame:SetWidth(45)
    frame:SetHeight(45)
    frame:Hide()
    
    frame.texture = frame:CreateTexture(nil, "OVERLAY")
    frame.texture:SetAllPoints(true)
    
    frame:RegisterEvent("UNIT_AURA")
    
    frame:SetScript("OnEvent", function(self, event, unit)
    	tempp=0
    	if unit ~= "player" then return end
    	for i = 1, 40 do
    		local name, _, icon, count, _, duration, expirationTime, _, _, _, spellID = UnitBuff("player", i)
    		if not name then break end
    
    		if buffs[spellID] then
    		
    			if count == 2 and spellID == 44544 	then 
    								text:SetText("")
    								self.texture:SetTexture(icon)				
    								self:Show()				
    								text:SetText("2")
        							tempp = 1
    												end 
    			
    			if count == 1 and spellID == 44544 then
    								text:SetText("")
    							    self.texture:SetTexture(icon)		
    								self:Show()
    								tempp = 1
    								text:SetText("1")
    												end 
    	
    			break
    			
    		end
    	end
    if tempp == 0
       then
    	self.texture:SetTexture(nil)
        self:Hide()
    	end
    end)


    I want to add two more procs to watch(Brain Freeze and Impact). Should I make another two frames to watch for these procs separately? Or is there any way to have one frame to watch for all these procs and make another small frames just to draw textures?
    P.S. What wrong with expirationTime(argument in UNIT_AURA function)? It returns values like 22.1231 even though duration of Fingers of frost is 15 seconds.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Mini-addon to track some of my procs
    Huge thanks. You really gave me a good start to create my own addon.
    Could not figure out what is the syntax for importing textures(or any files) into game? Should it look like this ?

    self.texture:SetTexture("\\interface\\addons\\MyAddon\\FoF.tga")
    Posted in: Lua Code Discussion
  • 0

    posted a message on Mini-addon to track some of my procs
    Hey there. Recently I wanted to get rid of all addons and to make one with only features that I need.
    I do not have any experience at lua, though I have some in C#. So, could u guys help me out with lua code that will check my buffs and if i have needed buff display texture on the screen.

    Using wowWiki reference i tried to implement it myself, but i dont know to check buff via its spellID.


    l
    ocal frame = CreateFrame("Frame")
    local buffs, i = { }, 1;
    local buff = UnitBuff("player", i);
    frame:RegisterEvent("PLAYER_AURAS_CHANGED")
    
    frame:SetScript("OnEvent", function(self, event)
        if event == "PLAYER_AURAS_CHANGED" then
    	   i=0
    	   while buff do
    	     buffs[#buffs + 1] = buff;
    		i = i + 1;
    		buff = UnitBuff("player", i);
    		end;
    		i=0
           while buff do
    	   if buff[i] == 44545 then DEFAULT_CHAT_FRAME:AddMessage("Finger of Frost!")
       
        end
    end)
    
    


    Could anyone please give me some tips?
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.