for i=1, select("#", frame:GetChildren()) do
local ChildFrame = select(i, frame:GetChildren())
-- do whatever
end
for i=1, select("#", frame:GetRegions()) do
local ChildRegion = select(i, frame:GetChildren())
-- do whatever
end
Testing it is a pain because I have to actually queue for a BG to get meaningful data.
function f.SlashHandler(msg)
if msg == 'clear' then
wipe(BGESCT_Data)
else
for i = 1, select("#", BattleGroundEnemies:GetChildren()) do
local iFrame = select(i, BattleGroundEnemies:GetChildren())
for j = 1, select("#", iFrame:GetChildren()) do
local jFrame = select(j, jFrame:GetChildren())
if jFrame:GetName() == 'healthBar' then
tinsert(e, jFrame)
end
end
end
end
BGESCT_Data = CopyTable(e)
end
This is solely for diagnostic and proof-of-concept purposes.
I know that the target frames, the likely-unnamed ones, have a child frame formally named ‘healthBar’ do if the child of the child of the input frame has that then the child is my target frame, the one I want to add an overlay to.
This should at least capture one broken entry per player in the next BG I go into and from that I can derive that I have the correct frame objects stored in “e”.
“e” is defined earlier as an alias of a subtable of the addon data that’s available if you put local addonname, addondata = ... at the beginning of your module.
As implemented the frames change name every time. There is an unnamed frame on the way DOWN to the one that I’m interested in.
That gibberish between “.Enemies.” and “.healthBar” in my imgur link. That’s the piece I need.
Just realized I had put this all in as a note in the prior thread and didn’t repost the image when I moved it over.
https://imgur.com/a/dG7s650
My goal is to be able to table up the pointer to the frames themselves (right above healthBar and then establish parentage with the frame I want to tack on to it.
D’ot!
If I get BattleGroundEnemies.Enemies.<no name> I’m there. That’s the one I want.
Forget about “healthBar” - I think that’ll work.
If frame:GetFrameName() comes back nil, that’s my target frame.
…Players I can see in the dump. I don’t care about Players. I need access to the unnamed frames just below Enemies.
Please look at the snipped screenshot. The frame names are there.
I do not care about the health bar at all. It was just a way of knowing that the frame above it, which is unnamed, was the one I really wanted.
That said, I’m still not iterating through them correctly.
I’m sorry I ever mentioned “healthBar” - it’s irrelevant to what I’m doing other than as a way of identifying its PARENT.
The XML schema doesn’t reflect what’s actually doing on in the game.
Whether that’s a reflection on how f-awful XML is as a tool for this or on the coding skills of the gentleman who wrote BGE I can’t begin to determined.
The frame BattleGroundEnemies.Enemies is not specific to a single player. It’s a frame that contains (has as children) the frames I want.
THOSE frames are not named (I assume that’s why there’s gibberish where the names would otherwise be).
THOSE frames are the ones I need.
I got distracted by something shiny for a bit (Torghast). I’ll be back to testing my “how do I get a list of frames out of BattleGroundEnemies.Enemies when the frames aren’t named” sub-project in a bit.
Get them when they are created and hook up your “stuff” if you haven’t already
(it took me an age to realise BGE was an addon so I spent a while scratching my head).
local function OnShow(self)
self.Text:SetText(self:GetParent().Name:GetText())
end
local function CreateText(self)
local f = CreateFrame("Frame", nil, self)
f:SetPoint("TOPRIGHT")
f:SetPoint("BOTTOMLEFT", self, "BOTTOMRIGHT", -5, 0)
local l, s = self.Name:GetDrawLayer()
f.Text = f:CreateFontString(l, s and s+2 or 2)
f.Text:SetFontObject(GameFontNormal)
f.Text:SetPoint("RIGHT")
f.Text:SetJustifyH("RIGHT")
f:SetScript("OnShow", OnShow)
return f
end
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnEvent", function(self)
self:UnregisterAllEvents()
hooksecurefunc(BattleGroundEnemies.Enemies, "SetupButtonForNewPlayer", function(self) -- Enemy frames only
for k, v in pairs(self.Players) do
if not v.MyFrame then
v.MyFrame = CreateText(v) --v:CreateFontString() -- Instead of true, set MyFrame to Create your frame/fontstring etc.
end
end
end)
end)
I’ve just duplicated the name in gold on the right.
OnShow might not be what you want to use to update your “stuff” but…
I never leave frames unnamed for just this reason.
I’m attempting to access those frames through global space so I can anchor other frames to them.
Oh, this is hurting my brain.
Just the globals in that program, below Enemies node is 25,000 lines long in the dump.
Experimentation is rough because I have to be IN a BG to do so and doing that is problematic because it messes up other people’s play if I don’t participate fully.
Bugger. Test mode adds the frames outside BG.
Don’t get old. Seriously.
Wait!
Won’t this work
e = {BattleGroundEnemies.Enemies:GetChildren()}
Shouldn’t that give me a list of all of the frames underneath it?