FCRCS = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceConsole-2.0", "AceDB-2.0"); local dewdrop = AceLibrary("Dewdrop-2.0") options = { type='group', args = { msg = { type = 'text', name = 'msg', desc = 'The message text to be displayed', usage = "", get = "GetMessage", set = "SetMessage", }, showInChat = { type = 'toggle', name = 'Show in Chat', desc = 'Toggles the display of the message in the chat window', get = "IsShowInChat", set = "ToggleShowInChat", }, showOnScreen = { type = 'toggle', name = 'Show on Screen', desc = 'Toggles the display of the message on the screen', get = "IsShowOnScreen", set = "ToggleShowOnScreen" }, gui = { type = "execute", name = "Show GUI", desc = "Toggles Main Gui", func = "ShowGui" }, }, } FCRCS:RegisterChatCommand({"/FCRCS", "/fc"}, options) FCRCS:RegisterDB("FCRCSDB", "FCRCSDBPC") FCRCS:RegisterDefaults("profile", { message = "You've changed zones!", showInChat = false, showOnScreen = true, gui = false, } ) function FCRCS:OnEnable() -- Called when the addon is enabled self:RegisterEvent("ZONE_CHANGED_NEW_AREA") end function FCRCS:ZONE_CHANGED_NEW_AREA() if self.db.profile.showInChat then self:Print(self.db.profile.message); end if self.db.profile.showOnScreen then UIErrorsFrame:AddMessage(self.db.profile.message, 1.0, 1.0, 1.0, 5.0); end end function FCRCS:GetMessage() return self.db.profile.message end function FCRCS:SetMessage(newValue) self.db.profile.message = newValue end function FCRCS:IsShowInChat() return self.db.profile.showInChat end function FCRCS:ToggleShowInChat() self.db.profile.showInChat = not self.db.profile.showInChat end function FCRCS:IsShowOnScreen() return self.db.profile.showOnScreen end function FCRCS:ToggleShowOnScreen() self.db.profile.showOnScreen = not self.db.profile.showOnScreen end function FCRCS:ShowGui() local frame = getglobal("FCRCSMain") if (frame) then if( frame:IsVisible() ) then frame:Hide(); else frame:Show(); end end end function OnInitialize() dewdrop:Register(FCRCSMain, 'children', function() dewdrop:AddLine( 'text', "Hello, world" ) end) end