View Full Version : Question about Templates
Kwami
12-13-2008, 08:06 AM
Hey folks,
I'm working on my first custom layout, and I've got a quick question. I've noticed that Nurfed layouts support templates, and I was wondering of my actual Nurfed.lua configuration file would also accept them. It seems to in some cases, but not in others. I think.
Basically, this works:
["text"] = {
["FontObject"] = "Nurfed_UnitFont",
},
... Where "Nurfed_UnitFont" is defined as a template of type "Font". But, this does not appear to work:
["mp"] = {
["StatusBarObject"] = "Nurfed_Unit_MP",
},
... Where "Nurfed_Unit_MP" is declared as a template of type "StatusBar".
So, is it possible to do something like this and have it actually work? Seems like it should work, and I might just be using the wrong keyword?
Thanks!
- Kwami
When the Nurfed:create() function is creating the frames and comes across a template, all it does is copy the template's table and insert everything into the final frame's table. That is why you'll never see templates actually in the saved variables file--
...I just started typing that and I scrolled up to read your post again only to find that I misread your question.
In short, there is no such thing as a "StatusBarObject". The reason FontObject works is because a FontObject is an abstract UI object. Normally, when a nurfed template is created, it exists ONLY as a table, but one exception is made for font "templates". They're created as FontObjects, which could be described as font templates. The reason typing FontObject = "Nurfed_Unit_blabla" works is because Nurfed:create goes through each table and basically puts "Set" or "Enable" in front of every variable name. So FontObject becomes "SetFontObject". That is why SetStatusBarObject won't work. It doesn't exist. If you want to use a template for a StatusBar, or any frame for that matter, type:
template = "Nurfed_Unit_MP",
P.S. I don't know why you're editing your saved variables if you're actually going to be editing the lua tables. It makes much more sense to just edit the Layout.lua. So you have an actual layout that will last you.
Kwami
12-15-2008, 06:49 AM
Hey, thanks. That makes sense.
I'm editing my saved variables directly because I can't import any layouts with the latest SVN version of Nurfed. I've tried disabling all other addons, deleting my WTF folder, and using some of the more popular layouts from these forums, but the import always fails. I never get the "Import Layout" button in the frames editor, and I always get this error from Nurfed_Options/Panels.lua:
\Interface\AddOns\Nurfed_Options\Panels.lua:423: attempt to index global 'Nurfed_UnitsLayout' (a nil value)
I posted about it in the main UI forum, but thus far no response. Any ideas?
Thanks,
Kwami
That error seems like it would be impossible to get, unless you're actually setting the layout to nil in game.
Login, don't do anything except type: "/run nrfimp()"
See what happens.
Tenten
12-20-2008, 03:13 PM
That error seems like it would be impossible to get, unless you're actually setting the layout to nil in game.
Login, don't do anything except type: "/run nrfimp()"
See what happens.
I get the same when i update to the newest svn. got tired of all the problems i've had with the svn codes, so stopped update them up until rev 279 i think. dont know why it does like that =/ but im looking forward to the new release!
Kwami
12-21-2008, 08:25 AM
As of the latest SVN commit, I never get this error unless I explicity set the layout to null, or I have a fautly layout file that breaks the 'f' variable. By the way, the error reports for Nurfed suck... It's a pain in the ass to track down an error in my layout unless it actually fails to parse.
Apoco
12-24-2008, 06:35 AM
if your getting a NURFED_FRAMES error, don't do NURFED_FRAMES = nil; then nrfimp();
do
/script NURFED_FRAMES = { templates = {}, frames = {} }
as far as error reports with templates...setting something up like that is harder than it sounds :(
Powered by vBulletin® Version 4.1.9 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.