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:
function GrimUI:PartyNameColoring(self)
if UnitExists(self.unit) == 1 then
self.InfoTextFrame.NameText:SetFormattedText("%s", UnitName(self.unit))
end
if event == "PLAYER_ENTERING_WORLD" then
if UnitThreatSituation(self.unit) == nil then
self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
else
self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
end
if UnitAffectingCombat(self,unit) == nil then
self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
else
self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
end
end
if event == "UNIT_FLAGS" then
if UnitThreatSituation(self.unit) == nil then
self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
else
self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
end
if UnitAffectingCombat(self,unit) == nil then
self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
else
self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
end
end
if event == "UNIT_THREAT_LIST_UPDATE" then
if UnitThreatSituation(self.unit) == nil then
self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
else
self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
end
if UnitAffectingCombat(self,unit) == nil then
self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
else
self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
end
end
if event == "UNIT_THREAT_SITUATION_UPDATE" then
if UnitThreatSituation(self.unit) == nil then
self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
else
self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
end
if UnitAffectingCombat(self,unit) == nil then
self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
else
self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
end
end
if event == "UNIT_COMBAT" then
if UnitThreatSituation(self.unit) == nil then
self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
else
self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
end
if UnitAffectingCombat(self,unit) == nil then
self.InfoTextFrame.NameText:SetTextColor(1, 1, 1, 1)
else
self.InfoTextFrame.NameText:SetTextColor(1, 0, 0, 1)
end
end
end
now here is the function thats been made to call it
lua Code:
function GrimUI.PartyNameTextEvents(self)
if UnitExists(self.unit) == 1 then
self.NameText:SetFormattedText("%s", UnitName(self.unit))
end
self:PartyNameColoring()
end
now here is what calls that function
lua Code:
GUINameTextEvents:SetScript("OnEvent", function()
GrimUI.PartyNameTextEvents()
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:
local GUINameTextEvents = CreateFrame("Frame", nil, UIParent)
GUINameTextEvents:RegisterEvent("PLAYER_ENTERING_WORLD")
GUINameTextEvents:RegisterEvent("PARTY_MEMBERS_CHANGED")
GUINameTextEvents:RegisterEvent("UNIT_NAME_UPDATE")
GUINameTextEvents:RegisterEvent("UNIT_FLAGS")
GUINameTextEvents:RegisterEvent("UNIT_THREAT_LIST_UPDATE")
GUINameTextEvents:RegisterEvent("UNIT_THREAT_SITUATION_UPDATE")
GUINameTextEvents:RegisterEvent("UNIT_COMBAT")