10-23-10, 12:04 PM | #1 |
WTF -->Lua
hello guys, need some help...
i am trying to make it so i can take my saved information, from WTF files for addons, and put them into a Lua file, so that when people DL my interface, they dont need to do the WTF folder stuff. and when they login, to simply press a button to load the addons... but i seem to have a complication, taking the stuff from the WTF folders into the Lua folder, can someone help me, to know what exactly i need to transfer.... |
|
10-23-10, 12:24 PM | #2 |
I haven't tried this myself, but there should be a way to "tap into" the database of the different AddOns, allowing you to install your own data on the first load. The way I figured it would be something like:
Code:
local AddonToTapInto = LibStub("AceAddon-3.0"):GetAddon("AddonToTapInto") AddonToTapInto.db.profile = MyWTFTable This of course, assumes the Addon is an Ace3 Addon. |
|
10-23-10, 04:18 PM | #3 | |
You can tell your UI addon to load after the other addons it uses by listing them as dependencies in your TOC file. meanwhile, you can take a copy of all the SavedVariable files and include them in your addon (they are just plain Lua files). Even so, there's no guarantee that this method would work since there's no telling what each addon does to their saved info in the form of caching the global pointer.
__________________
WoWInterface AddOns
|
||
10-23-10, 04:52 PM | #4 |
Instead of adding the dependencies, I think you could start loading the data at the PLAYER_LOGIN event, I don't know though.
But as the above said, your Loader or whatever, would have to be manually adapted to include every Addons database and/or time of loading. Also, after the installation, a ReloadUI should be forced to force the user to save the new data to the various Addons databases. This is only a one-time task though, so it shouldn't be that much of a problem. You might also want to make sure that the Loader is disabled afterwards, as having it enabled will only force database updates that shouldn't be required at all. At the moment, I am looking into ways of creating a Library for this sort of thing, if I come out successful, I'll make sure to provide a good piece of documentation. Last edited by Nillerr : 10-23-10 at 04:56 PM. |
|
10-24-10, 09:58 AM | #5 |
this is an example of my UI taking over the default Macaroon setup. Of course i cut it a bit short since the whole thing wont fit here but the top part is whats important. You need to find out what the default settings table is called by the addon your taking over. for macaroon it was macaroonSavedState. The first two lines make sure that my UI only does this the first time Macaroon and GrimUI run together then it returns full control to Macaroon. Exactly how this all works is partly dependent on the addon your taking over and how it was coded. That whole Ace hook thing that was mentioned above would require both addons to be using the ace library and still do not think it would work like that.
The lua inside the WTF's are tables... the data inside of them has to be used as such. Everything after MacaroonSavedState is what you would find in the Macaroon WTF. Code:
local MacTakeOver = CreateFrame("Frame", "MacTakeOver", UIParent) MacTakeOver:RegisterEvent("ADDON_LOADED") MacTakeOver:SetScript("OnEvent", function() if addon.settings.chatInitialized == true then addon.settings.macaroonInitialized = true end if Macaroon and addon.settings.macaroonInitialized == false then addon.settings.macaroonInitialized = true MacaroonSavedState = { ["cooldownAlpha"] = 1, ["bagOffsetX"] = 0, ["useShared"] = false, ["bagOffsetY"] = 70, ["timerLimit"] = 4, ["firstRun"] = true, ["registerForClicks"] = "AnyUp", ["currSpec"] = 1, ["buttonRadius"] = 87.5, ["bars"] = { { { ["arcLength"] = 360, ["prowl"] = false, ["spellGlow"] = true, ["hotKeys"] = "", ["copyDrag"] = false, ["tooltips"] = true, ["customRange"] = false, ["hotKeyText"] = "", ["arcStart"] = 90, ["snapToPoint"] = false, ["buttonList"] = { ["homestate"] = "1;2;3;4;5;6;7;8;9;10", }, ["target"] = false, ["snapTo"] = false, ["snapToFrame"] = false, ["stealth"] = false, ["origID"] = 1, ["shape"] = 1, ["barLockShift"] = false, ["reaction"] = false, ["ctrl"] = false, ["snapToPad"] = 0, ["hidden"] = false, ["shift"] = false, ["y"] = 116.9545311955373, ["x"] = 248.1222926662736, ["name"] = "MainBar1", ["homestate"] = true, ["padH"] = 0, ["barStrata"] = "MEDIUM", ["laststate"] = "homestate", ["alpha"] = 1, ["alt"] = false, ["dualSpec"] = false, ["point"] = "BOTTOM", ["fishing"] = false, ["scale"] = 0.7999999999999998, ["companion"] = false, ["currentstate"] = "homestate", ["barLink"] = false, ["tooltipsCombat"] = false, ["showstates"] = false, ["columns"] = false, ["autoHide"] = false, ["barLockAlt"] = false, ["vehicle"] = false, ["hotKeysShown"] = true, Last edited by Grimsin : 10-24-10 at 10:01 AM. |
|
10-24-10, 11:45 AM | #6 |
Actually when you open a .lua file in the savedvariables folder you notice that data is stored like SOMETHING = {} so you can basically make a installer addon to (once) set that variable to a custom value (i.e.) your own addon settings.
Not easy to explain really, hmm. |
|
03-06-11, 09:06 AM | #7 | |
Last edited by Grimsin : 03-06-11 at 09:09 AM. |
||
03-06-11, 10:39 AM | #8 |
There is an easy to follow config file included in cleanUI (..\@cleanConfig\@cleanConfig.lua). Lines 42-134 create & load an MSBT profile (a saved variables-like table). The popup dialog code at the bottom was also helpful to me:
lua Code:
|
|
03-06-11, 12:40 PM | #9 |
this will be complicated by addons that store config data that is tied to specific characters/servers.
|
|
03-14-11, 10:40 AM | #10 | |
Side note, that code from CleanUI is actually a pretty good idea, as long as the addon you are changing has profiling setup and its as simple as setting the profile. Note that no mater what it requires a reload. there is a method of getting around the reload but it is dependent on how the addon was setup and uses an unreliable method of file naming to control load order. Granted ive always found it reliable but few addons setup in a fashion that allow you to use that method. It involves using ! at the start of the file name to insure that that file loads first or at least a head of 99% of the addons out there. This method would have you basically redo certain functions from the addon you are controlling before it ever loads. Having the end user do a reload on first install though is safer and easier Last edited by Grimsin : 03-14-11 at 10:47 AM. |
||
WoWInterface » Developer Discussions » Lua/XML Help » WTF -->Lua |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|