WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Config.lua to ingame GUI? (https://www.wowinterface.com/forums/showthread.php?t=41256)

dreamcatcher 08-29-11 06:29 PM

Quote:

Originally Posted by Nibelheim (Post 243931)
Why are you hooking 'ActionButton_Update' twice? I'd hook it once, call Style() function from the hook, and call Style() function in UpdateStuff()

Code:

function DreamTweaks:UpdateStuff()
        UpdateActionButtonStyle()
        -- etc
end

function StickThisIntoAFunctionSomewhere()
        hooksecurefunc("ActionButton_Update", UpdateActionButtonStyle)
end


Ok I ether placed things wrong or something but now i get a error.

Code:

Message: Interface\AddOns\DreamTweaks\Core.lua:701: attempt to index global 'self' (a nil value)
Time: 08/29/11 17:33:05
Count: 1
Stack: Interface\AddOns\DreamTweaks\Core.lua:701: in function `UpdateActionButtonStyle'
Interface\AddOns\DreamTweaks\Core.lua:851: in function `UpdateStuff'
Interface\AddOns\DreamTweaks\Core.lua:878: in function `?'
...aks\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:147: in function <...aks\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:147>
[string "safecall Dispatcher[1]"]:4: in function <[string "safecall Dispatcher[1]"]:4>
[C]: ?
[string "safecall Dispatcher[1]"]:13: in function `?'
...aks\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:92: in function `Fire'
...ddOns\DreamTweaks\Libs\AceEvent-3.0\AceEvent-3.0.lua:120: in function <...ddOns\DreamTweaks\Libs\AceEvent-3.0\AceEvent-3.0.lua:119>

Locals: (*temporary) = <function> defined =[C]:-1
(*temporary) = <table> {
}
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index global 'self' (a nil value)"
_G = <table> {
 ActionButton7FlyoutBorder = ActionButton7FlyoutBorder {
 }
 MultiCastActionButton6Cooldown = MultiCastActionButton6Cooldown {
 }
 MerchantItem9ItemButtonStock = MerchantItem9ItemButtonStock {
 }
 GetTrainerServiceTypeFilter = <function> defined =[C]:-1
 UNIT_NAMES_COMBATLOG_TOOLTIP = "Color unit names."
 UNIT_NAMEPLATES_TYPE_TOOLTIP_3 = "This method avoids overlapping nameplates by spreading them out horizontally and vertically."
 SetTrainerServiceTypeFilter = <function> defined =[C]:-1
 EventTraceFrameButton7HideButton = EventTraceFrameButton7HideButton {
 }
 SPELL_FAILED_CUSTOM_ERROR_71 = "This partygoer wants to dance with you."
 CompactUnitFrameProfilesGeneralOptionsFrameHealthTextDropdownButtonNormalTexture = CompactUnitFrameProfilesGeneralOptionsFrameHealthTextDropdownButtonNormalTexture {
 }
 TutorialFrameLeft19 = TutorialFrameLeft19 {
 }
 MultiCastActionButton2Cooldown = MultiCastActionButton2Cooldown {
 }
 ERR_TRADE_EQUIPPED_BAG = "You can't trade equipped bags."
 PVP_RANK_6_1 = "Corporal"
 BOOKTYPE_PROFESSION = "professions"
 AudioOptionsVoicePanelOutputDeviceDropDownButtonHighlightTexture = AudioOptionsVoicePanelOutputDeviceDropDownButtonHighlightTexture {
 }
 InterfaceOptionsDisplayPanelShowAggroPercentageText = InterfaceOptionsDisplayPanelShowAggroPercentageText {
 }
 VideoOptionsFrameCategoryFrameButton17ToggleHighlightTexture = VideoOptionsFrameCategoryFrameButton17ToggleHighlightTexture {
 }
 MerchantItem3AltCurrencyFrameItem1Text = MerchantItem3AltCurrencyFrameItem1Text {
 }
 OPTION_TOOLTIP_ACTION_BUTTON_USE_KEY_DOWN = "Action button keybinds will respond on key down, rather than on key up."
 BINDING_NAME_NAMEPLATES = "Show Enemy Name Plates"
 CHAT_HEADER_SUFFIX = ": "
 IsReferAFriendLinked = <function> defined =[C]:-1
 MAIL_LETTER_TOOLTIP = "Click to make a permanent
copy of this letter."
 AudioOptionsVoicePanelMicrophoneVolumeThumb = AudioOptionsVoicePanelMicrophoneVolumeThumb {
 }
 ERR_NOAMMO_S = "%s"
 CHAT_CONFIG_OTHER_COMBAT = <table> {
 }
 CONSOLIDATED_BUFFS_PER_ROW = 4
 TutorialFrameRight19 = TutorialFrameRight19 {
 }
 MoneyFrame_OnEvent = <function> defined @Interface\FrameXML\MoneyFrame.lua:224
 BN_UNABLE_TO_RESOLVE_NAME = "Unable to whisper '%s'. Battle.net may be unavailable."
 CinematicFrameRaidBossEmoteFrame = CinematicFrameRaidBossEmoteFrame {
 }
 InterfaceOptionsCombatTextPanelFCTDropDown_OnClick = <function> defined @Interface\FrameXML\InterfaceOptionsPanels.lua:1683
 LFGTeleport = <function> defined =[C]:-1
 SpellButton6Cooldown = SpellButton6Cooldown {
 }
 ChannelMemberButton10Name = ChannelMemberButton10Name {
 }
 Graphics_QualityText = Graphics_QualityText {
 }
 TalentMicroButtonAlertShadowTopLeft = TalentMicroButtonAlertShadowTopLeft {
 }
 EncounterJournalEncounterFrameInfoLootScrollFrameClassFilterFrameClass4Shadow = EncounterJournalEncounterFrameInfoLootScrollFrameClassFilterFr


Nibelheim 08-29-11 06:40 PM

Hmm, you're right, that won't work at all. You'll just need to hook it once like you were doing:

Code:

hooksecurefunc('ActionButton_Update', function(self)
        for _, icon in pairs({
            self:GetName(),
            'MultiCastRecallSpellButton',
            'MultiCastSummonSpellButton',
        }) do
        local macroname = _G[self:GetName()..'Name']
        if (db.HideMacronames) then
            macroname:SetAlpha(0)
        end
    end
end)

And reload the UI to apply the changes. Hooking it again in UpdateStuff won't do anything.

dreamcatcher 08-29-11 06:52 PM

If there is a way I can tie in all the skinning to one Then maybe I can do it like you say. I don't know. Still learning this stuff.

This is the whole code for the buttons.
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"]

        Button:SetNormalTexture[[Interface\AddOns\DreamTweaks\Media\button]]
        Border:Hide()
       
end

function StyleShapeshift()
        for i = 1, NUM_SHAPESHIFT_SLOTS do
        local name = "ShapeshiftButton"..i
        local Button = _G[name]
        local Border  = _G[name.."Border"]
        Button:SetNormalTexture[[Interface\AddOns\DreamTweaks\Media\button]]
        Border:Hide()
        end
end

function StylePet()
        for i = 1, NUM_PET_ACTION_SLOTS do
        local name = "PetActionButton"..i
        local Button = _G[name]
        local Border  = _G[name.."Border"]
        Button:SetNormalTexture[[Interface\AddOns\DreamTweaks\Media\button]]
        Border:Hide()
        end
end

function ActionButton_OnUpdate(self, elapsed)
        local rangeTimer = self.rangeTimer
        if (rangeTimer) then
        rangeTimer = rangeTimer - elapsed
        if (rangeTimer <= 0) then
        local isInRange = false
        if (ActionHasRange(self.action) and IsActionInRange(self.action) == 0) then
        _G[self:GetName()..'Icon']:SetVertexColor( 0.9, 0, 0 )
        isInRange = true
        end
        if (self.isInRange ~= isInRange) then
        self.isInRange = isInRange
        ActionButton_UpdateUsable(self)
        end
        rangeTimer = TOOLTIP_UPDATE_TIME
        end
        self.rangeTimer = rangeTimer
        end
end

hooksecurefunc('ActionButton_Update', function(self)
        for _, icon in pairs({
            self:GetName(),
            'MultiCastRecallSpellButton',
            'MultiCastSummonSpellButton',
        }) do
        local macroname = _G[self:GetName()..'Name']
        if db.HideMacronames then
            macroname:SetAlpha(0)
                else
            macroname:SetAlpha(1)
                end
        end
end)

function DreamTweaks:UpdateStuff()

        hooksecurefunc("ActionButton_Update", Style)
        hooksecurefunc("PetActionBar_Update", StylePet)
        hooksecurefunc("ShapeshiftBar_Update", StyleShapeshift)

end


dreamcatcher 08-30-11 06:07 PM

Ok I moved on from trying to get the micro names to show hide for now since I have been stuck on it for days.

Now I need help with a minor thing just the layout look of the GUI.

This is what it looks like now.


I would like to move the options down. To have the scale, anchor, and offsets in same row. Can this be done?

cokedrivers 08-30-11 07:06 PM

Quote:

Originally Posted by dreamcatcher (Post 244003)
Ok I moved on from trying to get the micro names to show hide for now since I have been stuck on it for days.

Now I need help with a minor thing just the layout look of the GUI.

This is what it looks like now.


I would like to move the options down. To have the scale, anchor, and offsets in same row. Can this be done?

Code:

        enableHyperlinkTooltip = {
                order = 6,
                name = L["Enable Hyplerlink Tooltip"],
                desc = L["Enables the mouseover items in chat tooltip."],
                type = "toggle",
                disabled = function() return not db.chat.enable end,
        },

Order in your Ace Options lets you place the option where you want.

Hope this helps.

Nibelheim 08-30-11 07:22 PM

As well, you can use a "separator":

Code:

sep1 = {
    type = "description",
    name = " ",
    order = 30,
},

Make sure to set the order correctly. A separator will push the next fields onto a new line.

Seerah 08-30-11 07:27 PM

A description is full width by default, and will add a slight bit of empty space between his checkbox and the line below. What he should really do is give the checkbox element a width of full.

http://www.wowace.com/addons/ace3/pa...mon-parameters

dreamcatcher 08-30-11 08:57 PM

Quote:

Originally Posted by Seerah (Post 244008)
A description is full width by default, and will add a slight bit of empty space between his checkbox and the line below. What he should really do is give the checkbox element a width of full.

http://www.wowace.com/addons/ace3/pa...mon-parameters

Thank you the " give the checkbox element a width of full" worked great.

dreamcatcher 08-31-11 02:57 AM

I'm haveing some problems with the color picker. It works good for the Tooltip but not so god on the frame for the Mini Map.

Here's what I have.

Code:

Color = {
        name = "BorderColor",
        type = "color",
        order = 2,
        hasAlpha = true,
        set = function(_,r,g,b,a)
        db.MM.Color.r = r
        db.MM.Color.g = g
        db.MM.Color.b = b
        db.MM.Color.a = a
        Map()
        end,
        get = function() return
        db.MM.Color.r,
        db.MM.Color.g,
        db.MM.Color.b,
        db.MM.Color.a
        end,
},

Code:

MM = {
        Enable = true,
        Scale = 1,
        Strata = "HIGH",
        Color = {r = 0, g = 0, b = 0, a = 1},
        Font = {"Fonts\\FRIZQT__.TTF",18,"THINOUTLINE"},
        anchor = "BOTTOM",
        offsetX = "0",
        offsetY = "5",
},

Code:

local f = CreateFrame("Frame", "MM", Minimap)
        f:SetParent(Minimap)
        f:SetPoint("BOTTOMLEFT", Minimap, -5, -5)
        f:SetPoint("TOPRIGHT", Minimap, 5, 5)
        f:SetFrameStrata("BACKGROUND")
        f:SetBackdrop{
                edgeFile = [=[Interface\DialogFrame\UI-DialogBox-Border]=],
                tile = false,
                tileSize = 0,
                edgeSize = 13,
                insets = {left = 4, right = 4, top = 4, bottom = 4}
        }
        f:SetBackdropBorderColor(db.MM.Color.r, db.MM.Color.g, db.MM.Color.b, db.MM.Color.a)

It will change color but not fully till i do a reload.

Starinnia 08-31-11 11:06 AM

You need to explicitly update the frame after a new color value is picked. I.E. make sure you're adjusting the frame in the "Set" handler.

dreamcatcher 09-01-11 03:05 AM

Quote:

Originally Posted by Starinnia (Post 244060)
You need to explicitly update the frame after a new color value is picked. I.E. make sure you're adjusting the frame in the "Set" handler.

Not sure if I understand. The frame is in the same section of code as all code for the MiniMap.

Code:

function Map()

if db.MM.Enable then

        Minimap:ClearAllPoints()
        Minimap:SetPoint(db.MM.anchor, UIParent, db.MM.anchor,db.MM.offsetX, db.MM.offsetY)
        Minimap:SetScale(db.MM.Scale)
        Minimap:SetFrameStrata(db.MM.Strata)

local f = CreateFrame("Frame", "MM", Minimap)
        f:SetParent(Minimap)
        f:SetPoint("BOTTOMLEFT", Minimap, -5, -5)
        f:SetPoint("TOPRIGHT", Minimap, 5, 5)
        f:SetFrameStrata("BACKGROUND")
        f:SetBackdrop{
                edgeFile = [=[Interface\DialogFrame\UI-DialogBox-Border]=],
                tile = false,
                tileSize = 0,
                edgeSize = 13,
                insets = {left = 4, right = 4, top = 4, bottom = 4}
        }
        f:SetBackdropBorderColor(db.MM.Color.r, db.MM.Color.g, db.MM.Color.b, db.MM.Color.a)
       
       
        Minimap:SetBlipTexture[=[Interface\Addons\DreamTweaks\Media\ObjectIconsBigOn]=]
        Minimap:SetMaskTexture[=[Interface\ChatFrame\ChatFrameBackground]=]

        MinimapZoneTextButton:ClearAllPoints()
        MinimapZoneTextButton:SetPoint("TOP", Minimap, 0, 15)
       
        MiniMapTracking:ClearAllPoints()
        MiniMapTracking:SetPoint("TOPLEFT", Minimap, 0, 0)
        MiniMapTrackingButton:SetAlpha(0)
       
        MiniMapBattlefieldFrame:ClearAllPoints()
        MiniMapBattlefieldFrame:SetPoint("BOTTOMLEFT", Minimap, 0, 50)
       
        MiniMapLFGFrame:ClearAllPoints()
        MiniMapLFGFrame:SetPoint("BOTTOMLEFT", Minimap, 0, 0)
        LFDSearchStatus:ClearAllPoints()
        LFDSearchStatus:SetPoint("CENTER", UIParent, 0, 0)
        LFDSearchStatus:SetScale(0.9)
       
        MiniMapMailFrame:ClearAllPoints()
        MiniMapMailFrame:SetPoint("TOPRIGHT", Minimap, 0, 0)
        MiniMapMailIcon:SetTexture[=[Interface\AddOns\DreamTweaks\Media\Mail]=]


        if not IsAddOnLoaded("Blizzard_TimeManager") then
                LoadAddOn("Blizzard_TimeManager")
        end
        local clockFrame, clockTime = TimeManagerClockButton:GetRegions()
        clockFrame:Hide()
        clockTime:Show()
        clockTime:SetFont(unpack(db.MM.Font))
        TimeManagerClockButton:ClearAllPoints()
        TimeManagerClockButton:SetPoint("BOTTOM", Minimap, 0, 0)
       
        Minimap:EnableMouseWheel(true)
        Minimap:SetScript("OnMouseWheel", function(self, d)
                if d > 0 then
                        _G.MinimapZoomIn:Click()
                elseif d < 0 then
                        _G.MinimapZoomOut:Click()
                end
        end)
       
        Minimap:SetScript('OnMouseUp', function(self, button)
                if (button == 'MiddleButton') then
                        ToggleCalendar()
                else
                        Minimap_OnClick(self)
                end
        end)

end
        if not db.MM.Enable then return end
end


dreamcatcher 09-01-11 03:58 PM

Another question here.

Before I started making my in-game GUI with Ace3 I had my addon split in 3 files one was my work on the actionbars the other was all the frames I made for my addon then the last was for the minimap, tolltip, watchframe, and chat. Then I had a config file for all 3 files. It would pull frome the other files with the comand
local _, DreamTweaks = ...
local cfg = DreamTweaks.Config

My question is with ace3 how can you do that same thing? The only way I have seen and have gotten help in making the GUI was to put all of my code in one core file and have one config file with the ACE3 options.

dreamcatcher 09-02-11 07:16 PM

No one know how I can do this? :(

Rilgamon 09-03-11 03:34 AM

not sure if I understand you right but you can share data between different files this way:

Code:

local addonName, addonTable = ...
Every file should have a line like this at it's top. Every file loaded in your loading process gets this information passed at startup. First argument is the name of your addon and the second is a table that is passed on to every file. It's empty at first but you can put your data and functions into this table in one file and use them in the next.

So you can split your addon in as many files as you want.

Xrystal 09-03-11 04:59 AM

This is a life saver if you want to make some sense out of your addons.

EG. say you do the same thing in all your addons. Simply put it in a separate file and hey presto all your addons can use the same functionality without you copying and pasting chunks of code. You can even go one further and have a special folder for common files that are shared between your addons and you wouldn't even have to copy and paste the file into your individual addon folders.

Since this feature came out each next update to my addons incorporated this functionality where it was possible as a quick change. I think i still have a large addon that I haven't done this with yet.

Quote:

Originally Posted by Rilgamon (Post 244185)
not sure if I understand you right but you can share data between different files this way:

Code:

local addonName, addonTable = ...
Every file should have a line like this at it's top. Every file loaded in your loading process gets this information passed at startup. First argument is the name of your addon and the second is a table that is passed on to every file. It's empty at first but you can put your data and functions into this table in one file and use them in the next.

So you can split your addon in as many files as you want.


Nibelheim 09-03-11 07:48 AM

Modules are a little bit of work, a little too much for me to go in-depth on (too little time these days). Best bet is to find an addon that already uses modules (Postal, Mapster, etc), but since you're not too familiar with Ace/Lua yet it may take some time to understand the system, especially since most samples will contain a lot of extra stuff. Took me a few days of heavy tinkering to get my first modules to work :)

Before you start on modules, I'd recommend taking a look at this Ace3 addon guide. It'll provide a nice overview of the basic Ace functionality so you can better grasp how the system operates.

For modules, basically you can create a new .lua file for your module, maybe store it under a Modules folder, and reference this in your .toc. In this new module file, you can get your Ace Addon object, as well as create your new module object, like so:

Code:

local MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon")
local MyModule = MyAddon:NewModule("MyModule")

The module will then work similar to a Core.lua file would. It can reference MyAddon:Etc() functions, as well as have it's own MyModule:Etc() functions. It can have it's own options, defaults, and config sections, each which need to get registered and accounted for in your Core.lua and Config.lua files.

dreamcatcher 09-04-11 12:16 AM

Quote:

Originally Posted by Nibelheim (Post 244197)
The module will then work similar to a Core.lua file would. It can reference MyAddon:Etc() functions, as well as have it's own MyModule:Etc() functions. It can have it's own options, defaults, and config sections, each which need to get registered and accounted for in your Core.lua and Config.lua files.

Ok I not sure I understand this last part. Right now I have a config file with all the gui options. Then I have my core file with the defalts. Last I have a module folder with for now one file for the actionbars.

How do I get it called in the config file?

This is the error I get.
Code:

Message: Interface\AddOns\DreamTweaks\Config.lua:46: attempt to call global 'ActionBars' (a nil value)
Time: 09/04/11 01:07:03
Count: 1
Stack: Interface\AddOns\DreamTweaks\Config.lua:46: in function <Interface\AddOns\DreamTweaks\Config.lua:44>
(tail call): ?
[C]: ?
[string "safecall Dispatcher[2]"]:9: in function <[string "safecall Dispatcher[2]"]:5>
(tail call): ?
...nfig-3.0\AceConfigDialog-3.0\AceConfigDialog-3.0.lua:798: in function <...nfig-3.0\AceConfigDialog-3.0\AceConfigDialog-3.0.lua:613>
(tail call): ?
[C]: ?
[string "safecall Dispatcher[3]"]:9: in function <[string "safecall Dispatcher[3]"]:5>
(tail call): ?
...ce\AddOns\DreamTweaks\Libs\AceGUI-3.0\AceGUI-3.0.lua:314: in function `Fire'
...ks\Libs\AceGUI-3.0\widgets\AceGUIWidget-CheckBox.lua:68: in function <...ks\Libs\AceGUI-3.0\widgets\AceGUIWidget-CheckBox.lua:57>

Locals: info = <table> {
 1 = "ActionBars"
 2 = "HideGryphons"
 uiType = "dialog"
 type = "toggle"
 options = <table> {
 }
 option = <table> {
 }
 uiName = "AceConfigDialog-3.0"
 handler = <table> {
 }
 appName = "DreamTweaks"
}
val = false
(*temporary) = nil
(*temporary) = "attempt to call global 'ActionBars' (a nil value)"
db = <table> {
 MABL = <table> {
 }
 Bags = <table> {
 }
 MBL = <table> {
 }
 HideMacronames = false
 Quest = <table> {
 }
 ReputationBar = <table> {
 }
 PAB = <table> {
 }
 HideGryphons = false
 Tooltip = <table> {
 }
 VMB = <table> {
 }
 ModuleEnabledState = <table> {
 }
 ExpBar = <table> {
 }
 SSB = <table> {
 }
 MABR = <table> {
 }
 Chat = <table> {
 }
 MicroMenu = <table> {
 }
 MM = <table> {
 }
}


dreamcatcher 09-05-11 01:21 AM

I have also posted this question on WowAce.
http://forums.wowace.com/showthread....659#post318659

dreamcatcher 09-24-11 07:38 PM

Ok I have been working so hard this last few weeks but still having some problems, I don't understand the Action Bar module works fine no error, well no error till i do a change profile or reset default. But the strangest error is this one.

Code:

Message: Interface\AddOns\DreamTweaks\modules\Minimap.lua:1 25: attempt to index field 'db' (a nil value)
Time: 09/23/11 23:31:35
Count: 1
Stack: Interface\AddOns\DreamTweaks\modules\Minimap.lua:1 25: in function <Interface\AddOns\DreamTweaks\modules\Minimap.lua: 124>
(tail call): ?
[C]: ?
[string "safecall Dispatcher[1]"]:9: in function <[string "safecall Dispatcher[1]"]:5>
(tail call): ?
...ddOns\DreamTweaks\libs\AceAddon-3.0\AceAddon-3.0.lua:543: in function <...ddOns\DreamTweaks\libs\AceAddon-3.0\AceAddon-3.0.lua:536>
(tail call): ?
Interface\AddOns\DreamTweaks\DreamTweaks.lua:97: in function `Settings'
Interface\AddOns\DreamTweaks\DreamTweaks.lua:90: in function <Interface\AddOns\DreamTweaks\DreamTweaks.lua:76 >
(tail call): ?
[C]: ?
[string "safecall Dispatcher[1]"]:9: in function <[string "safecall Dispatcher[1]"]:5>
(tail call): ?
...ddOns\DreamTweaks\libs\AceAddon-3.0\AceAddon-3.0.lua:514: in function `InitializeAddon'
...ddOns\DreamTweaks\libs\AceAddon-3.0\AceAddon-3.0.lua:628: in function <...ddOns\DreamTweaks\libs\AceAddon-3.0\AceAddon-3.0.lua:621>

Locals: <none>

Here also is a link to the code for the cor.lua, actionbar.lua and map.lua file.

http://www.wowace.com/paste/3979/

as you see I do have the code close to the same and it has the db = self.db.profile were it should be. So why am i getting this error. I'm very confused.


All times are GMT -6. The time now is 03:28 PM.

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