Thread Tools Display Modes
06-15-10, 08:44 AM   #1
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
breaking it down.

Okay upon everyone's suggestion im attempting to shorten code.

best way i can see especially when needing to do something for 4 sets of frames all the time, is to use local function blahblah(i) where i = the partyframe number. The problem or question i have is how to tag certain lines when trying to use ..i.. like the following...

lua Code:
  1. local function Party1Style1NameTextEvents()
  2.     local Party1Exists = UnitExists("Party1")
  3.     if Party1Exists == 1 then
  4.         local Party1Name = UnitName("Party1")
  5.         local Party1NameStr = ("%s"):format(Party1Name)
  6.         Party1NameText:SetText(Party1NameStr)
  7.     end
  8.         GrimUI.Party1NameColoring()
  9. end
  10. GrimUI.Party1Style1NameTextEvents = Party1Style1NameTextEvents

ultimately i need everywhere it says Party1 to read Party..i..

ive been successful in breaking down somethings but the tag is different for certain things... like the following
lua Code:
  1. CreateFrame('Frame', "Party"..i.."PedestalFrame", _G["GUI_Party"..i.."Frame"])

the one version is a already made frame... the other is the new frame. one needs _G and [] the other does not. there is a handful of other things not frame name or current frame id like to change 1 to a variable to shorten the 4x repeated party frame creation...
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
06-15-10, 09:30 AM   #2
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Not every component of the unit frame needs to be named (global). Why not just:
Code:
local frame = Create("Frame", "GUI_Party" .. i .. ''Frame", UIParent, "SecureUnitButtonTemplate")
frame.pedestal = Create("Frame", nil, frame)
I would also save the unit with the frame so that you don't have to keep concating it:
Code:
frame.unit = "party" .. i
Then you could do something such as:
Code:
function GrimUI.PartyStyle1NameTextEvents(self)
    if UnitExists(self.unit) == 1 then
        self.nameText:SetFormattedText("%s", UnitName(self.unit))
    end
    self:ApplyNameColoring()
end
  Reply With Quote
06-15-10, 10:03 AM   #3
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
part of the problem is i dont think the frame.pedestal part will work because the style selection function looks for Party1PedestalFrame to do a bunch of things to that frame...

what really makes this complicated is the style1 and style2 functions... whitch is why i global named so many things because when i do local and dont set a name for something in its global name space ("frame", namethatgoesinGnamespace, parent, inherit)

it does not seem able to find the right stuff later for the style functions. although i have this idea on the tip of my tongue and i think its what you would say to do... lol... what i think needs to be done is i remove the party1 part from all the stuff in the style function and replace it with frame.* something i think im a little unclear on when it comes to frame creation. So lets say i do what you had posted above, and cargor also sent me a chunk of code that appears to do the same thing, it looks as though it makes the pedestal frame but never separates it other then the frame its originally created by IE frame.pedestal so what im wondering about is when it makes the 2nd frame.pedestal for party2 technically pedestal frame will have the same name as party1. so when you do the frame. is that making it a child of party1 frame? and is it going to know that the pedestal frame for party1 is dif then the one for party two even though they have the same name? edit -- or no name at all?

also i take it that "party" .. i is another means of setting the variable, just like for other things its "..i.."? and frame.unit is that like setting the unit attrib? i dont understand how that translates to local Party1Exists = UnitExists("Party1")? edit-- i see now how it hooks the unit.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 06-15-10 at 10:16 AM.
  Reply With Quote
06-15-10, 11:55 AM   #4
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
even though frame is local it can be used through out all my functions if i put those first two in a function?

also just noticed you only use create? not createframe?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 06-15-10 at 12:02 PM.
  Reply With Quote
06-15-10, 01:19 PM   #5
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Originally Posted by Grimsin View Post
even though frame is local it can be used through out all my functions if i put those first two in a function?

also just noticed you only use create? not createframe?
The "Create" should be "CreateFrame" I just goofed on that.

As for all the other stuff. Its object oriented. You make a generic function that creates your object and have generic functions that work on those object. The idea is to only code specifically to what the object is in general but not to any one particular member of the set.

So you do (just a rough example):
Code:
flocal function ApplyNameColoring(self)
	self.nameText:SetTextColor(1, 1, 1, 1)
end

local function PartyStyle1NameTextEvents(self)
    if UnitExists(self.unit) == 1 then
        self.nameText:SetFormattedText("%s", UnitName(self.unit))
    end
    self:ApplyNameColoring()
end

function GrimUI.CreatePartyFrame(id)
	local frame = CreateFrame('Button', 'GrimUIPartyFrame' .. id, 'SecureUnitButtonTemplate')
	frame.healthBar = CreateFrame('StatusBar', nil, frame)
	frame.manaBar = CreateFrame('StatusBar', nil, frame)
	frame.nameText = CreateFontString(nil, 'ARTWORK')
	frame.pedestal = CreateFrame('Frame', nil, frame)
	frame.unit = 'party' .. id

	frame.ApplyNameColoring = ApplyNameColoring

	return frame
end

for id = 1, 4 do
	GrimUI.CreatePartyFrame(id)
end
Each party frame is created and is completely separate from the other. The only thing they share is their methods. When you do GrimUIPartyButton1:ApplyNameColoring() the first argument that is passed is the frame for GrimUIPartyFrame1 and in the function for ApplyNameColoring you see that the first argument is named self. So when you do self.unit it will be the value that matches the party frame you called it with.

If you want to access the pedestal frame for party member 3 you would do GrimUIPartyFrame3.pedestal. Or if you wanted to perform roughly the same operation on all four party frame pedestals then:
Code:
for id = 1, 4 do
	local frame = _G['GrimUIPartyFrame' .. id]
	local pedestal = frame.pedestal
	pedestal:ClearAllPoints()
	pedestal:SetPoint('BOTTOMLEFT', frame.healthBar, 'BOTTOMRIGHT', 3, 0)
	pedestal:SetPoint('BOTTOMRIGHT', frame.manaBar, 'BOTTOMLEFT', -3, 0)
	pedestal:SetHeight(20)
end
  Reply With Quote
06-15-10, 01:28 PM   #6
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
its becoming clearer and clearer... working on redoing things still a couple complicated parts. Can the frame.blahblah be doubled over again for creating textures like frame.PedestalFrame.texture ? for doing the fontstrings and textures?

here is what i have going on so far for my base frame creation using what you posted this morning. im starting to just comment out my old stuff so i can see what i changed it from-to to get a better idea of whats going on. is what i have so far correct? this creates each party frame and all of each ones individual sub frames correct? edit -- and = 1, 4 do stands for 1-4?

lua Code:
  1. local function createPartyFrames(i)
  2.     -- Main Frame
  3.     local frame = CreateFrame("Frame", "GUI_Party" .. i .. "Frame", UIParent, "SecureUnitButtonTemplate")
  4.     frame.unit = "party" .. i
  5.     -- Pedestal Frame
  6.     --CreateFrame('Frame', "Party"..i.."PedestalFrame", _G["GUI_Party"..i.."Frame"])
  7.     frame.PedestalFrame = CreateFrame("Frame", nil, frame)
  8.     -- Health Bar
  9.     --CreateFrame('Button', "Party"..i.."HealthBorder", _G["GUI_Party"..i.."Frame"], "SecureActionButtonTemplate")
  10.     frame.HealthBorder = CreateFrame("button", nil, frame)
  11.     --CreateFrame("StatusBar", "Party"..i.."HealthBar", _G["GUI_Party"..i.."Frame"], "TextStatusBar")
  12.     frame.HealthBar = CreateFrame("StatusBar", nil, frame)
  13.     --CreateFrame("Frame", "Party"..i.."HealthNumTxtFrame", _G["GUI_Party"..i.."Frame"])
  14.     frame.HealthNumTxtFrame = CreateFrame("Frame", nil, frame)
  15.    
  16.     -- Mana Bar
  17.     --CreateFrame('Button', "Party"..i.."ManaBorder", _G["GUI_Party"..i.."Frame"], "SecureActionButtonTemplate")
  18.     frame.ManaBorder = CreateFrame("button", nil, frame)
  19.     --CreateFrame("StatusBar", "Party"..i.."ManaBar", _G["GUI_Party"..i.."Frame"], "TextStatusBar")
  20.     frame.ManaBar = CreateFrame("StatusBar", nil, frame)
  21.     --CreateFrame("Frame", "Party"..i.."ManaNumTxtFrame", _G["GUI_Party"..i.."Frame"])
  22.     frame.ManaNumTxtFrame = CreateFrame("Frame", nil, frame)
  23.    
  24.     -- Misc Frames
  25.     --CreateFrame("button", "Party"..i.."InfoTextFrame", _G["GUI_Party"..i.."Frame"], "SecureActionButtonTemplate")
  26.     frame.InfoTextFrame = CreateFrame("button", nil, frame)
  27.     --CreateFrame("Frame", "Party"..i.."LetterFrame", _G["GUI_Party"..i.."Frame"])
  28.     frame.LetterFrame = CreateFrame("Frame", nil, frame)
  29.     --CreateFrame("Frame", "Party"..i.."LeaderFrame", _G["GUI_Party"..i.."Frame"])
  30.     frame.LeaderFrame = CreateFrame("Frame", nil, frame)
  31.     --CreateFrame("Frame", "Party"..i.."pvpIconFrame", _G["GUI_Party"..i.."Frame"])
  32.     frame.pvpIconFrame = CreateFrame("Frame", nil, frame)
  33.     --CreateFrame("Frame", "Party"..i.."offDeadGhostTxtFrame", _G["GUI_Party"..i.."Frame"])
  34.     frame.offDeadGhostTxtFrame = CreateFrame("Frame", nil, frame)
  35.     -- Target Bar
  36.     --CreateFrame("frame", "targetOfParty"..i.."Frame", _G["GUI_Party"..i.."Frame"])
  37.     frame.targetOfFrame = CreateFrame("Frame", nil, frame)
  38.     --CreateFrame("button", "targetOfParty"..i.."ClickFrame", _G["GUI_Party"..i.."Frame"], "SecureActionButtonTemplate")
  39.     frame.targetOfClickFrame = CreateFrame("button", nil, frame)
  40. end
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 06-15-10 at 01:37 PM.
  Reply With Quote
06-15-10, 01:33 PM   #7
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
hmm, couldn't you use "$parentPedestal" etc

EG.

Code:
function CreatePartyFrame(id)   
   local f = CreateFrame("Frame","Party"..id,..)
   f.PartyID = "Party"..id
   f.Pedestal = CreateFrame("Frame","$parentPedestal",f,...)
   f.Pet = CreateFrame("Frame","$parentPet",f,...)
   etc
   return f
end

CreatePartyFrame(1)
CreatePartyFrame(2)
etc

EDIT: Just read your last post, and yes that is similar to how I deal with frames within frames. And yes, you can drill down further and access sub frames of sub frames like frame.pedestal.texture.overlay.etc

Originally Posted by Grimsin View Post
part of the problem is i dont think the frame.pedestal part will work because the style selection function looks for Party1PedestalFrame to do a bunch of things to that frame...

what really makes this complicated is the style1 and style2 functions... whitch is why i global named so many things because when i do local and dont set a name for something in its global name space ("frame", namethatgoesinGnamespace, parent, inherit)

it does not seem able to find the right stuff later for the style functions. although i have this idea on the tip of my tongue and i think its what you would say to do... lol... what i think needs to be done is i remove the party1 part from all the stuff in the style function and replace it with frame.* something i think im a little unclear on when it comes to frame creation. So lets say i do what you had posted above, and cargor also sent me a chunk of code that appears to do the same thing, it looks as though it makes the pedestal frame but never separates it other then the frame its originally created by IE frame.pedestal so what im wondering about is when it makes the 2nd frame.pedestal for party2 technically pedestal frame will have the same name as party1. so when you do the frame. is that making it a child of party1 frame? and is it going to know that the pedestal frame for party1 is dif then the one for party two even though they have the same name? edit -- or no name at all?

also i take it that "party" .. i is another means of setting the variable, just like for other things its "..i.."? and frame.unit is that like setting the unit attrib? i dont understand how that translates to local Party1Exists = UnitExists("Party1")? edit-- i see now how it hooks the unit.
__________________

Last edited by Xrystal : 06-15-10 at 01:35 PM.
  Reply With Quote
06-15-10, 01:38 PM   #8
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Originally Posted by Xrystal View Post
hmm, couldn't you use "$parentPedestal" etc
<snip>
No. This isn't XML.
__________________
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
06-15-10, 01:41 PM   #9
nightcracker
A Molten Giant
 
nightcracker's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 716
Originally Posted by Torhal View Post
No. This isn't XML.
BEEEEEEEP

Yes you can.

Try this for example:
Code:
CreateFrame("Frame", "$parentTest", UIParent)
print(UIParentTest)
Except for creating a virtual frame and making bindings EVERYTHING in XML can be done in Lua.

@vrul: GTFO from my avatar
__________________
Three things are certain,
Death, taxes and site not found,
You, victim of one.
  Reply With Quote
06-15-10, 01:51 PM   #10
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
*ahem*

manners....
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
06-15-10, 02:28 PM   #11
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
okay so i can add this to my frame creation part and create the font strings?

frame.HealthBorder.percentPartyHText = CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")

and what about textures? does this count?
frame.PedestalFrame.texture = frame.PedestalFrame:CreateTexture()
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 06-15-10 at 02:31 PM.
  Reply With Quote
06-15-10, 02:45 PM   #12
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
okay heres what i got going now, hopefully thats all valid for the textures and the fonts?

lua Code:
  1. local function createPartyFrames(i)
  2.    
  3.     -- Main Frame
  4.     local frame = CreateFrame("Frame", "GUI_Party" .. i .. "Frame", UIParent, "SecureUnitButtonTemplate")
  5.     frame.unit = "party" .. i
  6.    
  7.     -- Pedestal Frame
  8.     frame.PedestalFrame = CreateFrame("Frame", nil, frame)
  9.    
  10.     -- Health Bar
  11.     frame.HealthBorder = CreateFrame("button", nil, frame)
  12.     frame.HealthBar = CreateFrame("StatusBar", nil, frame)
  13.     frame.HealthNumTxtFrame = CreateFrame("Frame", nil, frame)
  14.    
  15.     -- Mana Bar
  16.     frame.ManaBorder = CreateFrame("button", nil, frame)
  17.     frame.ManaBar = CreateFrame("StatusBar", nil, frame)
  18.     frame.ManaNumTxtFrame = CreateFrame("Frame", nil, frame)
  19.    
  20.     -- Misc Frames
  21.     frame.InfoTextFrame = CreateFrame("button", nil, frame)
  22.     frame.LetterFrame = CreateFrame("Frame", nil, frame)
  23.     frame.LeaderFrame = CreateFrame("Frame", nil, frame)
  24.     frame.pvpIconFrame = CreateFrame("Frame", nil, frame)
  25.     frame.offDeadGhostTxtFrame = CreateFrame("Frame", nil, frame)
  26.    
  27.     -- Target Bar
  28.     frame.targetOfFrame = CreateFrame("Frame", nil, frame)
  29.     frame.targetOfClickFrame = CreateFrame("button", nil, frame)
  30.    
  31.     -- texture creation
  32.     frame.PedestalFrame.texture = frame.PedestalFrame:CreateTexture()
  33.     frame.LeaderFrame.texture = frame.LeaderFrame:CreateTexture()
  34.     frame.pvpIconFrame.texture = frame.pvpIconFrame:CreateTexture()
  35.     frame.targetOfFrame.texture = frame.targetOfPartyFrame:CreateTexture(nil, "BACKGROUND")
  36.  
  37.     -- font creation
  38.     frame.HealthBorder.percentPartyHText = frame.HealthBorder:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  39.     frame.ManaBorder.percentMText = frame.ManaBorder:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  40.     frame.InfoTextFrame.NameText = frame.InfoTextFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  41.     frame.LetterFrame.LetterHText = frame.LetterFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  42.     frame.LetterFrame.LetterMText = frame.LetterFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  43.     frame.HealthNumTxtFrame.chnumtxt = frame.HealthNumTxtFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  44.     frame.HealthNumTxtFrame.mhnumtxt = frame.HealthNumTxtFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  45.     frame.ManaNumTxtFrame.CMNumTxt = frame.ManaNumTxtFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  46.     frame.ManaNumTxtFrame.MMNumTxt = frame.ManaNumTxtFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  47.     frame.InfoTextFrame.LvlClassText = frame.InfoTextFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  48.     frame.offDeadGhostTxtFrame.DeadOfflineTxt = frame.offDeadGhostTxtFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  49.     frame.targetOfFrame.targetOfText = frame.targetOfFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  50. end
  51.  
  52. for id = 1, 4 do
  53.     createPartyFrame(id)
  54. end
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
06-15-10, 03:29 PM   #13
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
okay here we go... i think i got the idea... this is where im at right now. anyone see anything wrong with what im doing? i have not tested it yet about to do so although i know other problems exists in the code beyond this that will most likely prevent me from seeing if this will work... anyhow heres what i got goin on.

lua Code:
  1. local function createPartyFrames(i)
  2.    
  3.     -- Main Frame
  4.     local frame = CreateFrame("Frame", "GUI_Party" .. i .. "Frame", UIParent, "SecureUnitButtonTemplate")
  5.     frame.unit = "party" .. i
  6.    
  7.     -- Pedestal Frame
  8.     frame.PedestalFrame = CreateFrame("Frame", nil, frame)
  9.    
  10.     -- Health Bar
  11.     frame.HealthBorder = CreateFrame("button", nil, frame)
  12.     frame.HealthBar = CreateFrame("StatusBar", nil, frame)
  13.     frame.HealthNumTxtFrame = CreateFrame("Frame", nil, frame)
  14.    
  15.     -- Mana Bar
  16.     frame.ManaBorder = CreateFrame("button", nil, frame)
  17.     frame.ManaBar = CreateFrame("StatusBar", nil, frame)
  18.     frame.ManaNumTxtFrame = CreateFrame("Frame", nil, frame)
  19.    
  20.     -- Misc Frames
  21.     frame.InfoTextFrame = CreateFrame("button", nil, frame)
  22.     frame.LetterFrame = CreateFrame("Frame", nil, frame)
  23.     frame.LeaderFrame = CreateFrame("Frame", nil, frame)
  24.     frame.pvpIconFrame = CreateFrame("Frame", nil, frame)
  25.     frame.offDeadGhostTxtFrame = CreateFrame("Frame", nil, frame)
  26.    
  27.     -- Target Bar
  28.     frame.targetOfFrame = CreateFrame("Frame", nil, frame)
  29.     frame.targetOfClickFrame = CreateFrame("button", nil, frame)
  30.    
  31.     -- texture creation
  32.     frame.PedestalFrame.texture = frame.PedestalFrame:CreateTexture()
  33.     frame.LeaderFrame.texture = frame.LeaderFrame:CreateTexture()
  34.     frame.pvpIconFrame.texture = frame.pvpIconFrame:CreateTexture()
  35.     frame.targetOfFrame.texture = frame.targetOfPartyFrame:CreateTexture(nil, "BACKGROUND")
  36.  
  37.     -- font creation
  38.     frame.HealthBorder.percentHText = frame.HealthBorder:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  39.     frame.ManaBorder.percentMText = frame.ManaBorder:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  40.     frame.InfoTextFrame.NameText = frame.InfoTextFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  41.     frame.LetterFrame.LetterHText = frame.LetterFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  42.     frame.LetterFrame.LetterMText = frame.LetterFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  43.     frame.HealthNumTxtFrame.chnumtxt = frame.HealthNumTxtFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  44.     frame.HealthNumTxtFrame.mhnumtxt = frame.HealthNumTxtFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  45.     frame.ManaNumTxtFrame.CMNumTxt = frame.ManaNumTxtFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  46.     frame.ManaNumTxtFrame.MMNumTxt = frame.ManaNumTxtFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  47.     frame.InfoTextFrame.LvlClassText = frame.InfoTextFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  48.     frame.offDeadGhostTxtFrame.DeadOfflineTxt = frame.offDeadGhostTxtFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  49.     frame.targetOfFrame.targetOfText = frame.targetOfFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  50. end
  51.  
  52. for id = 1, 4 do
  53.     createPartyFrame(id)
  54. end
  55.  
  56. local function PFClearAllPoints(id)
  57.  
  58.     local frame = _G['GrimUIPartyFrame' .. id]
  59.     -- frames
  60.     frame.PedestalFrame:ClearAllPoints()
  61.     frame.HealthBorder:ClearAllPoints()
  62.     frame.HealthBar:ClearAllPoints()
  63.     frame.ManaBorder:ClearAllPoints()
  64.     frame.ManaBar:ClearAllPoints()
  65.     frame.InfoTextFrame:ClearAllPoints()
  66.     frame.LetterFrame:ClearAllPoints()
  67.     frame.HealthNumTxtFrame:ClearAllPoints()
  68.     frame.ManaNumTxtFrame:ClearAllPoints()
  69.     frame.LeaderFrame:ClearAllPoints()
  70.     frame.pvpIconFrame:ClearAllPoints()
  71.     frame.offDeadGhostTxtFrame:ClearAllPoints()
  72.     frame.targetOfPartyFrame:ClearAllPoints()
  73.     frame.targetOfPartyClickFrame:ClearAllPoints()
  74.    
  75.     -- Textblocks
  76.     frame.HealthBorder.percentHText:ClearAllPoints()
  77.     frame.ManaBorder.percentMText:ClearAllPoints()
  78.     frame.InfoTextFrame.NameText:ClearAllPoints()
  79.     frame.LetterFrame.LetterHText:ClearAllPoints()
  80.     frame.LetterFrame.LetterMText:ClearAllPoints()
  81.     frame.HealthNumTxtFrame.chnumtxt:ClearAllPoints()
  82.     frame.HealthNumTxtFrame.mhnumtxt:ClearAllPoints()
  83.     frame.ManaNumTxtFrame.CMNumTxt:ClearAllPoints()
  84.     frame.ManaNumTxtFrame.MMNumTxt:ClearAllPoints()
  85.     frame.InfoTextFrame.LvlClassText:ClearAllPoints()
  86.     frame.offDeadGhostTxtFrame.DeadOfflineTxt:ClearAllPoints()
  87.     frame.targetOfFrame.targetOfText:ClearAllPoints()
  88.    
  89.     -- Textures
  90.     frame.targetOfFrame.texture:ClearAllPoints()
  91. end
  92.  
  93. --########################################################################
  94. --#######                 PARTY STYLES START                 ############
  95. --########################################################################
  96.  
  97. -----------------------------
  98. -- Grim Layout Style 1 ------------
  99. -----------------------------
  100.  
  101. local function GrimStyle1(id)
  102.    
  103.     local frame = _G['GrimUIPartyFrame' .. id]
  104.    
  105.     -- ClearAllPoints for all frames in this style.
  106.     PFClearAllPoints(id)
  107.    
  108.     --Party1 main frame set height/width start
  109.     frame:SetWidth(223)
  110.     frame:SetHeight(135)
  111.  
  112.     --Party1 pedestal
  113.    
  114.     frame.PedestalFrame:SetPoint("BOTTOM", "GUI_Party"..i.."Frame", "BOTTOM", -62, 0)
  115.     frame.PedestalFrame:SetHeight(15)
  116.     frame.PedestalFrame:SetWidth(49)
  117.     frame.PedestalFrame.texture:SetAllPoints(PedestalFrame)
  118.     frame.PedestalFrame.texture:SetTexture("Interface\\AddOns\\!GrimUI\\Art\\pedestal.tga")
  119.     frame.PedestalFrame:SetFrameStrata("LOW")
  120.     frame.PedestalFrame:SetFrameLevel("2")
  121.  
  122.     -- party 1 health bar start
  123.     frame.HealthBorder:SetHeight(100)
  124.     frame.HealthBorder:SetWidth(31)
  125.     frame.HealthBorder:SetPoint("BOTTOMLEFT", "GUI_Party"..i.."Frame", "BOTTOMLEFT", 0, 0)
  126.     frame.HealthBorder:SetBackdrop{
  127.             bgFile = nil,
  128.             edgeFile = "Interface/DialogFrame/UI-DialogBox-Border", tile = false, tileSize = 0, edgeSize = 5,
  129.             insets = { left = 0, right = 0, top = 0, bottom = 0 }
  130.         }
  131.     frame.HealthBorder:SetBackdropBorderColor(0, 0, 0, 1)
  132.     frame.HealthBorder:SetFrameStrata("BACKGROUND")
  133.     frame.HealthBorder:SetFrameLevel("3")
  134.     frame.HealthBorder:RegisterForClicks("AnyUp")
  135.     frame.HealthBorder:SetAttribute("unit", "Party1")
  136.     frame.HealthBorder:SetAttribute("*type1", "target")
  137.  
  138.     local showPartymenu = ToggleDropDownMenu(1, nil, "PartyMemberFrame"..id.."DropDown", "cursor", 0, 0)
  139.  
  140.     frame.HealthBorder.showPartymenu = showPartymenu
  141.     frame.HealthBorder.unit = "party" .. id
  142.     frame.HealthBorder:SetAttribute("*type2", "showPartymenu")
  143.     frame.HealthBorder:SetScript("OnEnter", UnitFrame_OnEnter)
  144.     frame.HealthBorder:SetScript("OnLeave", UnitFrame_OnLeave)
  145.     frame.HealthBorder:SetFrameStrata("HIGH")
  146.     frame.HealthBorder:SetFrameLevel("2")
  147.  
  148.     frame.HealthBar:SetWidth(29)
  149.     frame.HealthBar:SetHeight(98)
  150.     frame.HealthBar:SetPoint("CENTER", HealthBorder, "CENTER", 0, 0)
  151.     frame.HealthBar:SetStatusBarTexture("Interface\\AddOns\\!GrimUI\\Art\\VBarTexture.tga")
  152.     frame.HealthBar:SetStatusBarColor(.231, .682, .419, 1)
  153.     frame.HealthBar:SetOrientation("VERTICAL")
  154.     frame.HealthBar:SetFrameStrata("BACKGROUND")
  155.     frame.HealthBar:SetFrameLevel("2")
  156.    
  157.     frame.HealthBarpercentHText:SetPoint("TOP", HealthBorder, "TOP", 0, -1)
  158.     frame.HealthBarpercentHText:SetTextColor(1, 1, 1, 1)
  159.     frame.HealthBarpercentHText:SetFont("Interface\\AddOns\\!GrimUI\\Fonts\\GrimUI_Font1.ttf", 10, "NORMAL")
  160.  
  161. ----------------------------------
  162. -- party 1 health bar end
  163. -----------------------------------
  164. end
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
06-15-10, 03:35 PM   #14
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
What looks strange is that there's so many "sub-frames" being created. A lot of things could probably just be FontStrings or Textures can't they ?
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.
  Reply With Quote
06-15-10, 03:53 PM   #15
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Originally Posted by v6o View Post
What looks strange is that there's so many "sub-frames" being created. A lot of things could probably just be FontStrings or Textures can't they ?
hmm well as far as i know most of them are necisary in order to do the dif frame styles. also in order to make text set positioning right ive found its best to make a frame just for the text that you can then anchor to each side and top of then use justify and itll make test always span one direction or the other according to its setpoint and itll autotrunct beyond its frames setpoints
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
06-15-10, 04:20 PM   #16
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
got a problem... i think.

so if i use the self in a function that is responding to events and the function is only used in the onevent script of a frame that is outside the initial frame creation code.... it wont recognize self as the party frames right? the partyframe has to run the code somehow?

like i fixed the name coloring code to read as follows i think this is how it should be set up per everyone's instructions ill do my best to show it here in proper order...

so here is the name coloring code
lua Code:
  1. function GrimUI:PartyNameColoring(self)
  2.    
  3.  
  4.     if UnitExists(self.unit) == 1 then
  5.          self.InfoTextFrame.NameText:SetFormattedText("%s", UnitName(self.unit))
  6.     end
  7.    
  8.    
  9.     if event == "PLAYER_ENTERING_WORLD" then
  10.         if UnitThreatSituation(self.unit) == nil then
  11.         self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
  12.         else
  13.         self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
  14.         end
  15.        
  16.         if UnitAffectingCombat(self,unit) == nil then
  17.         self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
  18.         else
  19.         self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
  20.         end
  21.    
  22.     end
  23.    
  24.     if event == "UNIT_FLAGS" then
  25.         if UnitThreatSituation(self.unit) == nil then
  26.         self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
  27.         else
  28.        
  29.         self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
  30.         end
  31.        
  32.         if UnitAffectingCombat(self,unit) == nil then
  33.         self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
  34.         else
  35.         self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
  36.         end
  37.     end
  38.    
  39.     if event == "UNIT_THREAT_LIST_UPDATE" then
  40.         if UnitThreatSituation(self.unit) == nil then
  41.         self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
  42.         else
  43.        
  44.         self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
  45.         end
  46.         if UnitAffectingCombat(self,unit) == nil then
  47.         self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
  48.         else
  49.         self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
  50.         end
  51.    
  52.     end
  53.    
  54.     if event == "UNIT_THREAT_SITUATION_UPDATE" then
  55.         if UnitThreatSituation(self.unit) == nil then
  56.         self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
  57.         else
  58.        
  59.         self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
  60.         end
  61.         if UnitAffectingCombat(self,unit) == nil then
  62.         self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
  63.         else
  64.         self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
  65.         end
  66.    
  67.     end
  68.  
  69.     if event == "UNIT_COMBAT" then
  70.         if UnitThreatSituation(self.unit) == nil then
  71.         self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
  72.         else
  73.        
  74.         self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
  75.         end
  76.         if UnitAffectingCombat(self,unit) == nil then
  77.         self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
  78.         else
  79.         self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
  80.         end
  81.     end
  82. end

now here is the function thats been made to call it

lua Code:
  1. function GrimUI.PartyNameTextEvents(self)
  2.     if UnitExists(self.unit) == 1 then
  3.         self.NameText:SetFormattedText("%s", UnitName(self.unit))
  4.     end
  5.     self:PartyNameColoring()
  6. end

now here is what calls that function

lua Code:
  1. GUINameTextEvents:SetScript("OnEvent", function()
  2.     GrimUI.PartyNameTextEvents()
  3. end)

now here is ultimately where i think the big mistake is and maybe it is as easy as parenting the event frames to the party frames in some way? or adding them to the frame creation part? im not sure how that would go... but here is what it is currently, clearly it has no link with the partyframes themselves other then to initiate the event scripts

lua Code:
  1. local GUINameTextEvents = CreateFrame("Frame", nil, UIParent)
  2. GUINameTextEvents:RegisterEvent("PLAYER_ENTERING_WORLD")
  3. GUINameTextEvents:RegisterEvent("PARTY_MEMBERS_CHANGED")
  4. GUINameTextEvents:RegisterEvent("UNIT_NAME_UPDATE")
  5. GUINameTextEvents:RegisterEvent("UNIT_FLAGS")
  6. GUINameTextEvents:RegisterEvent("UNIT_THREAT_LIST_UPDATE")
  7. GUINameTextEvents:RegisterEvent("UNIT_THREAT_SITUATION_UPDATE")
  8. GUINameTextEvents:RegisterEvent("UNIT_COMBAT")
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
06-15-10, 04:48 PM   #17
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
What you could also do is have the individual frames monitor their own events.

Eg:
HealthBar:RegisterEvent("UNIT_HEALTH")
ManaBar:RegisterEvent("UNIT_MANA")
etc
__________________
  Reply With Quote
06-15-10, 04:57 PM   #18
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
What Xrystal said is the easiest way to handle multiple frames; let them handle their own events.


And for the "self error"; You're doing it wrong here. You're not passing self as the first argument.
GUINameTextEvents:SetScript("OnEvent", function()
GrimUI.PartyNameTextEvents()
end)
should be
GUINameTextEvents:SetScript("OnEvent", GrimUI.PartyNameTextEvents)

No point creating the small extra function, this also passes all arguments.
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.

Last edited by v6o : 06-15-10 at 05:02 PM.
  Reply With Quote
06-15-10, 04:58 PM   #19
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
yea i think that is how i just did it, although i was under the idea that events only fire to uiparent and you cant register events to a frame that does not parent to UIParent but... were gonna try having the events on their individual frames. i think in theory this will make it so that the frames will fire for only events that should trigger them rather then say every frame updating its target because party member 1 changed targets. i could be wrong on all of this though... maybe Vrul will chime in again soon.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
06-15-10, 05:02 PM   #20
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
i changed it up totally think this is what Xrystal was talking about

the frame creation

lua Code:
  1. local function createPartyFrames(i)
  2.    
  3.     -- Main Frame
  4.     local frame = CreateFrame("Frame", "GrimUIPartyFrame" .. i, UIParent, "SecureUnitButtonTemplate")
  5.     frame.unit = "party" .. i
  6.    
  7.     -- Pedestal Frame
  8.     frame.PedestalFrame = CreateFrame("Frame", nil, frame)
  9.    
  10.     -- Health Bar
  11.     frame.HealthBorder = CreateFrame("button", nil, frame)
  12.     frame.HealthBar = CreateFrame("StatusBar", nil, frame)
  13.     frame.HealthNumTxtFrame = CreateFrame("Frame", nil, frame)
  14.    
  15.     -- Mana Bar
  16.     frame.ManaBorder = CreateFrame("button", nil, frame)
  17.     frame.ManaBar = CreateFrame("StatusBar", nil, frame)
  18.     frame.ManaNumTxtFrame = CreateFrame("Frame", nil, frame)
  19.    
  20.     -- Misc Frames
  21.     frame.InfoTextFrame = CreateFrame("button", nil, frame)
  22.     frame.LetterFrame = CreateFrame("Frame", nil, frame)
  23.     frame.LeaderFrame = CreateFrame("Frame", nil, frame)
  24.     frame.pvpIconFrame = CreateFrame("Frame", nil, frame)
  25.     frame.offDeadGhostTxtFrame = CreateFrame("Frame", nil, frame)
  26.    
  27.     -- Target Bar
  28.     frame.targetOfFrame = CreateFrame("Frame", nil, frame)
  29.     frame.targetOfClickFrame = CreateFrame("button", nil, frame)
  30.    
  31.     -- texture creation
  32.     frame.PedestalFrame.texture = frame.PedestalFrame:CreateTexture()
  33.     frame.LeaderFrame.texture = frame.LeaderFrame:CreateTexture()
  34.     frame.pvpIconFrame.texture = frame.pvpIconFrame:CreateTexture()
  35.     frame.targetOfFrame.texture = frame.targetOfPartyFrame:CreateTexture(nil, "BACKGROUND")
  36.  
  37.     -- font creation
  38.     frame.HealthBorder.percentHText = frame.HealthBorder:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  39.     frame.ManaBorder.percentMText = frame.ManaBorder:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  40.     frame.InfoTextFrame.NameText = frame.InfoTextFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  41.     frame.LetterFrame.LetterHText = frame.LetterFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  42.     frame.LetterFrame.LetterMText = frame.LetterFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  43.     frame.HealthNumTxtFrame.chnumtxt = frame.HealthNumTxtFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  44.     frame.HealthNumTxtFrame.mhnumtxt = frame.HealthNumTxtFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  45.     frame.ManaNumTxtFrame.CMNumTxt = frame.ManaNumTxtFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  46.     frame.ManaNumTxtFrame.MMNumTxt = frame.ManaNumTxtFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  47.     frame.InfoTextFrame.LvlClassText = frame.InfoTextFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  48.     frame.offDeadGhostTxtFrame.DeadOfflineTxt = frame.offDeadGhostTxtFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  49.     frame.targetOfFrame.targetOfText = frame.targetOfFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  50.  
  51.     -- event frames
  52.     frame.GUIHealthEvents = CreateFrame("Frame", nil, frame)
  53.     frame.GUIManaEvents = CreateFrame("Frame", nil, frame)
  54.     frame.GUINameTextEvents = CreateFrame("Frame", nil, frame)
  55.     frame.GUILvlClassTextEvents = CreateFrame("frame", nil, frame)
  56.     frame.GUIPartyLeaderEvent = CreateFrame("Frame", nil, frame)
  57.     frame.GUIpvpIconEvent = CreateFrame("Frame", nil, frame)
  58.     frame.GUIOffLineDeadEvents = CreateFrame("Frame", nil, frame)
  59.     frame.GUItargetOfFrameEvents = CreateFrame("frame", nil, frame)
  60.    
  61. end
  62.  
  63. for id = 1, 4 do
  64.     createPartyFrame(id)
  65. end

here is the event registration to each frame

lua Code:
  1. local function GUIRegisterPartyEvents(id)
  2. -- Health Events
  3.     local frame = _G['GrimUIPartyFrame' .. id]
  4.     frame.GUIHealthEvents:RegisterEvent("PLAYER_ENTERING_WORLD")
  5.     frame.GUIHealthEvents:RegisterEvent("UNIT_HEALTH")
  6.     frame.GUIHealthEvents:RegisterEvent("UNIT_LEVEL")
  7.     frame.GUIHealthEvents:RegisterEvent("UNIT_AURA")
  8.     frame.GUIHealthEvents:RegisterEvent("UNIT_MAXHEALTH")
  9.     frame.GUIHealthEvents:RegisterEvent("PARTY_MEMBERS_CHANGED")
  10.  
  11. -- Mana Events
  12.     frame.GUIManaEvents.RegisterEvents = GrimUI.RegisterEvents
  13.     frame.GUIManaEvents:RegisterEvents('PLAYER_ENTERING_WORLD', 'PARTY_MEMBERS_CHANGED', 'UNIT_HEALTH', 'UNIT_LEVEL', 'UNIT_MANA', 'UNIT_AURA','UNIT_DISPLAYPOWER', 'UNIT_ENERGY', 'UNIT_MAXENERGY', 'UNIT_MAXMANA', 'UNIT_MAXRUNICPOWER', 'UNIT_RUNIC_POWER', 'UNIT_RAGE')
  14.  
  15.     frame.GUINameTextEvents:RegisterEvent("PLAYER_ENTERING_WORLD")
  16.     frame.GUINameTextEvents:RegisterEvent("PARTY_MEMBERS_CHANGED")
  17.     frame.GUINameTextEvents:RegisterEvent("UNIT_NAME_UPDATE")
  18.     frame.GUINameTextEvents:RegisterEvent("UNIT_FLAGS")
  19.     frame.GUINameTextEvents:RegisterEvent("UNIT_THREAT_LIST_UPDATE")
  20.     frame.GUINameTextEvents:RegisterEvent("UNIT_THREAT_SITUATION_UPDATE")
  21.     frame.GUINameTextEvents:RegisterEvent("UNIT_COMBAT")
  22.  
  23.     frame.GUILvlClassTextEvents:RegisterEvent("PLAYER_ENTERING_WORLD")
  24.     frame.GUILvlClassTextEvents:RegisterEvent("PARTY_MEMBERS_CHANGED")
  25.     frame.GUILvlClassTextEvents:RegisterEvent("UNIT_LEVEL")
  26.  
  27.     frame.GUIPartyLeaderEvent:RegisterEvent("PLAYER_ENTERING_WORLD")
  28.     frame.GUIPartyLeaderEvent:RegisterEvent("PARTY_LEADER_CHANGED")
  29.     frame.GUIPartyLeaderEvent:RegisterEvent("PARTY_MEMBERS_CHANGED")
  30.     frame.GUIPartyLeaderEvent:RegisterEvent("ZONE_CHANGED_NEW_AREA")
  31.  
  32.     frame.GUIpvpIconEvent:RegisterEvent("PLAYER_ENTERING_WORLD")
  33.     frame.GUIpvpIconEvent:RegisterEvent("UNIT_FACTION")
  34.     frame.GUIpvpIconEvent:RegisterEvent("PARTY_MEMBERS_CHANGED")
  35.     frame.GUIpvpIconEvent:RegisterEvent("UNIT_DYNAMIC_FLAGS")
  36.  
  37.     frame.GUIOffLineDeadEvents.RegisterEvents = GrimUI.RegisterEvents
  38.     frame.GUIOffLineDeadEvents:RegisterEvents('PLAYER_ENTERING_WORLD', 'PARTY_MEMBERS_CHANGED', 'PARTY_MEMBER_DISABLE', 'PARTY_MEMBER_ENABLE', 'UNIT_HEALTH')
  39.  
  40.     frame.GUItargetOfFrameEvents.RegisterEvents = GrimUI.RegisterEvents
  41.     frame.GUItargetOfFrameEvents:RegisterEvents('PLAYER_ENTERING_WORLD', 'PARTY_MEMBERS_CHANGED', 'PARTY_LEADER_CHANGED', 'PLAYER_TARGET_CHANGED', 'UNIT_TARGET')
  42. end
  43.  
  44. for id = 1, 4 do
  45.     GUIRegisterPartyEvents(id)
  46. end

here is the new setscript

lua Code:
  1. local function GUISetPartyEventScripts(id)
  2.     local frame = _G['GrimUIPartyFrame' .. id]
  3.     frame.GUIHealthEvents:SetScript("OnEvent", function(self)
  4.         GrimUI.HealthEventFunc(self)
  5.     end)
  6.  
  7.     frame.GUIManaEvents:SetScript("OnEvent", function(self)
  8.         GrimUI.ManaEventFunc(self)
  9.     end)
  10.    
  11.     frame.GUINameTextEvents:SetScript("OnEvent", function(self)
  12.     GrimUI.PartyNameTextEvents(self)
  13.     end)
  14.    
  15.     frame.GUILvlClassTextEvents:SetScript("OnEvent", function(self)
  16.         GrimUI.LvlClassTextEvents(self)
  17.     end)
  18.     frame.GUIpvpIconEvent:SetScript("OnEvent", function(self)
  19.         GrimUI.pvpIconEvent(self)
  20.     end)
  21.     frame.GUIPartyLeaderEvent:SetScript("OnEvent", function(self)
  22.         GrimUI.PartyLeaderEvent(self)
  23.     end)
  24.     frame.GUIOffLineDeadEvents:SetScript("OnEvent", function(self)
  25.         GrimUI.DeadOffLineEvents(self)
  26.     end)
  27.  
  28.     frame.GUItargetOfFrameEvents:SetScript("OnEvent", function(self)
  29.         GrimUI.TargEventFunc(self)
  30.     end)
  31. end
  32.  
  33. for id = 1, 4 do
  34.     GUISetPartyEventScripts(id)
  35. end
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 06-15-10 at 05:05 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » breaking it down.

Thread Tools
Display Modes

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