Thread Tools Display Modes
01-13-18, 03:20 PM   #1
Tim
A Rage Talon Dragon Guard
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 309
oUF Style already registered..

I can't figure out for the life of me how to fix that error.

oUF: Error: Style [LiteUI_Boss] already registered.

Code:
local addon, ns = ...
local E, C, M, UF, oUF = ns.E, ns.C, ns.M, ns.UF, ns.oUF


if not C.SETTINGS.units.boss.enabled then return end


local CreateBoss = function(self)

   local unit = "boss"

   self:SetSize(112, 47)
   self:SetFrameLevel(3)

   UF.CreateHealth(self, unit, 107, 32, "CENTER", "CENTER", -2, 8)
   UF.CreatePower(self, unit, 87, 5, "CENTER", "CENTER", 2, -20)

   UF.CreateNameText(self, "LEFT", "LEFT", 4, 15, 11, "OUTLINE", "LEFT")
   UF.CreateHealthTextPercent(self, "RIGHT", "RIGHT", 0, -6, 11, "OUTLINE", "RIGHT")

   UF.CreateArtwork(self, unit)

   UF.CreateRaidIcon(self, "BOTTOM", "TOP", 0, 14)

   UF.SetTooltip(self, unit)

end



oUF:RegisterStyle(addon.."_Boss", CreateBoss)
oUF:SetActiveStyle(addon.."_Boss")

local boss = {}

for i = 1, MAX_BOSS_FRAMES do

   boss[i] = oUF:Spawn("boss"..i, addon.."_Boss"..i)

   if (i == 1) then

      boss[i]:SetPoint(unpack(C.SETTINGS.units.boss.pos))

   else

      boss[i]:SetPoint("TOP", boss[i-1], "BOTTOM", 0, -10)

   end

end
__________________
AddOns: Tim @ WoWInterface
Battle Tag: Mysterio#11164
Current PC Setup: PCPartPicker List
  Reply With Quote
01-13-18, 04:29 PM   #2
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
Are you sure that that's the only place w/:

Lua Code:
  1. oUF:RegisterStyle(addon.."_Boss", CreateBoss)

Might be a copypasta elsewhere
__________________

Last edited by lightspark : 01-13-18 at 04:32 PM.
  Reply With Quote
01-13-18, 04:34 PM   #3
Tim
A Rage Talon Dragon Guard
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 309
Yep, that's the only instance of that line.
__________________
AddOns: Tim @ WoWInterface
Battle Tag: Mysterio#11164
Current PC Setup: PCPartPicker List
  Reply With Quote
01-13-18, 05:12 PM   #4
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
Hm, that's weird because that's the only reason why this could happen o_O

It means that a style w/ the same name was registered elsewhere.
__________________
  Reply With Quote
01-13-18, 05:16 PM   #5
Tim
A Rage Talon Dragon Guard
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 309
Yeah I know. I even looked at ouf.lua to see if I looked over something and was actually doing something wrong which I wasn't so I was stumped and posted here. The style for the boss frames do work 100% but, that error message annoys me and I wanted to see if there was some other solution. I may just go and edit the ouf file and comment out the error line, lol.
__________________
AddOns: Tim @ WoWInterface
Battle Tag: Mysterio#11164
Current PC Setup: PCPartPicker List
  Reply With Quote
01-13-18, 05:21 PM   #6
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
TBF, if I were you I'd add a bunch of prints w/ debugstacks to see what and where is registering styles

-- edit #1

I mean add the following code here:
Lua Code:
  1. print("style:", name)
  2. print(debugstack(2, 2, 0))

This way you'll be able to see from where RegisterStyle was called.
__________________

Last edited by lightspark : 01-13-18 at 05:44 PM.
  Reply With Quote
01-13-18, 05:44 PM   #7
Tim
A Rage Talon Dragon Guard
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 309
I had added prints in the for loop earlier and did notice it was basically looping through it twice. Perhaps that could be the cause of it?
__________________
AddOns: Tim @ WoWInterface
Battle Tag: Mysterio#11164
Current PC Setup: PCPartPicker List
  Reply With Quote
01-13-18, 05:53 PM   #8
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
Hm, given that your for loop isn't inside of any function, it means that your file is read more than once.

Are you sure that it isn't referred in an xml file or somewhere else more than once?

Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/">
	<Script file="file.lua"/>
	<Script file="file.lua"/>
</Ui>
The content of file.lua will be read twice in this case, and everything executable/callable will be executed/called twice as well.
__________________

Last edited by lightspark : 01-13-18 at 06:07 PM.
  Reply With Quote
01-13-18, 05:57 PM   #9
Tim
A Rage Talon Dragon Guard
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 309
LOL, that was it.. geeze I feel retarded, haha. ty <3
__________________
AddOns: Tim @ WoWInterface
Battle Tag: Mysterio#11164
Current PC Setup: PCPartPicker List
  Reply With Quote
01-13-18, 05:58 PM   #10
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
LOL YW
__________________
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF Style already registered..

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