• 0

    posted a message on [Ace3] Options GUI
    Back. xD

    I've run into two small issues.
    1) I can't seem to get my dropdown menus to work. I can't figure out how to define the values. I first worked from an AddOn that used some sort of sound lib, since I want to do the same, but when testing my AddOn without other AddOns it backfired so I'm trying to make a stand-alone dropdown menu first.
    2) When testing my AddOn with other AddOns loaded, the Interface Options frame is wider than when I test my AddOn without other AddOns. How do I widthen (?) the Interface Options frame?

    Current Tql.lua: http://paste.wowace.com/2968/
    Current dropdown menu code:
    objectivesoundfile = {
    name        =    "Objective completion sound",
    desc        =    "Choose the sound to play when you complete a quest objective.",
    type        =    "select",
    style       =    "dropdown",
    order       =    2,
    values      =    "",
    disabled    =    function() return not Tql.db.profile.objectivesound end,
    },
    Posted in: Lua Code Discussion
  • 0

    posted a message on [Ace3] Options GUI
    Thanks, but I fixed it already... it was a small typo.
    Had a 'default' somewhere, where it should've been 'defaults'.
    So far it's all working, thanks anyway though. :)
    Posted in: Lua Code Discussion
  • 0

    posted a message on [Ace3] Options GUI
    Thanks, that fixed it. Settings are now saved through reloads and relogs. :)

    I still can't manage to define the settings for the Default profile, though.
    Posted in: Lua Code Discussion
  • 0

    posted a message on [Ace3] Options GUI
    Thanks to the both of you, I now understand my code a bit better -and- I was able to properly register my config into the Interface Options frame. ^^

    I was planning on slowly starting to make the config UI itself, but figured it would be best if I made some example options first and make sure my SavedVariables, default settings and Profiles work properly.

    As you can guess, they dont. :p
    No settings are saved through reloads, nor do the profiles seem to work.

    - I think I might not have defined the local defaults properly.
    - I think I'm not loading them properly, either.
    - I think I haven't 'linked' my SavedVariables to my Profiles.. or something along those lines.
    - I have a feeling I'm forgetting something else that I need to make my SavedVariables, profiles and Default profile work properly as well. :p

    Here is once again, my Tql.xml code:
    Tql = LibStub("AceAddon-3.0"):NewAddon("Tag's Quest Log", "AceConsole-3.0")
    
    -- The configurable options.
    local options = {
    	name = "Tag's Quest Log",
    	handler = TqlOptions,
    	type = 'group',
    	args = {
    		general = {
    			type = 'group',
    			name = "Tag's Quest Log",
    			args = {
    				enable = {
    					name = "Enable AddOn",
    					desc = "Enables the AddOn.",
    					type = "toggle",
    					set = function(info,val) Tql.enabled = val end,
    					get = function(info) return Tql.enabled end
    				},
    			},
    		},
    
    		log = {
    			type = 'group',
    			name = "Tag's Quest Log",
    			args = {
    				blah1 = {
    					name = "Some Log option",
    					desc = "Does something. =D",
    					type = "toggle",
    					set = function(info,val) Tql.blah1 = val end,
    					get = function(info) return Tql.blah1 end
    				},
    			},
    		},
    
    		tracker = {
    			type = 'group',
    			name = "Tag's Quest Log",
    			args = {
    				blah2 = {
    					name = "Some Tracker option",
    					desc = "Does something. =D",
    					type = "toggle",
    					set = function(info,val) Tql.blah2 = val end,
    					get = function(info) return Tql.blah2 end
    				},
    			},
    		},
    
    		profile = {
    		},
    	},
    }
    
    
    -- The default settings.
    local defaults = {
    	profile = {
    		enable = true,
    		blah1 = false,
    		blah2 = false,
    	}
    }
    
    -- This runs when the AddOn is loaded by the client.
    function Tql:OnInitialize()
    	-- Create the /tql slash command.
    	Tql:RegisterChatCommand("tql", "TqlSlash")
    	
    	-- Loading the SavedVariables.
    	self.db = LibStub("AceDB-3.0"):New("TqlDB", defaults, "Default")
    	options.args.profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)
    	
    	-- Registering the options table.
    	LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("TqlOptions", options.args.general)
    	LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("TqlLog", options.args.log)
    	LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("TqlTracker", options.args.tracker)
    	LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("TqlProfiles", options.args.profile)
    	
    	-- Adding the AddOn to Blizzard's Interface Options frame.
    	self.TqlOptions = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("TqlOptions", "Tag's Quest Log")
    	self.TqlLog = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("TqlLog", "Quest Log", "Tag's Quest Log")
    	self.TqlTracker = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("TqlTracker", "Quest Tracker",  "Tag's Quest Log")
    	self.TqlProfiles = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("TqlProfiles", "Profiles", "Tag's Quest Log")
    end
    
    
    -- This runs when the AddOn is enabled by the user.
    function Tql:OnEnable()
    	
    end
    
    
    -- This runs when the AddOn is disabled by the user.
    function Tql:OnDisable()
    	
    end
    
    
    -- Add a function to the /tql slash command.
    function Tql:TqlSlash(input)
    	-- Open the Interface OPtions frame to Tag's Quest Log.
    	InterfaceOptionsFrame_OpenToCategory("Tag's Quest Log")
    end


    I have defined my SavedVariables as ## SavedVariables: TqlDB in my .toc file, if you were curious.

    (Also on a small sidenote, how do I change the 'Profile' header inside my options? Adding a name = "Tag's Quest Log", does not work like with the other pages, probably because the Profiles page is pre-defined entirely. Chatter for example has changed it though, so it is possible. :p)
    Posted in: Lua Code Discussion
  • 0

    posted a message on [Ace3] Options GUI
    This will probably be the first of many questions, since I'm a novice programmer trying to create an AddOn. ^^
    Do note that I have looked at the tutorials, but I can't find any good example code to help me with the issue I've run into.

    I'm trying to create an options GUI for my AddOn, according to the tutorials this should work via AceConfigDialog-3.0. The piece of code from said tutorial does not seem to work though, probably because I'm using it wrong. ^^

    What it should do: Add my AddOn into the Interface Options panel and create a Profiles subcategory. It's also supposed to open the Options GUI by using /tql and save the settings, though my primary problem is getting an Options GUI. :p

    What happens in stead: I get the following Lua error:
    Interface\AddOns\Tql\Tql.lua:42: attempt to index global 'self' (a nil value)

    Tql.toc
    ## Interface: 40000
    ## Title: Tag's Quest Log
    ## Notes: Enhances the Quest Log and Tracker.
    ## Author: Tag of Fire
    ## Version: v0.1
    ## SavedVariables: TqlDB
    
    libs\LibStub\LibStub.lua
    libs\CallbackHandler-1.0\CallbackHandler-1.0.xml
    libs\AceAddon-3.0\AceAddon-3.0.xml
    libs\AceGUI-3.0\AceGUI-3.0.xml
    libs\AceConfig-3.0\AceConfig-3.0.xml
    libs\AceConsole-3.0\AceConsole-3.0.xml
    libs\AceDB-3.0\AceDB-3.0.xml
    libs\AceDBOptions-3.0\AceDBOptions-3.0.xml
    libs\AceHook-3.0\AceHook-3.0.xml
    libs\AceEvent-3.0\AceEvent-3.0.xml
    libs\AceTimer-3.0\AceTimer-3.0.xml
    libs\AceLocale-3.0\AceLocale-3.0.xml
    libs\LibQuixote-2.0\lib.xml
    libs\AceGUI-3.0-SharedMediaWidgets\widget.xml
    libs\LibDataBroker-1.1\LibDataBroker-1.1.lua
    
    Tql.lua
    General.lua
    QuestLog.lua
    QuestTracker.lua


    Tql.lua
    Tql = LibStub("AceAddon-3.0"):NewAddon("Tag's Quest Log", "AceConsole-3.0")
    
    
    local options = {
        name = "Tag's Quest Log",
        handler = Tql,
        type = 'group',
        args = {
            msg = {
                type = 'input',
                name = 'My Message',
                desc = 'The message for my addon',
                set = 'SetMyMessage',
                get = 'GetMyMessage',
            },
        },
    }
    
    
    function Tql:OnInitialize()
    	Tql:RegisterChatCommand("tql", "TqlSlash")
    	self.db = LibStub("AceDB-3.0"):New("Tag's Quest Log", self.defaults, "Default")
    	self.profileOptions = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)
    end
    
    
    function Tql:OnEnable()
    	
    end
    
    
    function Tql:OnDisable()
    	
    end
    
    
    function Tql:TqlSlash(input)
    	InterfaceOptionsFrame_OpenToCategory("Tag's Quest Log")
    end
    
    
    LibStub("AceConfig-3.0"):RegisterOptionsTable("TqlProfiles", self.profileOptions)
    
    self.profilesFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("TqlProfiles", "Profiles", "Tag's Quest Log")


    I think I'm also forgetting to register the main options besides adding the Profiles, but I'm kind of lost right now and can't figure it out at all. :(

    Could anyone provide me with or tell me where to find a piece of example code I can work from, or show me where I went wrong with this piece of code? <:
    Posted in: Lua Code Discussion
  • 0

    posted a message on DogTag Questions Go Here
    That did the trick, thank you! =)
    Posted in: Unit Frames
  • 0

    posted a message on DogTag Questions Go Here
    I can't help with the above question, but I do have own of my own.

    I am currently using the following piece of code to display my health bar:
    [Outline HP " " PercentHP:Percent:Paren]
    This shows as 31063 (100%).

    But I can't seem to find how to add a thousands seperator into this, so that it would display as 31,063 or 31 063 or something similar.

    Anyone happen to know what piece of code I am looking for, or where I might find it?
    Posted in: Unit Frames
  • To post a comment, please or register a new account.