|
08-25-11, 08:17 PM | #1 |
Config.lua to ingame GUI?
Ok so I have been trying for weeks to make a in game GUI with no luck. I was hopping to do this just with lua code and no libs.
I tried looking into doing it with Ace3 but I can't understand all that has to be done and were to place the code. I added my SavedVariables field to my TOC, put all my settings into a single table. That's as far as I can get with out then getting completely lost. Her is all of my code. http://www.wowace.com/paste/3767/ O also when using Ace3 were do I put the files and which ones do I use, or do I just place the whole Ace3 file in the addons? Last edited by dreamcatcher : 08-25-11 at 08:21 PM. |
|
08-27-11, 02:47 AM | #2 |
So i finely got the GUI to show up but im getting lots of errors.
Code:
Message: Interface\AddOns\Tweaks\Core.lua:536: attempt to index upvalue 'db' (a nil value) Time: 08/27/11 01:47:06 Count: 1 Stack: Interface\AddOns\Tweaks\Core.lua:536: in function <Interface\AddOns\Tweaks\Core.lua:534> [C]: in function `UIParent_ManageFramePositions' Interface\FrameXML\InterfaceOptionsPanels.lua:1284: in function `InterfaceOptions_UpdateMultiActionBars' [string "*:OnLoad"]:4: in function `setFunc' Interface\FrameXML\InterfaceOptionsPanels.lua:1253: in function <Interface\FrameXML\InterfaceOptionsPanels.lua:1246> Locals: (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = "attempt to index upvalue 'db' (a nil value)" db = nil http://www.wowace.com/paste/3784/ |
|
08-27-11, 03:00 AM | #3 | |
First, I don't see you declaring your addon at the very top in Ace fashion. Ie:
Core.lua Code:
local MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon") Code:
local MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon") For getting DB, you'll want to put this line in: Code:
self.db = LibStub("AceDB-3.0"):New("MyAddonDB", defaults, "Default") To get the DB into a variable, something like this in a MyAddon:Anything() function. Code:
db = self.db.profile
Last edited by Nibelheim : 08-27-11 at 03:21 AM. |
||
08-27-11, 03:18 AM | #4 |
Here's some quick examples of a basic Ace addon. You can install Ace3 components under MyAddon\libs\
MyAddon.toc Embeds.xml Core.lua Config.lua Last edited by Nibelheim : 08-27-11 at 03:26 AM. |
|
08-28-11, 03:48 AM | #5 |
First thank you for your help, I got the options to show up now and there are no errors.
Now I'm trying to set up all the functions and I'm having some problems.
Core.lua Code:
local defaults = { profile = { MAB = { Enable = true, HideMacronames = true, HideGryphons = false, Scale = .8, ["Position"] = {"BOTTOMLEFT",Minimap,-510,0}, }, local function ActionBars() -- MainActionBar for i = 1, 12 do local MAB = _G["ActionButton"..i] if (i == 1) then MAB:ClearAllPoints() MAB:SetPoint(unpack(db.MAB.Position)) MAB:SetScale(db.MAB.Scale) else MAB:ClearAllPoints() MAB:SetPoint("LEFT", _G["ActionButton"..i-1],"RIGHT",6,0) MAB:SetScale(db.MAB.Scale) end end Code:
MAB = { name = "MainActionBar", type = "group", order = 30, args = { Position= { type = "input", name = "Position", order = 1, set = function(info, val) db.MAB.Position = val MyAddon:UpdateStuff() end, get = function(info) return db.MAB.Position end, }, },
Core.lua Code:
function Style(self) local name = self:GetName() local action = self.action local Button = self local Count = _G[name.."Count"] local HotKey = _G[name.."HotKey"] local Border = _G[name.."Border"] local Btname = _G[name.."Name"] local Normal = _G[name.."NormalTexture"] Btname:Show() Button:SetNormalTexture[[Interface\AddOns\MyAddon\Media\button]] Border:Hide() if db.MAB.HideMacronames then Btname:Hide() end end Code:
HideMacronames = { type = "toggle", name = "HideMacronames", order = 2, set = function(info, val) db.MAB.HideMacronames = val MyAddon:UpdateStuff() end, get = function(info) return db.MAB.HideMacronames end, }, |
|
08-28-11, 01:16 PM | #6 | ||
Post from wowace.com
Hope this helps ya. Coke |
|||
08-28-11, 01:48 PM | #7 |
I to have not played wow in two weeks been like you say obsessed with my coding
I have been looking at your stuff on the WowAce Forums. But yours is so so so much bigger then mine that i get lost in your code. Also you don't have any gui command for positions. |
|
08-28-11, 03:20 PM | #8 |
Woot figured out how to change position of bar.
Config.lua Code:
offsetX = { name = "X Offset", type = "input", width = "half", order = 13, desc = "Offsets from the tooltip's anchor left/right", set = function(info, value) db.MAB.offsetX = value MyAddon:UpdateStuff() end, get = function(info) return tostring(db.MAB.offsetX) end, }, offsetY = { name = "Y Offset", type = "input", width = "half", order = 14, desc = "Offsets from the anchor up/down", set = function(info, value) db.MAB.offsetY = value MyAddon:UpdateStuff() end, get = function(info) return tostring(db.MAB.offsetY) end, }, anchor = { name = "Anchor To...", type = "select", order = 11, desc = "What side of the screen you would like the located at.", values = positions, set = function(info, value) db.MAB.anchor = positions[value] MyAddon:UpdateStuff() end, get = function() for k, v in pairs(positions) do if v == db.MAB.anchor then return k end end end, }, Code:
local defaults = { profile = { MAB = { Enable = true, HideMacronames = true, HideGryphons = false, Scale = .8, anchor = "BOTTOMLEFT", offsetX = "-510", offsetY = "0", }, -- MainActionBar for i = 1, 12 do local MAB = _G["ActionButton"..i] if (i == 1) then MAB:ClearAllPoints() MAB:SetPoint(db.MAB.anchor, Minimap, db.MAB.anchor, db.MAB.offsetX, db.MAB.offsetY) MAB:SetScale(db.MAB.Scale) else MAB:ClearAllPoints() MAB:SetPoint("LEFT", _G["ActionButton"..i-1],"RIGHT",6,0) MAB:SetScale(db.MAB.Scale) end end |
|
WoWInterface » Developer Discussions » General Authoring Discussion » Config.lua to ingame GUI? |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|