Jump to content


Photo

[Fixed] Custom timer skins


  • Please log in to reply
13 replies to this topic

#1 Gethe

Gethe

    Glass Joe

  • Members
  • 6 posts

Posted 28 April 2014 - 04:51 AM

I'm making a timer skin using the DBT api, but I can't seem to get it to work. There isn't any skin option in the GUI, and when I try to set it with 

/run DBT:SetSkin("MyDBMSkin")

I get this error:

2x DBM-StatusBarTimers-5.4.13-35-gf2d0746\DBT.lua:522: bad argument #1 to "pairs" (table expected, got nil)
<in C code>
DBM-StatusBarTimers-5.4.13-35-gf2d0746\DBT.lua:522: in function "GetBarIterator"
DBM-StatusBarTimers-5.4.13-35-gf2d0746\DBT.lua:970: in function "SetSkin"
<string>:"DBT:SetSkin("MyDBMSkin")":1: in main chunk
<in C code>
FrameXML\ChatFrame.lua:2036: in function "?"
FrameXML\ChatFrame.lua:4315: in function "ChatEdit_ParseText"
FrameXML\ChatFrame.lua:3969: in function "ChatEdit_SendText"
FrameXML\ChatFrame.lua:4008: in function "ChatEdit_OnEnterPressed"
<string>:"*:OnEnterPressed":1: in function <string>:"*:OnEnterPressed":1

Locals:
self = <table> {
 GetOption = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:375
 UpdateBar = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:543
 SetAnnounceHook = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:1056
 GetSkins = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:1025
 GetTextures = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:1029
 ShowMovableBar = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:800
 GetDefaultOption = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:379
 SetOption = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:356
 CreateDummyBar = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:485
 New = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:312
 LoadOptions = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:341
 RegisterSkin = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:951
 CreateBar = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:404
 SavePosition = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:783
 ShowTestBars = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:558
 GetFonts = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:1033
 GetBarIterator = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:521
 CancelBar = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:533
 SetSkin = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:964
 GetBar = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:525
 ApplyStyle = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:850
}
pairs = <function> defined =[C]:-1

This is without anything other than bugsack/grabber (plus DBM and my addon ofc.) I am using the alpha DBM.



#2 MysticalOS

MysticalOS

    French Hacker

  • ♦ Administrators
  • 896 posts
  • LocationGeorgia

Posted 28 April 2014 - 05:17 AM

I can't see any reason that would happen, but that code never did get any testing. The problem is GetBarIterator is failing and that's impossible (or at least I've never seen that happen before). Maybe it has to be something with your skin that makes it possible to fail for some reason? I'd have to check your custom skin for errors or something.

 

Other then that I have no idea. Person who wrote that code doesn't work on dbm much anymore so it may never get fixed if it is on our end.

 

Maybe it will work better in 11230+. Or it'll be even worse. No telling. I basically just disabled the code that's failing and instead block setting skins in combat or if any timers are active.



#3 Gethe

Gethe

    Glass Joe

  • Members
  • 6 posts

Posted 28 April 2014 - 06:20 AM

Thanks for the response. I tried it out with the new build, but i'm now getting a new error.

1x DBM-StatusBarTimers-5.4.13-36-ga5863c3\DBT.lua:367: attempt to index field "options" (a nil value)

From what I can tell it's an improper use of "self", which in this case is referring to the table "DBT". The only things in the DBT table are the functions created in the file (as viewed from the addon Luabrowser), thus when it tries to call self.bar or self.options it fails.

 

You wouldn't have seen it fail before because it isn't used at all in DBM, just for the API.

 

For additional context and in the case that i'm flat out wrong (very possible), I have attached what i'm working on.

Attached Files



#4 MysticalOS

MysticalOS

    French Hacker

  • ♦ Administrators
  • 896 posts
  • LocationGeorgia

Posted 28 April 2014 - 06:42 AM

self SHOULD be DBT, and options shouldn't be nil. That's a proper usage of self there. The options table should be present at DBT.options and should never be nil. If they don't exist on load then they are created by DBT:LoadOptions

 

Why that's happening is a mystery. I might just yank the incomplete skin support since no one ever got to use it and now that someone has tried, it never worked in first place.

 

How soon are you trying to load your skin?

 

For heck of it do

/script DBM.Bars:LoadOptions("DBM") or /script DBT:LoadOptions("DBM")

before trying to do so



#5 MysticalOS

MysticalOS

    French Hacker

  • ♦ Administrators
  • 896 posts
  • LocationGeorgia

Posted 28 April 2014 - 06:49 AM

Or try changing this

for k, v in pairs(options) do

 

to

 

for k, v in pairs(self.options) do



#6 Gethe

Gethe

    Glass Joe

  • Members
  • 6 posts

Posted 29 April 2014 - 02:11 AM

Ok, I managed to get this to work with a couple tweaks to DBT.lua

 

  1. I changed a few uses of self to reference DBM.Bar instead.
  2. The icon and frame sizing lines were commented out so that it can support narrow bars with larger icons. The huge bar scaling still works properly as far as I can tell.

 

This may not be the most clean or ideal solution, as i'm not all that familiar with the code, but it works and I'm not getting any errors.

Attached Files

  • Attached File  DBT.lua   37.61KB   1 downloads


#7 MysticalOS

MysticalOS

    French Hacker

  • ♦ Administrators
  • 896 posts
  • LocationGeorgia

Posted 29 April 2014 - 02:13 AM

DBM.Bar seems like wrong reference. That's the global ref used by DBM-Core to refer to the local DBT reference. Within DBT though you should use DBT. I'll look at changes though.

 

you basically changed self to same thing, the fact it works just means something is probably wonky with load order. Did you try doing the things i said to do above? like force load options before you call setskin?



#8 MysticalOS

MysticalOS

    French Hacker

  • ♦ Administrators
  • 896 posts
  • LocationGeorgia

Posted 29 April 2014 - 02:36 AM

Hmm looking at code this looks like a load order issue.

If it loads in this order

 

DBM-Core

Skin

DBT

 

then self won't work but DBM.bars probably would.

 

It may work properly if DBT is added as a required Dep for skin so it loads like

 

DBM-Core

DBT

Skin

 

then again I'm not entirely sure dbt can load before skin. that may cause other problems. Alternatively I think just force loading options in registerskin/setskin if they are nil, may solve it too. Hard to say.

 

Try putting this in your skin

## RequiredDeps: DBM-Core, DBM-StatusBarTimers

 

this should force it to load statusbartimers first no matter what. then see if it behaves better?



#9 Gethe

Gethe

    Glass Joe

  • Members
  • 6 posts

Posted 29 April 2014 - 03:48 AM

DBM.Bar seems like wrong reference. That's the global ref used by DBM-Core to refer to the local DBT reference. Within DBT though you should use DBT. I'll look at changes though.

 

you basically changed self to same thing, the fact it works just means something is probably wonky with load order. Did you try doing the things i said to do above? like force load options before you call setskin?

Yeah i'm calling DBM.Bars:LoadOptions("DBM"); LoadAddOn("DBM-RealUI"). then had SetSkin at the end of the skin addon.

 

Hmm looking at code this looks like a load order issue.

If it loads in this order

 

DBM-Core

Skin

DBT

 

then self won't work but DBM.bars probably would.

 

It may work properly if DBT is added as a required Dep for skin so it loads like

 

DBM-Core

DBT

Skin

 

then again I'm not entirely sure dbt can load before skin. that may cause other problems. Alternatively I think just force loading options in registerskin/setskin if they are nil, may solve it too. Hard to say.

 

Try putting this in your skin

## RequiredDeps: DBM-Core, DBM-StatusBarTimers

 

this should force it to load statusbartimers first no matter what. then see if it behaves better?

I had thought of that, but DBM-StatusBarTimers is already a Dep for DBM-Core so i figured having just DBM-Core listed would be fine. Regardless, I reverted the changes to self and added SBT as a ReqDep. Got this error:

1x DBM-StatusBarTimers-5.4.13-37-g529e77c\DBT.lua:367: attempt to index field "options" (a nil value)
DBM-StatusBarTimers-5.4.13-37-g529e77c\DBT.lua:367: in function "SetOption"
DBM-StatusBarTimers-5.4.13-37-g529e77c\DBT.lua:983: in function "SetSkin"
DBM-RealUI\Skin.lua:34: in main chunk
<in C code>
nibRealUI-8.0 r28\Skins\DBM-5.4.13.11193.lua:32: in function "Skin"
nibRealUI-8.0 r28\Skins\DBM-5.4.13.11193.lua:109: in function <nibRealUI\Skins\DBM.lua:105>
(tail call): ?
<in C code>
<string>:"safecall Dispatcher[1]":9: in function <string>:"safecall Dispatcher[1]":5
(tail call): ?
AckisRecipeList-2.6.2\libs\AceAddon-3.0\AceAddon-3.0-12.lua:558: in function "EnableAddon"
AckisRecipeList-2.6.2\libs\AceAddon-3.0\AceAddon-3.0-12.lua:571: in function "EnableAddon"
AckisRecipeList-2.6.2\libs\AceAddon-3.0\AceAddon-3.0-12.lua:651: in function <AckisRecipeList\libs\AceAddon-3.0\AceAddon-3.0.lua:636>
<in C code>
FrameXML\UIParent.lua:306: in function "UIParentLoadAddOn"
FrameXML\UIParent.lua:380: in function "TimeManager_LoadUI"
FrameXML\UIParent.lua:740: in function <FrameXML\UIParent.lua:705>
<in C code>

Locals:
self = <table> {
 GetOption = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:375
 UpdateBar = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:547
 SetAnnounceHook = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:1066
 GetSkins = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:1035
 GetTextures = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:1039
 ShowMovableBar = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:804
 GetDefaultOption = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:379
 SetOption = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:356
 CreateDummyBar = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:485
 New = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:312
 LoadOptions = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:341
 RegisterSkin = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:955
 CreateBar = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:404
 SavePosition = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:787
 ShowTestBars = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:562
 GetFonts = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:1043
 GetBarIterator = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:521
 CancelBar = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:537
 SetSkin = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:969
 GetBar = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:529
 ApplyStyle = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:854
}
id = "RealUI"
skin = <table> {
 loaded = true
 defaults = <table> {
 }
 name = "RealUI"
}
totalBars = 0
skins = <table> {
 RealUI = <table> {
 }
 DefaultSkin = <table> {
 }
}
unusedBars = <table> {
}
pairs = <function> defined =[C]:-1
options = <table> {
 EndColorG = <table> {
 }
 Scale = <table> {
 }
 HugeBarsEnabled = <table> {
 }
 TextColorB = <table> {
 }
 Flash = <table> {
 }
 HugeBarYOffset = <table> {
 }
 HugeWidth = <table> {
 }
 TimerX = <table> {
 }
 Texture = <table> {
 }
 ExpandUpwards = <table> {
 }
 Spark = <table> {
 }
 Width = <table> {
 }
 HugeTimerPoint = <table> {
 }
 EnlargeBarsTime = <table> {
 }
 TextColorG = <table> {
 }
 HugeBarXOffset = <table> {
 }
 IconLeft = <table> {
 }
 Height = <table> {
 }
 Skin = <table> {
 }
 IconRight = <table> {
 }
 BarYOffset = <table> {
 }
 Template = <table> {
 }
 FontSize = <table> {
 }
 HugeScale = <table> {
 }
 ClickThrough = <table> {
 }
 FillUpBars = <table> {
 }
 EnlargeBarsPercent = <table> {
 }
 TextColorR = <table> {
 }
 StartColorG = <table> {
 }
 HugeTimerY = <table> {
 }
 HugeTimerX = <table> {
 }
 EndColorR = <table> {
 }
 TimerY = <table> {
 }
 TimerPoint = <table> {
 }
 Font = <table> {
 }
 Style = <table> {
 }
 DynamicColor = <table> {
 }
 StartColorB = <table> {
 }
 StartColorR = <table> {
 }
 BarXOffset = <table> {
 }
 EndColorB = <table> {
 }
}

Then i tried doing a hard check for DBM-SBT before loading the skin and i got this when opening the options:

1x DBM-StatusBarTimers-5.4.13-37-g529e77c\DBT.lua:395: CreateFrame(): Couldn"t find inherited node "RealUISkinTimerTemplate"
<in C code>
DBM-StatusBarTimers-5.4.13-37-g529e77c\DBT.lua:395: in function <DBM-StatusBarTimers\DBT.lua:389>
DBM-StatusBarTimers-5.4.13-37-g529e77c\DBT.lua:419: in function "CreateBar"
DBM-StatusBarTimers-5.4.13-37-g529e77c\DBT.lua:487: in function "CreateDummyBar"
DBM-GUI\DBM-GUI-5.4.13-37-g529e77c.lua:1695: in function "?"
DBM-Core\DBM-Core-5.4.13-37-g529e77c.lua:1798: in function "LoadGUI"
DBM-Core\DBM-Core-5.4.13-37-g529e77c.lua:1498: in function "?"
FrameXML\ChatFrame.lua:4315: in function "ChatEdit_ParseText"
FrameXML\ChatFrame.lua:3969: in function "ChatEdit_SendText"
FrameXML\ChatFrame.lua:4008: in function "ChatEdit_OnEnterPressed"
<string>:"*:OnEnterPressed":1: in function <string>:"*:OnEnterPressed":1

Locals:
self = <table> {
 announceHook = <function> defined @Interface\AddOns\DBM-Core\DBM-Core.lua:4915
 smallBars = <table> {
 }
 options = <table> {
 }
 defaultOptions = <table> {
 }
 mainAnchor = <unnamed> {
 }
 secAnchor = <unnamed> {
 }
 hugeBars = <table> {
 }
 bars = <table> {
 }
}
frame = nil
unusedBars = <table> {
}
fCounter = 1
setupHandlers = <function> defined @Interface\AddOns\DBM-StatusBarTimers\DBT.lua:1214

It may be relevant to mention that the skin addon is LoadOnDemand, and DBT will yell at you and not load it if it isn't. Though since it is LoD none of the associated options or templates get created, but DBT needs the template to load since i had already successfully made that change with my previous edits.



#10 MysticalOS

MysticalOS

    French Hacker

  • ♦ Administrators
  • 896 posts
  • LocationGeorgia

Posted 29 April 2014 - 03:52 AM

That second error indicates at least options loaded. Which does tell me that they are only nil when the skin loads first, so I do think that DBM-Status Bar Timers needs to be added to skins dependancies to force that. beyond that who knows. 

 

Maybe it will help to make it not LoD, since it's always required anyways.



#11 Gethe

Gethe

    Glass Joe

  • Members
  • 6 posts

Posted 29 April 2014 - 04:32 AM

It worked! I made it not LoD, and commented out the errorhandler for not being LoD (it wouldn't load otherwise). Then made a check if DBM-SBT was loaded before calling SetSkin(). LoadOptions didn't even need to be called. (note: This was with r11231) Thanks for your help!

 

That said, I would appreciate it if my second edit with the icons and frame would be applied. This would allow for icons that are larger than the bar height. Then again that would likely mess with the default skin, so for proper support there would likely need to be a specific option for that.


Edited by Gethe, 29 April 2014 - 04:35 AM.


#12 MysticalOS

MysticalOS

    French Hacker

  • ♦ Administrators
  • 896 posts
  • LocationGeorgia

Posted 29 April 2014 - 04:47 AM

You shouldn't need to check DBM-SBT if you just make DBM-SBT a req dep and mod not load on demand i would assume.



#13 Gethe

Gethe

    Glass Joe

  • Members
  • 6 posts

Posted 29 April 2014 - 07:26 AM

So i am a derp, I was using DBT:SetSkin instead of DBM.Bars:SetSkin. That's why self didn't have the correct tables. Thank you for your patience and help.

 

I'll see about adding independant Icon sizing if you don't want to. This is a crucial part of my skin.



#14 MysticalOS

MysticalOS

    French Hacker

  • ♦ Administrators
  • 896 posts
  • LocationGeorgia

Posted 29 April 2014 - 07:28 AM

I wonder how many of changes I made that were pointless then. I'll leave em since they don't appear to have broken anything.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users