WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Need some help with implementating LibDaraBroker :( (https://www.wowinterface.com/forums/showthread.php?t=20164)

Tutje 01-19-09 05:14 PM

Need some help with implementating LibDaraBroker :(
 
For now i managed pretty well with resources on Internet but now I'm starting to loose it so hoping you can help me.

I'm trying to make a broker for my (first)mod and actually it worked nice until i disabled other mods (in this case recount+broker_recount). Then i got errors. So i'm guessing my mod isn't taking my own LibDataBroker but one from another mod but i leave that up to you.

This is the code i use in my mod:

LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("MyModNameHere", {
type = "launcher",
icon = "Interface\\Icons\\Spell_Fire_Fireball02",
OnTooltipShow = function(self)
GameTooltip:AddLine("Text", HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b)
end,
OnClick = function(clickedframe, button)
if button == "LeftButton" then
Frame1:Show();
end
end,

I have added 3 files in the root of my addon:
LibStub.lua
CallbackHandler.xml
LibDataBroker-1.1.lua

and also added these in this order in my .toc file.

When logging in without any other mods enabled Swatter gives to following error:

Message: ..\AddOns\HitAssist\Frame.lua line 35:
Cannot find a library instance of "LibDataBroker-1.1".
Debug:
[C]: ?
[C]: error()
!Swatter\Support\LibRevision.lua:47: GetLibrary()
HitAssist\Frame.lua:35: in main chunk

-------------------- and

Message: ..\AddOns\HitAssist\LibDataBroker-1.1.lua line 3:
LibDataBroker-1.1 requires CallbackHandler-1.0
Debug:
[C]: ?
[C]: assert()
HitAssist\LibDataBroker-1.1.lua:3: in main chunk

So i hope anyone got any idea what i'm doing wrong and if you could explain it not to techie English would be great :p

/cheer

twobits 01-19-09 05:19 PM

Quote:

Originally Posted by Tutje (Post 115320)


I have added 3 files in the root of my addon:
LibStub.lua
CallbackHandler.xml
LibDataBroker-1.1.lua

and also added these in this order in my .toc file.

When logging in without any other mods enabled Swatter gives to following error:

Message: ..\AddOns\HitAssist\Frame.lua line 35:
Cannot find a library instance of "LibDataBroker-1.1".
Debug:
[C]: ?
[C]: error()
!Swatter\Support\LibRevision.lua:47: GetLibrary()
HitAssist\Frame.lua:35: in main chunk

-------------------- and

Message: ..\AddOns\HitAssist\LibDataBroker-1.1.lua line 3:
LibDataBroker-1.1 requires CallbackHandler-1.0
Debug:
[C]: ?
[C]: assert()
HitAssist\LibDataBroker-1.1.lua:3: in main chunk

you forgot the lua file for the callbackhandler is what is seems from the above.

Seerah 01-19-09 09:54 PM

First, it's CallbackHandler-1.0.xml (@twobits: the .xml file loads the .lua file- .xml files should be used in toc's if available instead of the lua files, as it makes it easier for you when the library author updates the lib and adds/removes files to it).

Second, if you have the lib files in folders inside your addon folder, make sure that that is part of your path in the toc file (ie, CallbackHandler-1.0\CallbackHandler-1.0.xml).

Third, have you completely exited and restarted the game since adding those libraries to your project *and* its toc file?

twobits 01-19-09 10:15 PM

[quote=Tutje;115320]


I have added 3 files in the root of my addon:
LibStub.lua
CallbackHandler.xml
LibDataBroker-1.1.lua

and also added these in this order in my .toc file.

Quote:

Originally Posted by Seerah (Post 115364)
First, it's CallbackHandler-1.0.xml (@twobits: the .xml file loads the .lua file- .xml files should be used in toc's if available instead of the lua files, as it makes it easier for you when the library author updates the lib and adds/removes files to it).

Second, if you have the lib files in folders inside your addon folder, make sure that that is part of your path in the toc file (ie, CallbackHandler-1.0\CallbackHandler-1.0.xml).

Third, have you completely exited and restarted the game since adding those libraries to your project *and* its toc file?


Indeed, but they say they put those 3 files in the directory, but none of them are the lua that the xml would want to then load, and the name of the xml missing the -1.0 by itself is fine as long as they have it changed the same in both places.

Tutje 01-20-09 04:25 AM

Thanks alot for your reply's m8's :) Indeed i forgot the 1.0 in the callbackhandler, probably copied stuff from other mods and forgot that. Although that didn't solve the problem(only one of the 2 errors) i finally found the problem. (ow its so stupid) In my toc file i first call my frame.xml and frame.lua and Then my libs. But it turns out that should be the other way around. So stupid that i didn't notice that in other mods, but now its works :)


For seerah. I see other mods doing this as well and the callbackhandler.xml just looks like a redirect to me. So why do you want to put another callbackhandler file in your addon dir.? When there is a update you need to replace the xml file as well.

Again, thanks alot! Its good to know there is an active forum for this stuff.

/cheer

Mera 01-20-09 06:24 AM

Quote:

Originally Posted by Tutje (Post 115385)
callbackhandler file in your addon dir.?

much a cosmetic thing, you dont have to put it iin the dir since this is the lib author providing it

Quote:

Originally Posted by Tutje (Post 115385)
When there is a update you need to replace the xml file as well.

No because usually any mod author uses the SVN where he stores first its mod online, (See TortoiseSVN tuts and the SVN options to familiarize you with it), so he do not have to upload the libraries in the SVN but libraries are set externals with the property svn:externals so for exemple in my project easydnd (the beta 45 not stable r33) the svn folders has this externals

Code:

libs/AceAddon-3.0 svn://svn.wowace.com/wow/ace3/mainline/trunk/AceAddon-3.0/
libs/AceGUI-3.0 svn://svn.wowace.com/wow/ace3/mainline/trunk/AceGUI-3.0/
libs/AceConfig-3.0 svn://svn.wowace.com/wow/ace3/mainline/trunk/AceConfig-3.0/
libs/AceConsole-3.0 svn://svn.wowace.com/wow/ace3/mainline/trunk/AceConsole-3.0/
libs/AceDB-3.0 svn://svn.wowace.com/wow/ace3/mainline/trunk/AceDB-3.0/
libs/AceDBOptions-3.0 svn://svn.wowace.com/wow/ace3/mainline/trunk/AceDBOptions-3.0/
libs/AceEvent-3.0 svn://svn.wowace.com/wow/ace3/mainline/trunk/AceEvent-3.0
libs/AceLocale-3.0 svn://svn.wowace.com/wow/ace3/mainline/trunk/AceLocale-3.0/
libs/CallbackHandler-1.0 svn://svn.wowace.com/wow/ace3/mainline/trunk/CallbackHandler-1.0/
libs/LibStub svn://svn.wowace.com/wow/ace3/mainline/trunk/LibStub/
libs/Dewdrop-2.0 svn://svn.wowace.com/wow/dewdroplib/mainline/trunk/Dewdrop-2.0/
libs/LibDBIcon-1.0 svn://svn.wowace.com/wow/libdbicon-1-0/mainline/trunk/LibDBIcon-1.0/
libs/Dewdrop-2.0/AceLibrary svn://svn.wowace.com/wow/ace2/mainline/trunk/AceLibrary/

This means anytime I will download a copy of my mods through TortoiseSVN it will automatically download for me the defined libs because they are externals and not managed by me , so when a new lib is released I don't have to care on updating it, TortoiseSVN does it!
The good side with wowinterface is that you also have a webinterface http://svn.wowinterface.com/svn.php to publish package directly from svn to your addon pages, so the zip will be generated with libs already included because wowinterface goes to download them for you because you had setup svn:externals links =)
Sounds huge at starts but thats really easy to understand, anything you include in your mod which is not coded by you is a library you should setup in svn:externals to not care then on dlding it on x site to upload on y svn.
There is just for now Git projects to force in your mod like LibDataBroker doesnt use svn but git and so on you cannot put a git link in your svn interface so better to upload directly only such mods in yours, but stuff like Callbackhandler are from Ace3 and directly available there svn://svn.wowace.com/wow/ace3/mainline/trunk/ for easy embedding

Tutje 01-20-09 07:47 AM

pfff, it does sounds overwhelming indeed :) but interesting as well. I'm gonna check it out. For now my mod works so i can focus on some other updates needed. Thanks for writing it all down:)

For now my mod can be downloaded at www.hitassist.tk in case your interested :)

/cheer


All times are GMT -6. The time now is 02:27 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI