View Single Post
09-10-12, 02:11 PM   #10
Maggz
A Cyclonian
 
Maggz's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 45
ty for seeing that darn typo, im actually not looking to add a variable in to call for if the log is enabled, thats something i can easily do in game, im having an issue with setting and remembering minimap icon position. i have been reading alot more and did get my DB to add my character nam and realm to the DB which is something im not trying to do but atleast my DB is adding stuff altho its not the right stuff lol. ill keep at this and see if i get any luck TY all for your help here BTW.


ok with a few more changes im getting my DB to have the correct data, however i dont know how to get my minimap icon to load at the saved position, still reading thru stuff so i may end up getting this one however if someone sees changes i need to make to do this here is my NEW lua file::

Lua Code:
  1. local f = CreateFrame("Frame")
  2. MaggzAutoLog = LibStub("AceAddon-3.0"):NewAddon("MaggzAutoLog")
  3. function MaggzAutoLog:OnInitialize()
  4.   self.db = LibStub("AceDB-3.0"):New("MaggzAutoLogDB")
  5. end
  6. local db;
  7. local defaults = { 
  8.         profile = {    
  9.             LDBIconStorage = {},
  10.         },
  11. };
  12. local malObject = {
  13.     type = "launcher",
  14.     icon = "Interface\\Addons\\MaggzAutoLog\\disabled",
  15.     label = "MaggzAutoLog",
  16.     OnClick = function(self, button)
  17.         if button == "RightButton" then
  18.             LOGSTATE()
  19.         end
  20.         if button == "LeftButton" then
  21.             if LoggingCombat() then
  22.                 disablelogging()
  23.             else
  24.                 enablelogging()
  25.             end
  26.         end
  27.     end,
  28.     OnTooltipShow = function(tooltip)
  29.     tooltip:AddLine("|cff00FF00MaggzAutoLog|r");
  30.     tooltip:AddLine("hold left mouse button to drag");
  31.     tooltip:AddLine("right click to enable/disable logging");
  32.     if LoggingCombat() then
  33.         tooltip:AddLine("Logging |cff00FF00Enabled|r");
  34.     else
  35.         tooltip:AddLine("Logging |cffFF0000Disabled|r");
  36.     end
  37. end,
  38. };
  39. function updateDB(self, event, database)
  40.     db = database.profile;
  41.     LibStub("LibDBIcon-1.0"):Refresh("MaggzAutoLogDB", db.LDBIconStorage);
  42.     end
  43. local vars = LibStub("AceDB-3.0"):New("MaggzAutoLogDB", defaults);
  44. vars:RegisterCallback("OnProfileChanged", updateDB);
  45. vars:RegisterCallback("OnProfileCopied", updateDB);
  46. vars:RegisterCallback("OnProfileReset", updateDB);
  47. db = vars.profile;
  48.  
  49. LibStub("LibDataBroker-1.1"):NewDataObject("MaggzAutoLogDB", malObject);
  50. LibStub("LibDBIcon-1.0"):Register("MaggzAutoLog", malObject, db.LDBIconStorage);

still working some things out so it is still a but messy.
__________________
Maggz Turalyon-US

Last edited by Maggz : 09-10-12 at 03:19 PM. Reason: db adding correct stuff now
  Reply With Quote