View Single Post
09-09-12, 11:28 PM   #7
Maggz
A Cyclonian
 
Maggz's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 45
Well ty again guys, i do appreciate all your help. I am having trouble with another issue now and it keep reading and still havent found my answer so possibly maybe you could also give me alil more help. What im trying to do is have my minimap icon remember its position and well i just cant seem to figure this one out, ive read 5 different sites and each one seems to have completely different ways of doing it and i cant seem to get any of them to work, so ill post my LUA file and see if you could possibly point me in a direction other than ive attempted.


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

That is the part of my LUA that has anything to do with my icon aside from my already assigned functions:
LOGSTATE()
enablelogging()
disablelogging()

my toc file contains a line reading ## SavedVariables: MaggzAutoLogDB


i cant seem to figure out what im doing wrong. its probably something so simple and im just too dumb to figure it out.
__________________
Maggz Turalyon-US
  Reply With Quote