Thread Tools Display Modes
10-11-11, 07:19 PM   #1
rashkaldo
A Deviate Faerie Dragon
Join Date: Jan 2010
Posts: 12
I want to put Arenajunkies scripts into .lua form (need help)

Hi, i need help with some nice arenajunkies scripts that improve the default blizz ui.


arena123 casting bar colors/resizing/icon moving

/run AEF="ArenaEnemyFrame";C="CENTER";Ui=UIParent;R="RIGHT";CB="CastingBar";N="Name";CBI="CastingBarIcon";PF="PetFrame"; for i=1,3 do _G[AEF..i]:ClearAllPoints();_G[AEF..i]:ClearAllPoints();_G[AEF..i]:SetScale(1.64); end;
/run for i=1,3 do _G[AEF..i..PF]:Hide();_G[AEF..i..N]:Hide();_G[AEF..i..CB]:SetWidth(71);_G[AEF..i..CBI]:SetPoint("right", -71, 0);_G[AEF..i..CBI]:SetHeight(14);_G[AEF..i..CB]:SetStatusBarColor(0,0.45,0.9); end
/run _G[AEF.."1"]:SetPoint(C,Ui,C,175,-3);_G[AEF.."2"]:SetPoint(C,Ui,C,175,-38);_G[AEF.."3"]:SetPoint(C,Ui,C,175,-73); for i=1,3 do _G[AEF..i].SetPoint = function() end; _G[AEF..i..CB].SetStatusBarcolor = function() end end
/run ArenaEnemyFrame1CastingBar:SetPoint(R,-30,-20.5);ArenaEnemyFrame2CastingBar:SetPoint(R,-30,-20);ArenaEnemyFrame3CastingBar:SetPoint(R,-30,-19.5);for i=1,3 do _G[AEF..i..PF].Show = function() end end
/run for i=1,3 do _G[AEF..i..PF].Show = function() end _G[AEF..i.."ManaBarText"]:Hide();_G[AEF..i.."HealthBarText"]:Hide() _G[AEF..i.."ManaBarText"].Show = function() end _G[AEF..i.."HealthBarText"].Show = function() end end

arena123 pvp trinkets

/run USS="UNIT_SPELLCAST_SUCCEEDED";OE="OnEvent";PvP="Interface\\Icons\\inv_jewelry_trinketpvp_01";F="Frame";CF=CreateFrame;BO="Border";PvPT="PvP Trinket";EMFH="Every Man for Himself";CTFS=COMBAT_TEXT_SCROLL_FUNCTION
/run function TrS(f,x,y,cd) f:SetPoint("CENTER",TargetFrame,"CENTER",x,y)f:SetSize(20,20)f.c=CF("Cooldown",cd)f.c:SetAllPoints(f)f.t=f:CreateTexture(nil,BO)f.t:SetAllPoints()f.t:SetTexture(PvP);f:Hide();f:RegisterEvent(USS) end
/run t1=CF(F);TrS(t1,82,76,"cd1");t2=CF(F);TrS(t2,82,135,"cd2");t3=CF(F)TrS(t3,82,191,"cd3")
/run function Tr(f,cd,U,N,T)if(U==T and (N==PvPT or N==EMFH))then f:Show();CooldownFrame_SetTimer(cd,GetTime(),120,1)end end
/run t1:SetScript(OE,function(_,_,U,N)Tr(t1,cd1,U,N,"arena3")end);t2:SetScript(OE,function(_,_,U,N)Tr(t2,cd2,U,N,"arena2")end);t3:SetScript(OE,function(_,_,U,N)Tr(t3,cd3,U,N,"arena1")end);
important arena 123 debuffs, aka crowd control shown right to the frame, so this + pvp trinket script above = gladius looking arena frames, also included addon LoseControl in this, hence why it is soooo damn long. half of it = debuffs, another half = lose control.

/run RMP={[8122]=1,[408]=1,[1833]=1,[6770]=1,[2094]=1,[118]=1,[82691]=1,[71757]=1,[12598]=1,[122]=1,[33395]=1,[83302]=1,[76577]=1,[12357]=1,[44572]=1,[55021]=1};
/run LC={[33786]=1,[24259]=1,[3355]=1,[42964]=1,[85388]=1,[5782]=1,[82691]=1,[64044]=1,[5484]=1,[20511]=1,[118]=1,[51514]=1,[5211]=1,[8122]=1,[408]=1,[1776]=1,[44572]=1,[19503]=1,[9005]=1,[22570]=1,[853]=1,[90337]=1,[55021]=1,[15487]=1,[47476]=1};
/run table.insert(LC, 7922, 1);table.insert(LC, 1833, 1);table.insert(LC, 1330, 1);table.insert(LC, 2094, 1);table.insert(LC, 6770, 1);table.insert(LC, 80354, 1)
/run d="Debuff";TT="TargetDebuffFrameTemplate";L="LEFT";R="RIGHT";F="Frame";UA="UNIT_AURA";OE="OnEvent";AR="arena";UD=UnitDebuff;AE="ArenaEnemyFrame";d1="Debuff1";D=RefreshDebuffs;CF=CreateFrame;BO="Border";T="TOP";B="BOTTOM"
/run g1=CF(F);g1:RegisterEvent(UA);g2=CF(F);g2:RegisterEvent(UA);g3=CF(F);g3:RegisterEvent(UA);h1=CF(F);h1:RegisterEvent(UA);h2=CF(F);h2:RegisterEvent(UA);h3=CF(F);h3:RegisterEvent(UA);q1=CF(F);q1:RegisterEvent(UA);q2=CF(F);q2:RegisterEvent(UA)
/run function DoDebuffs(f,aura,template,R1,R2) for j=1,16 do local l = f:GetName()..aura;local n=l..j;local c=CF(F,n,f,template);c.unit=f.unit;c:SetPoint(R1,_G[l..(j-1)],R2);_G[n..BO]:SetAlpha(0);end end
/run f1=_G[AE.."1"]; g1:SetScript(OE,function(self,event,a1) if a1==f1.unit then D(f1,a1,16,nil,1);end end) DoDebuffs(f1,d,TT,L,R) local b=_G[f1:GetName()..d1];b:ClearAllPoints();b:SetPoint(L,f1,R,2,-2);
/run f2=_G[AE.."2"]; g2:SetScript(OE,function(self,event,a2) if a2==f2.unit then D(f2,a2,16,nil,1);end end) DoDebuffs(f2,d,TT,L,R) local b=_G[f2:GetName()..d1];b:ClearAllPoints();b:SetPoint(L,f2,R,2,-2);
/run f3=_G[AE.."3"]; g3:SetScript(OE,function(self,event,a3) if a3==f3.unit then D(f3,a3,16,nil,1);end end) DoDebuffs(f3,d,TT,L,R) local b=_G[f3:GetName()..d1];b:ClearAllPoints();b:SetPoint(L,f3,R,2,-2);
/run h1:SetScript(OE,function(self,event,a1)for j=1,16 do _,_,_,_,_,_,_,_,_,_,id=UD(AR.."1",j);q=f1:GetName()..d..j if (not RMP[id]) then _G[q]:Hide();_G[q]:SetScale(.01);else _G[q]:Show();_G[q]:SetScale(1.4);end end end)
/run h2:SetScript(OE,function(self,event,a1)for j=1,16 do _,_,_,_,_,_,_,_,_,_,id=UD(AR.."2",j);q=f2:GetName()..d..j if (not RMP[id]) then _G[q]:Hide();_G[q]:SetScale(.01);else _G[q]:Show();_G[q]:SetScale(1.4);end end end)
/run h3:SetScript(OE,function(self,event,a1)for j=1,16 do _,_,_,_,_,_,_,_,_,_,id=UD(AR.."3",j);q=f3:GetName()..d..j if (not RMP[id]) then _G[q]:Hide();_G[q]:SetScale(.01);else _G[q]:Show();_G[q]:SetScale(1.4);end end end)
/run p1=_G["PlayerFrame"]; q1:SetScript(OE,function(self,event,a1) if a1==p1.unit then D(p1,a1,16,nil,1);end end) DoDebuffs(p1,d,TT,T,B) local b=_G[p1:GetName()..d1];b:ClearAllPoints();b:SetPoint("CENTER", 55, 46.5);b.SetPoint = function() end
/run q2:SetScript(OE,function(self,event,a1)for j=1,16 do _,_,_,_,_,_,_,_,_,_,id=UD("player",j);q=p1:GetName()..d..j if (not LC[id]) then _G[q]:Hide();_G[q]:SetScale(.01);else _G[q]:Show();_G[q]:SetScale(2);end end end)/run RMP={[8122]=1,[408]=1,[1833]=1,[6770]=1,[2094]=1,[118]=1,[82691]=1,[71757]=1,[12598]=1,[122]=1,[33395]=1,[83302]=1,[76577]=1,[12357]=1,[44572]=1,[55021]=1};
/run LC={[33786]=1,[24259]=1,[3355]=1,[42964]=1,[85388]=1,[5782]=1,[82691]=1,[64044]=1,[5484]=1,[20511]=1,[118]=1,[51514]=1,[5211]=1,[8122]=1,[408]=1,[1776]=1,[44572]=1,[19503]=1,[9005]=1,[22570]=1,[853]=1,[90337]=1,[55021]=1,[15487]=1,[47476]=1};
/run table.insert(LC, 7922, 1);table.insert(LC, 1833, 1);table.insert(LC, 1330, 1);table.insert(LC, 2094, 1);table.insert(LC, 6770, 1);table.insert(LC, 80354, 1)
/run d="Debuff";TT="TargetDebuffFrameTemplate";L="LEFT";R="RIGHT";F="Frame";UA="UNIT_AURA";OE="OnEvent";AR="arena";UD=UnitDebuff;AE="ArenaEnemyFrame";d1="Debuff1";D=RefreshDebuffs;CF=CreateFrame;BO="Border";T="TOP";B="BOTTOM"
/run g1=CF(F);g1:RegisterEvent(UA);g2=CF(F);g2:RegisterEvent(UA);g3=CF(F);g3:RegisterEvent(UA);h1=CF(F);h1:RegisterEvent(UA);h2=CF(F);h2:RegisterEvent(UA);h3=CF(F);h3:RegisterEvent(UA);q1=CF(F);q1:RegisterEvent(UA);q2=CF(F);q2:RegisterEvent(UA)
/run function DoDebuffs(f,aura,template,R1,R2) for j=1,16 do local l = f:GetName()..aura;local n=l..j;local c=CF(F,n,f,template);c.unit=f.unit;c:SetPoint(R1,_G[l..(j-1)],R2);_G[n..BO]:SetAlpha(0);end end
/run f1=_G[AE.."1"]; g1:SetScript(OE,function(self,event,a1) if a1==f1.unit then D(f1,a1,16,nil,1);end end) DoDebuffs(f1,d,TT,L,R) local b=_G[f1:GetName()..d1];b:ClearAllPoints();b:SetPoint(L,f1,R,2,-2);
/run f2=_G[AE.."2"]; g2:SetScript(OE,function(self,event,a2) if a2==f2.unit then D(f2,a2,16,nil,1);end end) DoDebuffs(f2,d,TT,L,R) local b=_G[f2:GetName()..d1];b:ClearAllPoints();b:SetPoint(L,f2,R,2,-2);
/run f3=_G[AE.."3"]; g3:SetScript(OE,function(self,event,a3) if a3==f3.unit then D(f3,a3,16,nil,1);end end) DoDebuffs(f3,d,TT,L,R) local b=_G[f3:GetName()..d1];b:ClearAllPoints();b:SetPoint(L,f3,R,2,-2);
/run h1:SetScript(OE,function(self,event,a1)for j=1,16 do _,_,_,_,_,_,_,_,_,_,id=UD(AR.."1",j);q=f1:GetName()..d..j if (not RMP[id]) then _G[q]:Hide();_G[q]:SetScale(.01);else _G[q]:Show();_G[q]:SetScale(1.4);end end end)
/run h2:SetScript(OE,function(self,event,a1)for j=1,16 do _,_,_,_,_,_,_,_,_,_,id=UD(AR.."2",j);q=f2:GetName()..d..j if (not RMP[id]) then _G[q]:Hide();_G[q]:SetScale(.01);else _G[q]:Show();_G[q]:SetScale(1.4);end end end)
/run h3:SetScript(OE,function(self,event,a1)for j=1,16 do _,_,_,_,_,_,_,_,_,_,id=UD(AR.."3",j);q=f3:GetName()..d..j if (not RMP[id]) then _G[q]:Hide();_G[q]:SetScale(.01);else _G[q]:Show();_G[q]:SetScale(1.4);end end end)
/run p1=_G["PlayerFrame"]; q1:SetScript(OE,function(self,event,a1) if a1==p1.unit then D(p1,a1,16,nil,1);end end) DoDebuffs(p1,d,TT,T,B) local b=_G[p1:GetName()..d1];b:ClearAllPoints();b:SetPoint("CENTER", 55, 46.5);b.SetPoint = function() end
/run q2:SetScript(OE,function(self,event,a1)for j=1,16 do _,_,_,_,_,_,_,_,_,_,id=UD("player",j);q=p1:GetName()..d..j if (not LC[id]) then _G[q]:Hide();_G[q]:SetScale(.01);else _G[q]:Show();_G[q]:SetScale(2);end end end)
  Reply With Quote
10-11-11, 08:21 PM   #2
Taryble
A Molten Giant
 
Taryble's Avatar
Join Date: Jan 2009
Posts: 811
Just remove all the /run's from every line - that's all already lua scripting.

Then make your folder in the Addons folder - for example, \ArenaJunkies\

Then make a file named exactly like your folder - case and spelling are important! - and put .toc on the end.

In the above example, \ArenaJunkies\ArenaJunkies.toc

Then, make your .lua file - \ArenaJunkies\ArenaJunkies.lua

Copy/paste those scripts you have into your .lua file, and remove the /run's from the start of each line.

Save the .lua file.

Then, add a line to your .toc file that points to your .lua file - just the name is all you need, so "ArenaJunkies.lua" is fine.

Save the .toc file.

Start WoW. It SHOULD show up in your addons list as "ArenaJunkies". If not, then I've forgotten something simple and obvious in the .toc file, but my wingsauce-maddened brain cannot think of it at this time. :>
__________________
-- Taryble
  Reply With Quote
10-11-11, 08:41 PM   #3
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
The problem with that is the variable names...they may clobber one another since they're "f" and "j" and such.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
10-12-11, 05:09 AM   #4
rashkaldo
A Deviate Faerie Dragon
Join Date: Jan 2010
Posts: 12
Originally Posted by Torhal View Post
The problem with that is the variable names...they may clobber one another since they're "f" and "j" and such.
I think, too. I already tried to put in in addon from by removin /run.
but my lua coding knowledge isnt that good. i have atm. no time to learn it, because of school .
  Reply With Quote
10-12-11, 07:41 AM   #5
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
First you should try to make it readable. That helps to debug when you put them in an addon (dont put the three in the same addon as they share variablenames and functions)

And I guess you've pasted the third block twice

lua Code:
  1. local AEF="ArenaEnemyFrame"
  2. local C="CENTER"
  3. local Ui=UIParent
  4. local R="RIGHT"
  5. local CB="CastingBar"
  6. local N="Name"
  7. local CBI="CastingBarIcon"
  8. local PF="PetFrame"
  9. for i=1,3 do
  10.     _G[AEF..i]ClearAllPoints()
  11.     _G[AEF..i]:ClearAllPoints()
  12.     _G[AEF..i]:SetScale(1.64)
  13. end
  14. for i=1,3 do
  15.     _G[AEF..i..PF]:Hide()
  16.     _G[AEF..i..N]:Hide()
  17.     _G[AEF..i..CB]:SetWidth(71)
  18.     _G[AEF..i..CBI]:SetPoint("right", -71, 0)
  19.     _G[AEF..i..CBI]:SetHeight(14)
  20.     _G[AEF..i..CB]:SetStatusBarColor(0,0.45,0.9)
  21. end
  22. _G[AEF.."1"]:SetPoint(C,Ui,C,175,-3)
  23. _G[AEF.."2"]:SetPoint(C,Ui,C,175,-38)
  24. _G[AEF.."3"]:SetPoint(C,Ui,C,175,-73)
  25. for i=1,3 do
  26.     _G[AEF..i].SetPoint = function() end
  27.     _G[AEF..i..CB].SetStatusBarcolor = function() end
  28. end
  29. ArenaEnemyFrame1CastingBar:SetPoint(R,-30,-20.5)
  30. ArenaEnemyFrame2CastingBar:SetPoint(R,-30,-20)
  31. ArenaEnemyFrame3CastingBar:SetPoint(R,-30,-19.5)
  32. for i=1,3 do
  33.     _G[AEF..i..PF].Show = function() end
  34. end
  35. for i=1,3 do
  36.     _G[AEF..i..PF].Show = function() end
  37.     _G[AEF..i.."ManaBarText"]:Hide()
  38.     _G[AEF..i.."HealthBarText"]:Hide()
  39.     _G[AEF..i.."ManaBarText"].Show = function() end
  40.     _G[AEF..i.."HealthBarText"].Show = function() end
  41. end

lua Code:
  1. local USS="UNIT_SPELLCAST_SUCCEEDED"
  2. local OE="OnEvent"
  3. local PvP="Interface\\Icons\\inv_jewelry_trinketpvp_01"
  4. local F="Frame"
  5. local CF=CreateFrame
  6. local BO="Border"
  7. local PvPT="PvP Trinket"
  8. local EMFH="Every Man for Himself"
  9. local CTFS=COMBAT_TEXT_SCROLL_FUNCTION
  10. function TrS(f,x,y,cd)
  11.     f:SetPoint("CENTER",TargetFrame,"CENTER",x,y)
  12.     f:SetSize(20,20)
  13.     f.c=CF("Cooldown",cd)
  14.     f.c:SetAllPoints(f)
  15.     f.t=f:CreateTexture(nil,BO)
  16.     f.t:SetAllPoints()
  17.     f.t:SetTexture(PvP)
  18.     f:Hide()
  19.     f:RegisterEvent(USS)
  20. end
  21. local t1=CF(F)
  22. TrS(t1,82,76,"cd1")
  23. local t2=CF(F)
  24. TrS(t2,82,135,"cd2")
  25. local t3=CF(F)
  26. TrS(t3,82,191,"cd3")
  27. function Tr(f,cd,U,N,T)
  28.     if(U==T and (N==PvPT or N==EMFH))then
  29.         f:Show()
  30.         CooldownFrame_SetTimer(cd,GetTime(),120,1)
  31.     end
  32. end
  33. t1:SetScript(OE,function(_,_,U,N)
  34.     Tr(t1,cd1,U,N,"arena3")
  35. end)
  36. t2:SetScript(OE,function(_,_,U,N)
  37.     Tr(t2,cd2,U,N,"arena2")
  38. end)
  39. t3:SetScript(OE,function(_,_,U,N)
  40.     Tr(t3,cd3,U,N,"arena1")
  41. end)
lua Code:
  1. local RMP={[8122]=1,[408]=1,[1833]=1,[6770]=1,[2094]=1,[118]=1,[82691]=1,[71757]=1,[12598]=1,[122]=1,[33395]=1,[83302]=1,[76577]=1,[12357]=1,[44572]=1,[55021]=1}
  2. local LC={[33786]=1,[24259]=1,[3355]=1,[42964]=1,[85388]=1,[5782]=1,[82691]=1,[64044]=1,[5484]=1,[20511]=1,[118]=1,[51514]=1,[5211]=1,[8122]=1,[408]=1,[1776]=1,[44572]=1,[19503]=1,[9005]=1,[22570]=1,[853]=1,[90337]=1,[55021]=1,[15487]=1,[47476]=1}
  3. table.insert(LC, 7922, 1)
  4. table.insert(LC, 1833, 1)
  5. table.insert(LC, 1330, 1)
  6. table.insert(LC, 2094, 1)
  7. table.insert(LC, 6770, 1)
  8. table.insert(LC, 80354, 1)
  9. local d="Debuff"
  10. local TT="TargetDebuffFrameTemplate"
  11. local L="LEFT"
  12. local R="RIGHT"
  13. local F="Frame"
  14. local UA="UNIT_AURA"
  15. local OE="OnEvent"
  16. local AR="arena"
  17. local UD=UnitDebuff
  18. local AE="ArenaEnemyFrame"
  19. local d1="Debuff1"
  20. local D=RefreshDebuffs
  21. local CF=CreateFrame
  22. local BO="Border"
  23. local T="TOP"
  24. local B="BOTTOM"
  25. local g1=CF(F)
  26. g1:RegisterEvent(UA)
  27. local g2=CF(F)
  28. g2:RegisterEvent(UA)
  29. local g3=CF(F)
  30. g3:RegisterEvent(UA)
  31. local h1=CF(F)
  32. h1:RegisterEvent(UA)
  33. local h2=CF(F)
  34. h2:RegisterEvent(UA)
  35. local h3=CF(F)
  36. h3:RegisterEvent(UA)
  37. local q1=CF(F)
  38. q1:RegisterEvent(UA)
  39. local q2=CF(F)
  40. q2:RegisterEvent(UA)
  41. function DoDebuffs(f,aura,template,R1,R2)
  42.     for j=1,16 do
  43.         local l = f:GetName()..aura
  44.         local n=l..j
  45.         local c=CF(F,n,f,template)
  46.         c.unit=f.unit
  47.         c:SetPoint(R1,_G[l..(j-1)],R2)
  48.         _G[n..BO]:SetAlpha(0)
  49.     end
  50. end
  51. local f1=_G[AE.."1"]
  52. g1:SetScript(OE,function(self,event,a1)
  53.     if a1==f1.unit then
  54.         D(f1,a1,16,nil,1)
  55.     end
  56. end)
  57. DoDebuffs(f1,d,TT,L,R)
  58. local b=_G[f1:GetName()..d1]
  59. b:ClearAllPoints()
  60. b:SetPoint(L,f1,R,2,-2)
  61. local f2=_G[AE.."2"]
  62. g2:SetScript(OE,function(self,event,a2)
  63.     if a2==f2.unit then
  64.         D(f2,a2,16,nil,1)
  65.     end
  66. end)
  67. DoDebuffs(f2,d,TT,L,R)
  68. local b=_G[f2:GetName()..d1]
  69. b:ClearAllPoints()
  70. b:SetPoint(L,f2,R,2,-2)
  71. local f3=_G[AE.."3"]
  72. g3:SetScript(OE,function(self,event,a3)
  73.     if a3==f3.unit then
  74.         D(f3,a3,16,nil,1)
  75.     end
  76. end)
  77. DoDebuffs(f3,d,TT,L,R)
  78. local b=_G[f3:GetName()..d1]
  79. b:ClearAllPoints()
  80. b:SetPoint(L,f3,R,2,-2)
  81. h1:SetScript(OE,function(self,event,a1)
  82.     for j=1,16 do
  83.         local _,_,_,_,_,_,_,_,_,_,id=UD(AR.."1",j)
  84.         local q=f1:GetName()..d..j
  85.         if (not RMP[id]) then
  86.             _G[q]:Hide()
  87.             _G[q]:SetScale(.01)
  88.         else
  89.             _G[q]:Show()
  90.             _G[q]:SetScale(1.4)
  91.         end
  92.     end
  93. end)
  94. h2:SetScript(OE,function(self,event,a1)
  95.     for j=1,16 do
  96.         local _,_,_,_,_,_,_,_,_,_,id=UD(AR.."2",j)
  97.         local q=f2:GetName()..d..j
  98.         if (not RMP[id]) then
  99.             _G[q]:Hide()
  100.             _G[q]:SetScale(.01)
  101.         else
  102.             _G[q]:Show()
  103.             _G[q]:SetScale(1.4)
  104.         end
  105.     end
  106. end)
  107. h3:SetScript(OE,function(self,event,a1)
  108.     for j=1,16 do
  109.         local _,_,_,_,_,_,_,_,_,_,id=UD(AR.."3",j)
  110.         local q=f3:GetName()..d..j
  111.         if (not RMP[id]) then
  112.             _G[q]:Hide()
  113.             _G[q]:SetScale(.01)
  114.         else
  115.             _G[q]:Show()
  116.             _G[q]:SetScale(1.4)
  117.         end
  118.     end
  119. end)
  120. local p1=_G["PlayerFrame"]
  121. local q1:SetScript(OE,function(self,event,a1)
  122.     if a1==p1.unit then
  123.         D(p1,a1,16,nil,1)
  124.     end
  125. end)
  126. DoDebuffs(p1,d,TT,T,B)
  127. local b=_G[p1:GetName()..d1]
  128. b:ClearAllPoints()
  129. b:SetPoint("CENTER", 55, 46.5)
  130. b.SetPoint = function() end
  131. q2:SetScript(OE,function(self,event,a1)
  132.     for j=1,16 do
  133.         local _,_,_,_,_,_,_,_,_,_,id=UD("player",j)
  134.         local q=p1:GetName()..d..j
  135.         if (not LC[id]) then
  136.             _G[q]:Hide()
  137.             _G[q]:SetScale(.01)
  138.         else
  139.             _G[q]:Show()
  140.             _G[q]:SetScale(2)
  141.         end
  142.     end
  143. end)
  144. local RMP={[8122]=1,[408]=1,[1833]=1,[6770]=1,[2094]=1,[118]=1,[82691]=1,[71757]=1,[12598]=1,[122]=1,[33395]=1,[83302]=1,[76577]=1,[12357]=1,[44572]=1,[55021]=1}
  145. local LC={[33786]=1,[24259]=1,[3355]=1,[42964]=1,[85388]=1,[5782]=1,[82691]=1,[64044]=1,[5484]=1,[20511]=1,[118]=1,[51514]=1,[5211]=1,[8122]=1,[408]=1,[1776]=1,[44572]=1,[19503]=1,[9005]=1,[22570]=1,[853]=1,[90337]=1,[55021]=1,[15487]=1,[47476]=1}
  146. table.insert(LC, 7922, 1)
  147. table.insert(LC, 1833, 1)
  148. table.insert(LC, 1330, 1)
  149. table.insert(LC, 2094, 1)
  150. table.insert(LC, 6770, 1)
  151. table.insert(LC, 80354, 1)
  152. local d="Debuff"
  153. local TT="TargetDebuffFrameTemplate"
  154. local L="LEFT"
  155. local R="RIGHT"
  156. local F="Frame"
  157. local UA="UNIT_AURA"
  158. local OE="OnEvent"
  159. local AR="arena"
  160. local UD=UnitDebuff
  161. local AE="ArenaEnemyFrame"
  162. local d1="Debuff1"
  163. local D=RefreshDebuffs
  164. local CF=CreateFrame
  165. local BO="Border"
  166. local T="TOP"
  167. local B="BOTTOM"
  168. local g1=CF(F)
  169. g1:RegisterEvent(UA)
  170. local g2=CF(F)
  171. g2:RegisterEvent(UA)
  172. local g3=CF(F)
  173. g3:RegisterEvent(UA)
  174. local h1=CF(F)
  175. h1:RegisterEvent(UA)
  176. local h2=CF(F)
  177. h2:RegisterEvent(UA)
  178. local h3=CF(F)
  179. h3:RegisterEvent(UA)
  180. local q1=CF(F)
  181. q1:RegisterEvent(UA)
  182. local q2=CF(F)
  183. q2:RegisterEvent(UA)
  184. function DoDebuffs(f,aura,template,R1,R2)
  185.     for j=1,16 do
  186.         local l = f:GetName()..aura
  187.         local n=l..j
  188.         local c=CF(F,n,f,template)
  189.         c.unit=f.unit
  190.         c:SetPoint(R1,_G[l..(j-1)],R2)
  191.         _G[n..BO]:SetAlpha(0)
  192.     end
  193. end
  194. local f1=_G[AE.."1"]
  195. g1:SetScript(OE,function(self,event,a1)
  196.     if a1==f1.unit then
  197.         D(f1,a1,16,nil,1)
  198.     end
  199. end)
  200. DoDebuffs(f1,d,TT,L,R)
  201. local b=_G[f1:GetName()..d1]
  202. b:ClearAllPoints()
  203. b:SetPoint(L,f1,R,2,-2)
  204. local f2=_G[AE.."2"]
  205. g2:SetScript(OE,function(self,event,a2)
  206.     if a2==f2.unit then
  207.         D(f2,a2,16,nil,1)
  208.     end
  209. end)
  210. DoDebuffs(f2,d,TT,L,R)
  211. local b=_G[f2:GetName()..d1]
  212. b:ClearAllPoints()
  213. b:SetPoint(L,f2,R,2,-2)
  214. local f3=_G[AE.."3"]
  215. g3:SetScript(OE,function(self,event,a3)
  216.     if a3==f3.unit then
  217.         D(f3,a3,16,nil,1)
  218.     end
  219. end)
  220. DoDebuffs(f3,d,TT,L,R)
  221. local b=_G[f3:GetName()..d1]
  222. b:ClearAllPoints()
  223. b:SetPoint(L,f3,R,2,-2)
  224. h1:SetScript(OE,function(self,event,a1)
  225.     for j=1,16 do
  226.         local _,_,_,_,_,_,_,_,_,_,id=UD(AR.."1",j)
  227.         local q=f1:GetName()..d..j
  228.         if (not RMP[id]) then
  229.             _G[q]:Hide()
  230.             _G[q]:SetScale(.01)
  231.         else
  232.             _G[q]:Show()
  233.             _G[q]:SetScale(1.4)
  234.         end
  235.     end
  236. end)
  237. h2:SetScript(OE,function(self,event,a1)
  238.     for j=1,16 do
  239.         local _,_,_,_,_,_,_,_,_,_,id=UD(AR.."2",j)
  240.         local q=f2:GetName()..d..j
  241.         if (not RMP[id]) then
  242.             _G[q]:Hide()
  243.             _G[q]:SetScale(.01)
  244.         else
  245.             _G[q]:Show()
  246.             _G[q]:SetScale(1.4)
  247.         end
  248.     end
  249. end)
  250. h3:SetScript(OE,function(self,event,a1)
  251.     for j=1,16 do
  252.         local _,_,_,_,_,_,_,_,_,_,id=UD(AR.."3",j)
  253.         local q=f3:GetName()..d..j
  254.         if (not RMP[id]) then
  255.             _G[q]:Hide()
  256.             _G[q]:SetScale(.01)
  257.         else
  258.             _G[q]:Show()
  259.             _G[q]:SetScale(1.4)
  260.         end
  261.     end
  262. end)
  263. local p1=_G["PlayerFrame"]
  264. q1:SetScript(OE,function(self,event,a1)
  265.     if a1==p1.unit then
  266.         D(p1,a1,16,nil,1)
  267.     end
  268. end)
  269. DoDebuffs(p1,d,TT,T,B)
  270. local b=_G[p1:GetName()..d1]
  271. b:ClearAllPoints()
  272. b:SetPoint("CENTER", 55, 46.5)
  273. b.SetPoint = function() end
  274. q2:SetScript(OE,function(self,event,a1)
  275.     for j=1,16 do
  276.         local _,_,_,_,_,_,_,_,_,_,id=UD("player",j)
  277.         local q=p1:GetName()..d..j
  278.         if (not LC[id]) then
  279.             _G[q]:Hide()
  280.             _G[q]:SetScale(.01)
  281.         else
  282.             _G[q]:Show()
  283.             _G[q]:SetScale(2)
  284.         end
  285.     end
  286. end)
__________________
The cataclysm broke the world ... and the pandas could not fix it!

Last edited by Rilgamon : 10-12-11 at 07:44 AM.
  Reply With Quote
10-12-11, 06:07 PM   #6
rashkaldo
A Deviate Faerie Dragon
Join Date: Jan 2010
Posts: 12
Thank you very much bro, i know that it take time to write for me the code in .lua form.

the only script that work is the PVP Trinket script, the two others have errors.
  Reply With Quote
10-12-11, 09:17 PM   #7
Taryble
A Molten Giant
 
Taryble's Avatar
Join Date: Jan 2009
Posts: 811
What are the errors? Can you use Bugsack/Buggrabber to copy and paste the errors to this thread?
__________________
-- Taryble
  Reply With Quote
10-12-11, 10:12 PM   #8
rashkaldo
A Deviate Faerie Dragon
Join Date: Jan 2010
Posts: 12
From first script i get this error:

test.lua:10: '=' expected near 'ClearAllPoints'
from third script i get this error:

test2.lua:121: unexpected symbol near ':'
the second script works fine
  Reply With Quote
10-12-11, 11:34 PM   #9
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
A simpler solution to variable collision issues would be to simply add a "do" before each block, and an "end" after each one, thus giving each section its own scope. You could also add some comments to remind you what each section does. With this method you could easily add more macros without needing other people to reformat the code for you.

lua Code:
  1. do
  2.     -- casting bar colors/resizing/icon moving
  3.     AEF="ArenaEnemyFrame";C="CENTER";Ui=UIParent;R="RIGHT";CB="CastingBar";N="Name";CBI="CastingBarIcon";PF="PetFrame"; for i=1,3 do _G[AEF..i]:ClearAllPoints();_G[AEF..i]:ClearAllPoints();_G[AEF..i]:SetScale(1.64); end;
  4.     for i=1,3 do _G[AEF..i..PF]:Hide();_G[AEF..i..N]:Hide();_G[AEF..i..CB]:SetWidth(71);_G[AEF..i..CBI]:SetPoint("right", -71, 0);_G[AEF..i..CBI]:SetHeight(14);_G[AEF..i..CB]:SetStatusBarColor(0,0.45,0.9); end
  5.     _G[AEF.."1"]:SetPoint(C,Ui,C,175,-3);_G[AEF.."2"]:SetPoint(C,Ui,C,175,-38);_G[AEF.."3"]:SetPoint(C,Ui,C,175,-73); for i=1,3 do _G[AEF..i].SetPoint = function() end; _G[AEF..i..CB].SetStatusBarcolor = function() end end
  6.     ArenaEnemyFrame1CastingBar:SetPoint(R,-30,-20.5);ArenaEnemyFrame2CastingBar:SetPoint(R,-30,-20);ArenaEnemyFrame3CastingBar:SetPoint(R,-30,-19.5);for i=1,3 do _G[AEF..i..PF].Show = function() end end
  7.     for i=1,3 do _G[AEF..i..PF].Show = function() end _G[AEF..i.."ManaBarText"]:Hide();_G[AEF..i.."HealthBarText"]:Hide() _G[AEF..i.."ManaBarText"].Show = function() end _G[AEF..i.."HealthBarText"].Show = function() end end
  8. end
  Reply With Quote
10-13-11, 01:53 AM   #10
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
The "do" blocks won't matter since the variables aren't being prefixed with "local" - they're still being thrown into the global environment.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
10-13-11, 05:00 AM   #11
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Hmm, good point. I was just sitting down for breakfast when I made that last post.
  Reply With Quote
10-13-11, 08:07 AM   #12
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Hehe - I've been there before, as you know.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
10-13-11, 08:42 AM   #13
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
Originally Posted by rashkaldo View Post
From first script i get this error:



from third script i get this error:



the second script works fine
Delete line 10 in the first and remove "local" from line 121 this should fix those errors.
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
10-13-11, 11:11 AM   #14
rashkaldo
A Deviate Faerie Dragon
Join Date: Jan 2010
Posts: 12
Hi, thank you for the feedback.

i delete line 10. now i get this error:

Message: test.lua:18: attempt to index field '?' (a nil value)
Time: 10/13/11 19:08:48
Count: 1
Stack: test.lua:18: in main chunk

Locals: f = <unnamed> {
0 = <userdata>
}
AEF = "ArenaEnemyFrame"
C = "CENTER"
Ui = UIParent {
0 = <userdata>
firstTimeLoaded = 1
}
R = "RIGHT"
CB = "CastingBar"
N = "Name"
CBI = "CastingBarIcon"
PF = "PetFrame"
(for index) = 1
(for limit) = 3
(for step) = 1
i = 1
(*temporary) = nil
(*temporary) = nil
(*temporary) = "1"
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index field '?' (a nil value)"
and when i remove line i get this error

test.lua:51: attempt to index local 'f' (a nil value)
Time: 10/13/11 19:10:38
Count: 1
Stack: test.lua:51: in function `DoDebuffs'
test.lua:65: in main chunk

Locals: f = nil
aura = "Debuff"
template = "TargetDebuffFrameTemplate"
R1 = "LEFT"
R2 = "RIGHT"
(for index) = 1
(for limit) = 16
(for step) = 1
j = 1
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index local 'f' (a nil value)"
CF = <function> defined =[C]:-1
F = "Frame"
BO = "Border"
  Reply With Quote
10-13-11, 05:35 PM   #15
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Those errors are occurring because the arena frames are loaded on demand, and aren't loaded when your addon is loading. Either add this to your addon's TOC file:

Code:
## LoadsWith: Blizzard_ArenaUI
or, if your addon does other things besides modify the arena frames, add this to the top of your Lua file:

Code:
LoadAddOn("Blizzard_ArenaUI")
  Reply With Quote
10-13-11, 11:12 PM   #16
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,335
Originally Posted by Phanx View Post
Those errors are occurring because the arena frames are loaded on demand, and aren't loaded when your addon is loading. Either add this to your addon's TOC file:

Code:
## LoadsWith: Blizzard_ArenaUI
Also to add, the LoadWith attribute in the ToC file only takes effect if both the current and target addons are LoD. Regardless if LoadWith is defined or not, your addon will load on login if the following line isn't defined.

Code:
## LoadOnDemand: 1
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
10-14-11, 06:57 PM   #17
rashkaldo
A Deviate Faerie Dragon
Join Date: Jan 2010
Posts: 12
Thank you bro, this worke fine.
only the arena debuff code is very buggy and lagy. it think its not effectiv written
  Reply With Quote
10-15-11, 02:27 PM   #18
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Since you're not limited to using macros, why don't you just use one of the real addons written specifically for arenas? Your comment for the third macro names the addon LoseControl, which will cover the crowd control part, and there are plenty of arena debuff addons.

There are quite a few addons in the PvP, Arena, BattleGrounds category here on WoWInterface.

You could also look through the Arena category over on Curse, though since they let authors list addons in multiple categories, there are a lot of addons listed there that are not arena-specific (eg. general unit frame addons that can show arena enemy frames), so that may be less useful.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » I want to put Arenajunkies scripts into .lua form (need help)


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off