Hey,
while adding stats to the gamepad UI stat screen, I encountered an error that I don't understand.
I created the new labels and added the needed variables into ZO_GamepadStats:InitializeCharacterStats():
Lua Code:
local gamepadStatsLC = ZO_GamepadStatsTopLevelRightPaneInfoPanelCharacterStatsPanelLeftColumn
local gamepadStatsRC = ZO_GamepadStatsTopLevelRightPaneInfoPanelCharacterStatsPanelRightColumn
local spellPenHeader = CreateControlFromVirtual("SpellPenetrationHeader", gamepadStatsLC, "ZO_GamepadStatsHeaderTemplate")
spellPenHeader:ClearAnchors()
spellPenHeader:SetAnchor(TOPLEFT, ZO_GamepadStatsTopLevelRightPaneInfoPanelCharacterStatsPanelLeftColumnRidingSpeedHeader, BOTTOMLEFT, 0, 90)
local spellPenData = CreateControlFromVirtual("SpellPenetration", gamepadStatsLC, "ZO_GamepadStatsDataTemplate")
spellPenData:ClearAnchors()
spellPenData:SetAnchor(TOPRIGHT, ZO_GamepadStatsTopLevelRightPaneInfoPanelCharacterStatsPanelLeftColumnRidingSpeed, BOTTOMRIGHT, 0, 90)
local physPenHeader = CreateControlFromVirtual("PhysicalPenetrationHeader", gamepadStatsRC, "ZO_GamepadStatsHeaderTemplate")
physPenHeader:ClearAnchors()
physPenHeader:SetAnchor(TOPLEFT, ZO_GamepadStatsTopLevelRightPaneInfoPanelCharacterStatsPanelRightColumnRidingTrainingHeader, BOTTOMLEFT, 0, 50)
local physPenData = CreateControlFromVirtual("PhysicalPenetration", gamepadStatsRC, "ZO_GamepadStatsDataTemplate")
physPenData:ClearAnchors()
physPenData:SetAnchor(TOPRIGHT, ZO_GamepadStatsTopLevelRightPaneInfoPanelCharacterStatsPanelRightColumnRidingTrainingTimer, BOTTOMRIGHT, 0, 50)
local OrigInitializeCharacterStats = ZO_GamepadStats.InitializeCharacterStats
function ZO_GamepadStats:InitializeCharacterStats()
OrigInitializeCharacterStats(self)
if MitigationPercent.savedVariables.showPen then
self.spellPenetrationHeader = spellPenHeader
self.physicalPenetrationHeader = physPenHeader
--table.insert(self.headers, { label = self.SpellPenetrationHeader, stat = STAT_SPELL_PENETRATION })
--table.insert(self.headers, { label = self.PhysicalPenetrationHeader, stat = STAT_PHYSICAL_PENETRATION })
spellPenHeader:SetText("Focus Rating")
physPenHeader:SetText("Physical Penetration")
self.physicalPenetration = physPenData
self.spellPenetration = spellPenData
table.insert(self.statValues, { label = self.spellPenetration, stat = STAT_SPELL_PENETRATION })
table.insert(self.statValues, { label = self.physicalPenetration, stat = STAT_PHYSICAL_PENETRATION })
end
end
The values get updated and it works as it should, but when I add the headers (commented out) too, I get a "attempt to index nil value" error in zo_stats_gamepad.lua line 813:
Lua Code:
header.label:SetText(GetStatText(header.stat))
even if I use a stat that is already in the screen by default that happens. With SetText(as used currently) it works fine though. It's literally the same way I add the values, and they work, why isn't it working for the headers too? Do I miss something obvious?