Originally Posted by zork
NamePlate1 is not found. Script stops.
NamePlateIds start at 2xx in my case. Not sure why...it's just what the GetName() spits out.
|
The reason is because you did /reloads, and the game keeps continuing from where it left off before you did.
Unlike most frames, the nameplates are written (or wrapped) in C, and will not reload like the rest of the UI does.
Here is a way to counter this:
Lua Code:
local function Update(self)
-- do whatever
end
local index = 1
local fresh = true
local addon = CreateFrame('Frame')
addon:SetScript('OnUpdate', function()
while _G['NamePlate' .. index] or fresh do
local frame = _G['NamePlate' .. index]
if(frame) then
fresh = false
frame:HookScript('OnShow', Update)
Update(frame)
end
index = index + 1
end
end)
addon:Show()