A Deviate Faerie Dragon
Join Date: Jan 2012
Posts: 18
|
ArenaEnemyFrames, Macro works, lua doesn't.
Hey guys
i got a problem, I'm trying to move the default arena frames.
I'm new to .lua. just have some experience in html, java and php.
thats my first "add-on". I'm just messing around with it.
I'm using:
PHP Code:
if moveArenaFrames == true then ArenaEnemyFrame1:ClearAllPoints() ArenaEnemyFrame1:SetPoint("CENTER", -400, -40) ArenaEnemyFrame1:SetScale(1.23) ArenaEnemyFrame2:SetScale(1.23) ArenaEnemyFrame3:SetScale(1.23) end
thats the error i get:
Code:
Message: Interface\AddOns\Pvptest\pvptest.lua:35: attempt to index global 'ArenaEnemyFrame1' (a nil value)
Time: Fri Feb 24 14:26:09 2012
Count: 1
Stack: Interface\AddOns\Pvptest\pvptest.lua:35: in main chunk
Locals: moveBuffsandDebuffs = true
moveCastbarandResize = true
changeCastBarColor = true
hideMinimap = true
movePartyFrames = true
hideCombatText = true
hidePetFrame = true
removePlayerFrameIcons = true
classColorBars = true
enableClassIcons = true
changeStatusBarText = true
modifyActionBars = true
showCDonActionBars = true
moveUnits = true
debuffScale = 1.2
playerFrameX = 275
playerFrameY = 0
alignFocusWithTarget = false
showDRTracker = true
showArenaTrinkeCD = true
moveArenaFrames = true
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index global 'ArenaEnemyFrame1' (a nil value)"
thats my .lua:
PHP Code:
----------: Config local moveBuffsandDebuffs = true -- move playerbuffs and debuffs local moveCastbarandResize = true -- move playercastbar and resize local changeCastBarColor = true -- change target and focus castbarcolor to blue local hideMinimap = true -- hide minimap completely local movePartyFrames = true -- move partyframes to topleft @ playerframe local hideCombatText = true -- hide combattext on classicon/portrait local hidePetFrame = true -- hide petframe (i dont care about it as priest. got a makro for dispel shadowfiend) local removePlayerFrameIcons = true -- remove combatstatus and restedglow on playerframe local classColorBars = true -- add classcolor to healthbar local enableClassIcons = true -- classicons instead of portrait local changeStatusBarText = true -- display max hp AND percent hp -- -- -- playerframeconfig -- local moveUnits = true -- moving player, target and focus frames local debuffScale = 1.2 -- adjust debuffscaling (wowdefault "1") local playerFrameX = 275 -- vertical adjust playerframe local playerFrameY = 0 -- horizontal adjust playerframe local alignFocusWithTarget = false -- align focus with target -- -- -- ArenaStuff -- local showDRTracker = true -- track DR left to the ArenaEnemyFrames local showArenaTrinkeCD = true -- track insigniacooldown right to the ArenaEnemyFrames local moveArenaFrames = true -- move ArenaEnemyFrames to topright @ focusframe ----------: Modifications ----------:1 if moveBuffsandDebuffs == true then BuffFrame:ClearAllPoints() BuffFrame:SetPoint("TOPRIGHT",-10,-10) end ----------:2 if moveCastbarandResize == true then CastingBarFrame:SetPoint("BOTTOMLEFT",597,75) CastingBarFrame:SetScale(1.23) end ----------:3 if changeCastBarColor == true then TargetFrameSpellBar:SetStatusBarColor(0,0.45,0.9) TargetFrameSpellBar.SetStatusBarColor = function() end FocusFrameSpellBar:SetStatusBarColor(0,0.45,0.9) FocusFrameSpellBar.SetStatusBarColor = function() end end ----------:4 if hideMinimap == true then MinimapCluster:Hide() end ----------:5 if movePartyFrames == true then for i = 2, 4 do local f = _G["PartyMemberFrame"..i] f:ClearAllPoints() PartyMemberFrame1:ClearAllPoints() PartyMemberFrame1:SetPoint("CENTER", -400,50) f:SetPoint("BOTTOMLEFT", _G["PartyMemberFrame"..(i-1)], "TOPLEFT", 0, 20) end end ----------:6 if hideCombatText == true then PetHitIndicator:ClearAllPoints() PlayerHitIndicator:ClearAllPoints() end ----------:7 if hidePetFrame == true then PetFrame:SetAlpha(0) end ----------:8 if removePlayerFrameIcons == true then function PlayerFrame_UpdateStatus (self) PlayerStatusTexture:Hide() PlayerStatusGlow:Hide() PlayerRestGlow:Hide() PlayerAttackGlow:Hide() PlayerRestIcon:Hide() PlayerAttackIcon:Hide() PlayerAttackBackground:Hide() end end ----------:9 if classColorBars == true then local UnitIsPlayer, UnitIsConnected, UnitClass, RAID_CLASS_COLORS = UnitIsPlayer, UnitIsConnected, UnitClass, RAID_CLASS_COLORS local _, class, c local function colour(statusbar, unit) if UnitIsPlayer(unit) and UnitIsConnected(unit) and unit == statusbar.unit and UnitClass(unit) then _, class = UnitClass(unit) c = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class] statusbar:SetStatusBarColor(c.r, c.g, c.b) end end TargetFrameTextureFramePVPIcon:SetAlpha(0) hooksecurefunc("UnitFrameHealthBar_Update", colour) hooksecurefunc("HealthBar_OnValueChanged", function(self) colour(self, self.unit) end) local sb = _G.GameTooltipStatusBar local addon = CreateFrame("Frame", "StatusColour") addon:RegisterEvent("UPDATE_MOUSEOVER_UNIT") addon:SetScript("OnEvent", function() colour(sb, "mouseover") end) end ----------:10 if moveUnits == true then PlayerFrame:SetUserPlaced(false) TargetFrame:SetUserPlaced(false) FocusFrame:SetUserPlaced(false) TargetFrameToT:SetUserPlaced(false) local playerFrame = CreateFrame("FRAME") playerFrame:RegisterEvent("PLAYER_ENTERING_WORLD") playerFrame:SetScript("OnEvent", function() PlayerFrame:ClearAllPoints() PlayerFrame:SetPoint("CENTER",-playerFrameX,-playerFrameY) TargetFrame:ClearAllPoints() TargetFrame:SetPoint("CENTER","PlayerFrame","CENTER", 100, -45) TargetFrameToT:ClearAllPoints() TargetFrameToT:SetPoint("CENTER","TargetFrame","CENTER", 55, -35) local focusFrame = CreateFrame("FRAME") focusFrame:RegisterEvent("PLAYER_FOCUS_CHANGED") focusFrame:SetScript("OnEvent", function() FocusFrame:ClearAllPoints() if alignFocusWithTarget == true then FocusFrame:SetPoint("CENTER",playerFrameX,-playerFrameY-45) else FocusFrame:SetPoint("CENTER",playerFrameX,-playerFrameY) end FocusFrameToT:ClearAllPoints() FocusFrameToT:SetPoint("CENTER","FocusFrame","CENTER", 55, -35) if alphaNameBackground == true then FocusFrameNameBackground:SetAlpha(0.5) end end) end) end ----------:11 if enableClassIcons == true then UFP="UnitFramePortrait_Update" UICC="Interface\\TargetingFrame\\UI-Classes-Circles" CIT=CLASS_ICON_TCOORDS UC=UnitClass hooksecurefunc(UFP,function(self) if self.portrait then t=CIT[select(2,UC(self.unit))] if t and UnitIsPlayer(self.unit) then self.portrait:SetTexture(UICC) self.portrait:SetTexCoord(unpack(t)) else self.portrait:SetTexCoord(0,1,0,1) end end end) end ----------:12 if changeStatusBarText == true then TF=CreateFrame("Frame")TFHB=TargetFrameHealthBar.TextString;TTSB=TextStatusBar_CapDisplayOfNumericValue FF=CreateFrame("Frame")FFHB=FocusFrameHealthBar.TextString;TTSB=TextStatusBar_CapDisplayOfNumericValue FF:SetScript("OnUpdate", function(focus)FFHB:SetText(TTSB(UnitHealth("focus")).."/"..TTSB(UnitHealthMax("focus")).." ("..format("%.0f", ((UnitHealth("focus")/UnitHealthMax("focus"))*100)).."%)") end) TF:SetScript("OnUpdate", function(target)TFHB:SetText(TTSB(UnitHealth("target")).."/"..TTSB(UnitHealthMax("target")).." ("..format("%.0f", ((UnitHealth("target")/UnitHealthMax("target"))*100)).."%)") end) end ----------: ArenaStuff if moveArenaFrames == true then ArenaEnemyFrame1:ClearAllPoints() ArenaEnemyFrame1:SetPoint("CENTER", -400, -40) ArenaEnemyFrame1:SetScale(1.23) ArenaEnemyFrame2:SetScale(1.23) ArenaEnemyFrame3:SetScale(1.23) end ----------:13 if showArenaTrinkeCD == true then -- Alience Trinket : trt=GetItemIcon(37864) -- Horde Trinket : trt=GetItemIcon(70395) -- rc : trinket icon size rc=40; 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,100,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, m 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) end ----------: 14 if showDRTracker == true then -- drx = x position -- drs = icon size DRt={ {5782,8122,5484,20511,2094}, -- FEAR {118,6770,1776,49203,28272,28271,61305,61721,61780,82691,51514} -- POLYMORPHE } drx=-120; drs=40; dp="LEFT"; dre="COMBAT_LOG_EVENT_UNFILTERED" drp="PLAYER_ENTERING_WORLD" dra="ARENA_OPPONENT_UPDATE" LoadAddOn("Blizzard_ArenaUI") function gaef(f,n)return _G["ArenaEnemyFrame"..n.."HealthBar"]end function rDR(f) f.e=1; f.t:SetTexture(nil) f.c:Hide() end function sDR(f) f.e=f.e+1; f.c:Show() end function gDRt(i,j) return _G["drc"..i..":"..j] end function runDR(f,n) CooldownFrame_SetTimer(f.c,GetTime(),18,1) eDR(f,n) sDR(f) oDR(n) end function eDR(f,n) local t=1; f:SetScript("OnUpdate", function(s,e) t=t+e; if(t>=18)then f:SetScript("OnUpdate",nil) rDR(f) oDR(n) end end) end function cDR(f,n,s) if f.e<4 then local _,_,t=GetSpellInfo(s) f.t:SetTexture(t) runDR(f,n) end end function oDR(n) local r=1; for j in ipairs(DRt)do local f=gDRt(n,j) f:SetPoint(dp,gaef(f,n),dp,drx+(r-1)*50,0) r=r+1; end end function uDR(n,s) for i,t in ipairs(DRt)do for _,j in ipairs(t)do if s==j then cDR(gDRt(n,i),n,s) end end end end function DRc(i,j) local f=CreateFrame("Frame",nil,UIParent) f:SetSize(drs,drs) f.t=f:CreateTexture(nil,"BORDER") f.t:SetAllPoints(true) f.c=CreateFrame("Cooldown",nil,f) f.c:SetAllPoints(f) f.e=1 return f end function clDR(_,e,_,_,_,_,_,d,_,_,_,s) if(e=="SPELL_AURA_REMOVED" or e=="SPELL_AURA_REFRESH")then for i=1,5 do local ag=UnitGUID("arena"..i) if(ag ~= nil and d==ag)then uDR(i,s) end end end end function iDRt(o,m) for i=1,m do for j in ipairs(DRt)do local f=gDRt(i,j) rDR(f) if o then f:Show() end end end end for i=1,5 do for j in ipairs(DRt)do _G["drc"..i..":"..j]=DRc(i,j) end end dt=CreateFrame("Frame") dt:SetScript("OnEvent", function(_,e,...) if e==dre then clDR(...) elseif e==dra then iDRt(1,GetNumArenaOpponents()) else iDRt(nil,5) end end) dt:RegisterEvent(dra) dt:RegisterEvent(drp) dt:RegisterEvent(dre) end ----------: End ArenaStuff
i can't even move the arenaframes anywhere... i have no clue whats wrong
if i make a macro like:
Code:
/run ArenaEnemyFrame1:ClearAllPoints()
/run ArenaEnemyFrame1:SetPoint("CENTER", -400, -40)
/run ArenaEnemyFrame1:SetScale(1.23)
/run ArenaEnemyFrame2:SetScale(1.23)
/run ArenaEnemyFrame3:SetScale(1.23)
it just works fine
hope someone can help me out!
regards
dbaaf
__________________
Last edited by dbaaf : 02-24-12 at 07:41 AM.
|