Thread Tools Display Modes
09-12-14, 12:00 PM   #1
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
Cannot setup SharedMediaWidgets lib - Need help

Hi,

I have rewrote my UI and I am trying to setup options in my GUI using the Ace library but I cannot get the Shared Media Widgets working. I decided to set up the libs in the exact same way my old UI use to work (which has no problems) but still I am getting an error and I do not know enough about libraries to fix it myself.

I have installed AceGUI-3.0-SharedMediaWidgets and placed it in the libs folder.

I have uploaded all the code to GitHub here: https://github.com/Mayron/MayronUI-4

The issue is this: (code found in Core.lua on line 306)
Lua Code:
  1. statusbarType= {
  2.     order = 6,
  3.     type = "select",
  4.     dialogControl = "LSM30_Statusbar",
  5.     name = "Status Bar Type",
  6.     desc = "Alter the status bar style.",
  7.     values = AceGUIWidgetLSMlists.statusbar,
  8.     get = function()
  9.         -- to do.
  10.      end,
  11.      set = function(self,key)
  12.         -- to do.
  13.      end,
  14. },

And I get this error: attempt to index global 'AceGUIWidgetLSMlists' (a nil value)

So I assume it is not loading the library but I honestly have been spending a long time and I cannot figure out what I screwed up on because I tried following the guide correctly and I have tried my old UI which was setup in near enough the same way which works.

Any experts want to explain how bad I am for me? hehe
Thanks!

Last edited by Mayron : 09-12-14 at 12:03 PM.
  Reply With Quote
09-12-14, 12:05 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Do you have the library listed in your TOC file?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-12-14, 12:16 PM   #3
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
Originally Posted by Seerah View Post
Do you have the library listed in your TOC file?
In my TOC file I have embeds.xml and in that it has this:

xml Code:
  1. <Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
  2.   <Script file="libs\LibStub\LibStub.lua"/>
  3.   <Include file="libs\AceAddon-3.0\AceAddon-3.0.xml"/>
  4.   <Include file="libs\AceConfig-3.0\AceConfig-3.0.xml"/>
  5.   <Include file="libs\AceConsole-3.0\AceConsole-3.0.xml"/>
  6.   <Include file="libs\AceDB-3.0\AceDB-3.0.xml"/>
  7.   <Include file="libs\AceDBOptions-3.0\AceDBOptions-3.0.xml"/>
  8.   <Include file="libs\AceGUI-3.0\AceGUI-3.0.xml"/>
  9.   <Include file="libs\AceHook-3.0\AceHook-3.0.xml"/>
  10.   <Include file="libs\AceLocale-3.0\AceLocale-3.0.xml"/>
  11.   <Include file="libs\CallbackHandler-1.0\CallbackHandler-1.0.xml"/>
  12.   <Script file="libs\LibDataBroker-1.1\LibDataBroker-1.1.lua"/>
  13.   <Script file="libs\LibDualSpec-1.0\LibDualSpec-1.0.lua"/>
  14.   <Script file="libs\LibAboutPanel.lua" />
  15. </Ui>
  Reply With Quote
09-12-14, 12:23 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Originally Posted by Mayron View Post
In my TOC file I have embeds.xml and in that it has this:
So... That's a no then?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-12-14, 12:42 PM   #5
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
Originally Posted by Seerah View Post
So... That's a no then?
I don't understand why I copied the same files over from my old UI which makes use of this same library and that uses the same embeds file as the one I linked but that works.

Not sure how I embed it if I want to use AceGUI-3.0-SharedMediaWidgets,
I tried <Include file="libs\AceGUI-3.0-SharedMediaWidgets\widget.xml"/> but doesn't work, I don't know a lot about this stuff.

Last edited by Mayron : 09-12-14 at 12:44 PM.
  Reply With Quote
09-12-14, 01:39 PM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Keep in mind that files are loaded in the order they are listed. Your list of libraries will result in a lot of errors on login, because you're loading libraries that depend on other libraries before the libraries they depend on. For example:

* AceDB-3.0 depends on CallbackHandler-1.0, but you're loading AceDB first.
* Part of AceConfig-3.0 depends on AceGUI-3.0, and another part depends on AceConsole-3.0, but you're loading AceConfig before either of those.

Also, AceGUI-3.0-SharedMediaWidgets requires both AceGUI-3.0 and LibSharedMedia-3.0, the latter of which isn't mentioned anywhere in the XML you posted, so I have to assume you're not loading it at all.

If you don't see any errors, make sure that:

1. You're testing without other addons enabled. If your addon is still called MayronUI, but you're also using Archy, for example, then the libraries in Archy will already be loaded when your addon loads, hiding the problem.

2. You have BugSack installed. The default error display, even if you've turned it on, is incapable of showing errors that occur during the initial loading process, and is therefore useless for addon development.

Unrelatedly, I would suggest loading the library's Lua file directly if you know it only has one file, rather than loading an XML file that loads the Lua file. Reading files from disk is by far the slowest part of the loading process, so the fewer files that need to be read, the better.

Assuming the file paths themselves are correct, I'd suggest this:

xml Code:
  1. <Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/
  2. ..\FrameXML\UI.xsd">
  3.     <Script  file="libs\LibStub\LibStub.lua"/>
  4.     <Script  file="libs\CallbackHandler-1.0\CallbackHandler-1.0.lua"/>
  5.     <Script  file="libs\AceAddon-3.0\AceAddon-3.0.lua"/>
  6.     <Script  file="libs\AceConsole-3.0\AceConsole-3.0.lua"/>
  7.     <Include file="libs\AceGUI-3.0\AceGUI-3.0.xml"/>
  8.     <Include file="libs\AceConfig-3.0\AceConfig-3.0.xml"/> <!-- depends on AceConsole, AceGUI -->
  9.     <Script  file="libs\AceDB-3.0\AceDB-3.0.lua"/> <!-- depends on CallbackHandler -->
  10.     <Script  file="libs\AceDBOptions-3.0\AceDBOptions-3.0.lua"/> <!-- depends on AceDB -->
  11.     <Script  file="libs\AceHook-3.0\AceHook-3.0.lua"/>
  12.     <Script  file="libs\AceLocale-3.0\AceLocale-3.0.lua"/>
  13.     <Script  file="libs\LibAboutPanel.lua" />
  14.     <Script  file="libs\LibDataBroker-1.1\LibDataBroker-1.1.lua"/> <!-- depends on CallbackHandler -->
  15.     <Script  file="libs\LibDualSpec-1.0\LibDualSpec-1.0.lua"/> <!-- depends on AceDB, AceDBOptions -->
  16.     <Script  file="libs\LibSharedMedia-3.0\LibSharedMedia-3.0.lua"/> <!-- CallbackHandler -->
  17.     <Include file="libs\AceGUI-3.0-SharedMediaWidgets\widget.xml"/> <!-- depends on AceGUI, LibSharedMedia -->
  18. </Ui>
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
09-12-14, 01:50 PM   #7
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
Originally Posted by Phanx View Post
Keep in mind that files are loaded in the order they are listed. Your list of libraries will result in a lot of errors on login, because you're loading libraries that depend on other libraries before the libraries they depend on. For example:

* AceDB-3.0 depends on CallbackHandler-1.0, but you're loading AceDB first.
* Part of AceConfig-3.0 depends on AceGUI-3.0, and another part depends on AceConsole-3.0, but you're loading AceConfig before either of those.

Also, AceGUI-3.0-SharedMediaWidgets requires both AceGUI-3.0 and LibSharedMedia-3.0, the latter of which isn't mentioned anywhere in the XML you posted, so I have to assume you're not loading it at all.

If you don't see any errors, make sure that:

1. You're testing without other addons enabled. If your addon is still called MayronUI, but you're also using Archy, for example, then the libraries in Archy will already be loaded when your addon loads, hiding the problem.

2. You have BugSack installed. The default error display, even if you've turned it on, is incapable of showing errors that occur during the initial loading process, and is therefore useless for addon development.

Unrelatedly, I would suggest loading the library's Lua file directly if you know it only has one file, rather than loading an XML file that loads the Lua file. Reading files from disk is by far the slowest part of the loading process, so the fewer files that need to be read, the better.

Assuming the file paths themselves are correct, I'd suggest this:

xml Code:
  1. <Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/
  2. ..\FrameXML\UI.xsd">
  3.     <Script  file="libs\LibStub\LibStub.lua"/>
  4.     <Script  file="libs\CallbackHandler-1.0\CallbackHandler-1.0.lua"/>
  5.     <Script  file="libs\AceAddon-3.0\AceAddon-3.0.lua"/>
  6.     <Script  file="libs\AceConsole-3.0\AceConsole-3.0.lua"/>
  7.     <Include file="libs\AceGUI-3.0\AceGUI-3.0.xml"/>
  8.     <Include file="libs\AceConfig-3.0\AceConfig-3.0.xml"/> <!-- depends on AceConsole, AceGUI -->
  9.     <Script  file="libs\AceDB-3.0\AceDB-3.0.lua"/> <!-- depends on CallbackHandler -->
  10.     <Script  file="libs\AceDBOptions-3.0\AceDBOptions-3.0.lua"/> <!-- depends on AceDB -->
  11.     <Script  file="libs\AceHook-3.0\AceHook-3.0.lua"/>
  12.     <Script  file="libs\AceLocale-3.0\AceLocale-3.0.lua"/>
  13.     <Script  file="libs\LibAboutPanel.lua" />
  14.     <Script  file="libs\LibDataBroker-1.1\LibDataBroker-1.1.lua"/> <!-- depends on CallbackHandler -->
  15.     <Script  file="libs\LibDualSpec-1.0\LibDualSpec-1.0.lua"/> <!-- depends on AceDB, AceDBOptions -->
  16.     <Script  file="libs\LibSharedMedia-3.0\LibSharedMedia-3.0.lua"/> <!-- CallbackHandler -->
  17.     <Include file="libs\AceGUI-3.0-SharedMediaWidgets\widget.xml"/> <!-- depends on AceGUI, LibSharedMedia -->
  18. </Ui>
Excellent, I knew that order mattered but was getting confused on how to find out the right order and assumed it should be correct due to my old AddOn still working (before I completely rewrote it). I think I found the difference though and I assume it had to be because another AddOn had SharedMedia installed correctly and I was using the library already loaded by that instead.

About the unrelated thing, I had it all in the TOC file and did not use the embeds because I want to save on files being loaded and completely agree. When I could not get it to work I tried copying the method I had used before with no luck so yes I will definitely try to cut back on files. I also want to merge more code into one single file because the Modules folder on GitHub now looks horrific.

This is exactly what I was after so thanks Phanx

EDIT: Works perfectly, ty <3

Last edited by Mayron : 09-12-14 at 02:07 PM.
  Reply With Quote
09-12-14, 03:05 PM   #8
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Mayron View Post
Excellent, I knew that order mattered but was getting confused on how to find out the right order ...
When it doubt just open up the library in Notepad and see which libraries it references. 99.999% of the time that kind of thing will be right up at the top.

Originally Posted by Mayron View Post
... I will definitely try to cut back on files. I also want to merge more code into one single file because the Modules folder on GitHub now looks horrific.
Don't go overboard, though. Obviously if you have 10 files that average 25 lines each, it would be better to merge them, but if you're ending up with 50,000 lines of code in a single file that's just a nightmare for maintenance.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
09-13-14, 01:33 AM   #9
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
As a side note, why are you using an embeds.xml file? Just load the libraries directly from the ToC. With embeds.xml, you are loading two files instead of one. Yes, the Ace3 docs still talk about the xml file, but that is very outdated at this point.
  Reply With Quote
09-13-14, 07:44 PM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
The original purpose of an embeds.xml file was to help the original WowAce Updater program identify the libraries used in your addon, so it could correctly download them users who preferred standalone libraries. I used to be one of those, as using standalone libraries will speed up logins and UI reloads by a fairly huge amount if you're using a lot of addons, but after switching from a mechanical HDD to a shiny new SSD a couple years ago, it doesn't make that much difference anymore, and adds a lot of clutter in the addon folder, which I'm looking at a lot as an addon developer, so I no longer install my libs standalone.

Anyway, nowadays the only reason to use an embeds.xml file (or any other XML file that just loads other files) is to keep your TOC more readable, but how often are you really looking at that?
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
09-14-14, 03:19 AM   #11
Sharparam
A Flamescale Wyrmkin
 
Sharparam's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2011
Posts: 102
But now that you have an SSD, you need to worry about running out of space instead!
  Reply With Quote
09-14-14, 10:53 PM   #12
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
That's true... I didn't have room on the SSD for the beta client, as it's only got about 30 GB free out of 128, but I plan to upgrade to 256 GB in the near future and use the old one in a media server. Space isn't really an issue overall though; I've got about 6 TB of (total) disk space on my desktop machine, about 1 TB of which is free.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Cannot setup SharedMediaWidgets lib - Need help

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