Need help with AddOn's

Snack

Salty
So I have been using a couple of scripts for arena frames + PvP trinket tracking. I just learned about making your own AddOns; creating lua files so the scripts load upon login, and I have been messing around with it. I got a couple of scripts working, but the one for arena frames/PvP trinket is anoying me.

Here are my scripts taken from my ingame macro menu:
These sets the position of the frames and scales them up:

Code:
/run TR="TOPRIGHT" ArenaEnemyFrame1:ClearAllPoints() ArenaEnemyFrame2:ClearAllPoints() ArenaEnemyFrame1:SetPoint(TR,-150,-40) ArenaEnemyFrame2:SetPoint(TR,-150,-90) 

/run ArenaEnemyFrame1.SetPoint = function() end ArenaEnemyFrame2.SetPoint = function() end
/run ArenaEnemyFrame1:SetScale(1.4)
/run ArenaEnemyFrame2:SetScale(1.4)


These are for PvP trinkets:
Code:
/run rc=36;rfc=CooldownFrame_SetTimer;aef="ArenaEnemyFrame";hb="HealthBar";trt=GetItemIcon(37864)ctf = CreateFrame;oe="ARENA_OPPONENT_UPDATE"ve="PLAYER_ENTERING_WORLD"tr="RIGHT"LoadAddOn("Blizzard_ArenaUI")

/run function Cr(i)local f=ctf("Frame",nil,UIParent)f:SetPoint(tr,_G[aef..i..hb],tr,80,0)f:SetSize(rc,rc)f.t=f:CreateTexture(nil,"BORDER")f.t:SetAllPoints(true)f.t:SetTexture(trt)f.c=CreateFrame("Cooldown",nil,f)f.c:SetAllPoints(f)return f;end

/run function ur(f,i)f:SetScript("OnEvent",function(_,e,u,_,_,_,s)if(u=="arena"..i)then if(s==42292 or s==59752)then rfc(f.c,GetTime(),120,1)elseif(s==7744)then rfc(f.c,GetTime(),30,1)end end end)f:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")end

/run for i=1,5 do _G["rf"..i]=Cr(i)local f=_G["rf"..i]ur(f,i)f:Hide()end function str(o,m)for i=1, 2 do local f=_G["rf"..i]if o then f:Show()else f:Hide()f.c:Hide()end end end

/run tk=ctf("Frame")tk:SetScript("OnEvent",function(_,e)if e==oe then str(1,GetNumArenaOpponents())else str(nil,5)end end)tk:RegisterEvent(oe)tk:RegisterEvent(ve)
and this is my AddOn (which isn't working):



Code:
TR="TOPRIGHT" ArenaEnemyFrame1:ClearAllPoints() ArenaEnemyFrame2:ClearAllPoints() ArenaEnemyFrame1:SetPoint(TR,-150,-40) ArenaEnemyFrame2:SetPoint(TR,-150,-90) end


ArenaEnemyFrame1.SetPoint = function() end 

ArenaEnemyFrame2.SetPoint = function() end 


ArenaEnemyFrame1:SetScale(1.4) end


ArenaEnemyFrame2:SetScale(1.4) end


rc=36;rfc=CooldownFrame_SetTimer;aef="ArenaEnemyFrame";hb="HealthBar";trt=GetItemIcon(37864)ctf = CreateFrame;oe="ARENA_OPPONENT_UPDATE"ve="PLAYER_ENTERING_WORLD"tr="RIGHT"LoadAddOn("Blizzard_ArenaUI")


function Cr(i)local f=ctf("Frame",nil,UIParent)f:SetPoint(tr,_G[aef..i..hb],tr,80,0)f:SetSize(rc,rc)f.t=f:CreateTexture(nil,"BORDER")f.t:SetAllPoints(true)f.t:SetTexture(trt)f.c=CreateFrame("Cooldown",nil,f)f.c:SetAllPoints(f)return f;end


function ur(f,i)f:SetScript("OnEvent",function(_,e,u,_,_,_,s)if(u=="arena"..i)then if(s==42292 or s==59752)then rfc(f.c,GetTime(),120,1)elseif(s==7744)then rfc(f.c,GetTime(),30,1)end end end)f:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")end


for i=1,5 do _G["rf"..i]=Cr(i)local f=_G["rf"..i]ur(f,i)f:Hide()end function str(o,m)for i=1, 2 do local f=_G["rf"..i]if o then f:Show()else f:Hide()f.c:Hide()end end end


tk=ctf("Frame")tk:SetScript("OnEvent",function(_,e)if e==oe then str(1,GetNumArenaOpponents())else str(nil,5)end end)tk:RegisterEvent(oe)tk:RegisterEvent(ve)






I have no idea what I am doing wrong, it does show the PvP trinkets, but doesn't scale/move arena frames. Any help would be greatly appreciated!
 
So I got the arena frames script working, but now I have another issue. An AddOn to move my frame, my target frame, my focus frame, focus ToT frame and target ToT frame. This is the lua file:

Code:
-- This file is loaded from "Frames.toc"
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN");
f:SetScript("OnEvent",function(self,event,...)
if event=="PLAYER_LOGIN" then


PlayerFrame:ClearAllPoints()
PlayerFrame:SetPoint("LEFT",540,100)


TargetFrame:ClearAllPoints()
TargetFrame:SetPoint("LEFT",1060,100)


FocusFrame:ClearAllPoints()
FocusFrame:SetPoint("LEFT",340,40)


FocusFrameToT:ClearAllPoints()
FocusFrameToT:SetPoint("LEFT",130,-47)


TargetFrameToT:ClearAllPoints()
TargetFrameToT:SetPoint("LEFT",133,-48)


end)

Can anyone help me?
 
I honestly think you have a better shot at the Wowhead forums, they have a bigger population as well as hardware/software subforums, might be a few people in there who can help
 
I honestly think you have a better shot at the Wowhead forums, they have a bigger population as well as hardware/software subforums, might be a few people in there who can help
Kinda old thread, I figured it out, but thx :)
 

Users who are viewing this thread

Top