Guest User

Untitled

a guest
Jun 17th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. --[[ ONEVENT ]]
  2. function CFM_OnEvent()
  3. if (event == "ADDON_LOADED") then
  4. if (arg1 == "CFM") then
  5. chat("CFM Loaded")
  6. -- check for saved vars or create new
  7. CFM_Profiles = CFM_Profiles or {};
  8. CFM_Profiles[realm] = CFM_Profiles[realm] or {};
  9. CFM_Profiles[realm][toon] = CFM_Profiles[realm][toon] or {};
  10. activeProfile = CFM_Profiles[realm][toon]
  11. end
  12. elseif (event == "VARIABLES_LOADED") then
  13. chat("Variables Loaded")
  14. CFM_VL = true
  15. elseif (event == "PLAYER_ENTERING_WORLD") then
  16. chat("Player Entering World")
  17. CFM_PEW = true
  18. if CFM_VL then
  19. chat("CFM_VL and CFM_PEW are true")
  20. CFM_Delay = true
  21. end
  22. elseif (event == "CURSOR_UPDATE") then
  23. --CFM_GetFrameName()
  24. end
  25. end
  26.  
  27. --[[ ONUPDATE]]
  28. function CFM_OnUpdate(self, elapsed)
  29. if self.delay then
  30. self.delay = self.delay - elapsed
  31. if self.delay < 0 then
  32. self.delay = nil
  33. CFM_Loaded = true
  34. for k,_ in pairs(activeProfile) do
  35. CFM_ApplySettings(activeProfile[k])
  36. end
  37. end
  38. else
  39. if CFM_Delay and not CFM_Loaded then
  40. self.delay = 1
  41. end
  42. end
  43. end
  44.  
  45. function CFM_ApplySettings(frame)
  46. -- apply frame's settings
  47. if activeProfile[frame] ~= nil then
  48. local parent, point, relativePoint, offsetX, offsetY, width, height, scale
  49. parent = activeProfile[frame].parent
  50. point = activeProfile[frame].point
  51. relativePoint = activeProfile[frame].relativePoint
  52. offsetX = activeProfile[frame].offsetX
  53. offsetY = activeProfile[frame].offsetY
  54. width = activeProfile[frame].width
  55. height = activeProfile[frame].height
  56. scale = activeProfile[frame].scale
  57. getglobal(frame):ClearAllPoints()
  58. CFM_SetScale(frame, scale)
  59. getglobal(frame):SetPoint(point, parent, relativePoint, offsetX, offsetY)
  60. CFM_Mover_YPos:SetText(offsetY)
  61. CFM_Mover_XPos:SetText(offsetX)
  62. end
  63. end
  64.  
  65.  
  66. ##Saved Variable trying to load
  67. CFM_Profiles = {
  68. ["Thunderlord"] = {
  69. ["Modtest"] = {
  70.  
  71. ["Minimap"] = {
  72. ["point"] = "CENTER",
  73. ["parent"] = "MinimapCluster",
  74. ["width"] = 139.9999954201288,
  75. ["name"] = "Minimap",
  76. ["forceHide"] = false,
  77. ["relativePoint"] = "TOP",
  78. ["height"] = 139.9999954201288,
  79. ["offsetY"] = -500,
  80. ["scale"] = 1,
  81. ["offsetX"] = 0,
  82. },
  83. },
  84. },
  85. }
Add Comment
Please, Sign In to add comment