Quantcast Error on Move Frame Addon - WoWInterface
Thread Tools Display Modes
01-28-20, 11:39 PM   #1
BloodDragon
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2017
Posts: 16
Question Error on Move Frame Addon

Hey,
I want to make an addon to move different frames.
So far, it works quite well.
But with the frame AzeriteEssenceUI I always get the following error:

Code:
1x MoveAround\AzeriteEssenceUI.lua:3: attempt to index local 'MAEU' (a nil value)
[string "@MoveAround\AzeriteEssenceUI.lua"]:3: in main chunk

Locals:
MAEU = nil
(*temporary) = <function> defined @MoveAround\AzeriteEssenceUI.lua:3
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index local 'MAEU' (a nil value)"
That is the lua file:
Lua Code:
  1. --AzeriteEssenceUI
  2. local MAEU = AzeriteEssenceUI
  3. MAEU.ClearAllPoints = function() end
  4. MAEU:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOM", 45, -5)
  5. MAEU.SetPoint = function() end
  6. MAEU:SetMovable(true)
  7. MAEU:SetUserPlaced(true)
  8. MAEU:SetClampedToScreen(true)
  9.  
  10. local MoveAzeriteEssenceUI = CreateFrame("Frame", nil, MAEU)  
  11. MoveAzeriteEssenceUI:SetHeight(15)
  12. MoveAzeriteEssenceUI:ClearAllPoints()
  13. MoveAzeriteEssenceUI:SetPoint("TOPLEFT", MAEU)
  14. MoveAzeriteEssenceUI:SetPoint("TOPRIGHT", MAEU)
  15. MoveAzeriteEssenceUI:EnableMouse(true)
  16. MoveAzeriteEssenceUI:SetHitRectInsets(-5, -5, -5, -5)
  17. MoveAzeriteEssenceUI:RegisterForDrag("LeftButton")
  18. MoveAzeriteEssenceUI:SetScript("OnDragStart", function(self, button)
  19.     if button=="LeftButton" and IsModifiedClick()then
  20.         MAEU:StartMoving()
  21.     end
  22. end)
  23. MoveAzeriteEssenceUI:SetScript("OnDragStop", function(self, button)
  24.     MAEU:StopMovingOrSizing()
  25. end)
  26. --AzeriteEssenceUI

Can you tell me where the mistake is?
With the frames: ObjectiveTrackerFrame, VehicleSeatIndicator, SpellBookFrame it works without problems.
  Reply With Quote
01-29-20, 12:40 AM   #2
jeruku
A Cobalt Mageweaver
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 214
From what I see I'm guessing you don't wait for the Blizzard load-on-demand addon to load. Your best best is to find what addon, likely Blizzard_AzeriteEssenceUI, and perform your changes when the addon is loaded.
__________________
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison
  Reply With Quote
01-29-20, 01:38 AM   #3
BloodDragon
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2017
Posts: 16
hmmm how can i do this?
  Reply With Quote
01-29-20, 06:45 AM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,444
This page explains the loading process and includes the event you need to check for.

https://wow.gamepedia.com/AddOn_loading_process

ADDON_LOADED will trigger for any addon that is loaded when you first log into the game.

The first argument is the name of the addon which is what you want to check for.. once you know the addon you are looking for is loaded you know the variables you want to use are available.


Lua Code:
  1. local function onEvent(self,event,...)
  2.  
  3.     if event == "ADDON_LOADED" then
  4.         local addonLoaded = ...
  5.         if addonLoaded == addonNameWaitingFor then
  6.           -- Work with stuff to do with the addon in question
  7.         end
  8.  
  9.     elseif event == "VARIABLES_LOADED" then
  10.         -- current addon has its variables loaded
  11.  
  12.     elseif event == "PLAYER_LOGIN" then
  13.         -- the player has logged into the game
  14.  
  15.     elseif event == "PLAYER_ENTERING_WORLD" then
  16.         local login, reload = ...
  17.         if login then
  18.            -- Deal with once only initialisation of details that should never change between reloads
  19.         elseif reload then
  20.           -- Deal with reloaded information that may have changed since login
  21.         end
  22.        
  23.     elseif event == "PLAYER_LOGOUT" then
  24.         -- Player is logging out .. deal with last minute changes here
  25.  
  26.     end
  27.    
  28. end
  29.  
  30. local frame = CreateFrame("Frame")
  31. frame:RegisterEvent("ADDON_LOADED")
  32. frame:RegisterEvent("VARIABLES_LOADED")
  33. frame:RegisterEvent("PLAYER_LOGIN")
  34. frame:RegisterEvent("PLAYER_ENTERING_WORLD")
  35. frame:RegisterEvent("PLAYER_LOGOUT")
  36. frame:SetScript("OnEvent",onEvent)
__________________

Last edited by Xrystal : 01-29-20 at 06:57 AM.
  Reply With Quote
01-29-20, 09:14 AM   #5
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,206
ADDON_LOADED will trigger for any addon that is loaded when you first log into the game.
Small qualifier,

ADDON_LOADED will trigger for the addon that registers for the event and any other addons that load after** it (addons that load before "yours" will not trigger the event).


**Assumes registration is done when the addon code is initially loaded.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 01-29-20 at 09:26 AM.
  Reply With Quote
01-29-20, 10:19 AM   #6
jeruku
A Cobalt Mageweaver
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 214
Edit: Thanks to Vrul who pointed out my error. I've fixed the following code for posterity.

ADDON_LOADED triggers if, as you'd assume, an addon is loaded; this includes Load-On-Demand addons, like Blizzard_AzeriteEssenceUI. I can't recall off hand what other UI objects are LOD but you can reuse the event frame for those as needed; you can check an export of the interface files for the Blizzard_Addons which include Load-On-Demand in their TOC.
You could use LoadAddOn, but loading an addon that you likely won't use for 109 levels on a level 1 is rather pointless; I'd only recommend it if it's a UI object that can be used on any level/class/race.

Lua Code:
  1. local EventFrame = CreateFrame('Frame', nil, UIParent)
  2. EventFrame:RegisterEvent('ADDON_LOADED')
  3.  
  4. EventFrame:SetScript('OnEvent', function(self, event, name)
  5.     if event == 'ADDON_LOADED' then
  6.         if name == 'Blizzard_AzeriteEssenceUI' then
  7.             --AzeriteEssenceUI
  8.             local MAEU = AzeriteEssenceUI
  9.             MAEU.ClearAllPoints = function() end
  10.             MAEU:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOM", 45, -5)
  11.             MAEU.SetPoint = function() end
  12.             MAEU:SetMovable(true)
  13.             MAEU:SetUserPlaced(true)
  14.             MAEU:SetClampedToScreen(true)
  15.          
  16.             local MoveAzeriteEssenceUI = CreateFrame("Frame", nil, MAEU)  
  17.             MoveAzeriteEssenceUI:SetHeight(15)
  18.             MoveAzeriteEssenceUI:ClearAllPoints()
  19.             MoveAzeriteEssenceUI:SetPoint("TOPLEFT", MAEU)
  20.             MoveAzeriteEssenceUI:SetPoint("TOPRIGHT", MAEU)
  21.             MoveAzeriteEssenceUI:EnableMouse(true)
  22.             MoveAzeriteEssenceUI:SetHitRectInsets(-5, -5, -5, -5)
  23.             MoveAzeriteEssenceUI:RegisterForDrag("LeftButton")
  24.             MoveAzeriteEssenceUI:SetScript("OnDragStart", function(self, button)
  25.                 if button=="LeftButton" and IsModifiedClick()then
  26.                     MAEU:StartMoving()
  27.                 end
  28.             end)
  29.             MoveAzeriteEssenceUI:SetScript("OnDragStop", function(self, button)
  30.                 MAEU:StopMovingOrSizing()
  31.             end)
  32.             --AzeriteEssenceUI
  33.         end
  34.     end
  35. end)

Doing multiple LOD objects:
Lua Code:
  1. EventFrame:SetScript('OnEvent', function(self, event)
  2.     if event == 'ADDON_LOADED' then
  3.         if name == 'Blizzard_AzeriteEssenceUI' then
  4.             --AzeriteEssenceUI
  5.         elseif name == 'InsertUINameHere' then
  6.             --Mover code for InsertUINameHere
  7.         end
  8.     end
  9. end)

To export interface files:
  1. Head over to your WoW install folder and create a shortcut for WoW.exe
  2. Right-click the WoW shortcut and click "Properties".
  3. In the "Target" box, add -console while preserving any quotation marks that may be there. This must be placed after the quotation mark; it should look something like "C:/<Path to WoW>/WoW.exe" -- console
  4. Click "OK".
  5. Use the shortcut; this is done normally by double-clicking, or clicking once if single-click is enabled.
  6. At the login screen hit '`'; that's '~' without hitting shift. Follow further instructions here if your keyboard layout doesn't include '`'.
  7. Input "ExportInterfaceFiles code" without quotes in the console and press enter; it will take a while, I recommend not playing during this time.
  8. When complete you'll find a folder called BlizzardInterfaceCode in your WoW folder.
  9. Dig through Blizzard code to your hearts content.
__________________
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison

Last edited by jeruku : 01-30-20 at 10:51 AM. Reason: Cross your 't's and dot your 'i's.
  Reply With Quote
01-29-20, 04:26 PM   #7
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,444
Originally Posted by Fizzlemizz View Post
Small qualifier,

ADDON_LOADED will trigger for the addon that registers for the event and any other addons that load after** it (addons that load before "yours" will not trigger the event).


**Assumes registration is done when the addon code is initially loaded.
*slaps head* .. you can tell its been a long while .. of course it can't see the others before the current addon is loaded rofl. Thanks for clarifying
__________________
  Reply With Quote
01-30-20, 12:15 AM   #8
BloodDragon
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2017
Posts: 16
Originally Posted by jeruku View Post
ADDON_LOADED triggers if, as you'd assume, an addon is loaded; this includes Load-On-Demand addons, like Blizzard_AzeriteEssenceUI. I can't recall off hand what other UI objects are LOD but you can reuse the event frame for those as needed; you can check an export of the interface files for the Blizzard_Addons which include Load-On-Demand in their TOC.
You could use LoadAddOn, but loading an addon that you likely won't use for 109 levels on a level 1 is rather pointless; I'd only recommend it if it's a UI object that can be used on any level/class/race.

Lua Code:
  1. local EventFrame = CreateFrame('Frame', nil, UIParent)
  2. EventFrame:RegisterEvent('ADDON_LOADED')
  3.  
  4. EventFrame:SetScript('OnEvent', function(self, event)
  5.     if event == 'Blizzard_AzeriteEssenceUI' then
  6.         --AzeriteEssenceUI
  7.         local MAEU = AzeriteEssenceUI
  8.         MAEU.ClearAllPoints = function() end
  9.         MAEU:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOM", 45, -5)
  10.         MAEU.SetPoint = function() end
  11.         MAEU:SetMovable(true)
  12.         MAEU:SetUserPlaced(true)
  13.         MAEU:SetClampedToScreen(true)
  14.          
  15.         local MoveAzeriteEssenceUI = CreateFrame("Frame", nil, MAEU)  
  16.         MoveAzeriteEssenceUI:SetHeight(15)
  17.         MoveAzeriteEssenceUI:ClearAllPoints()
  18.         MoveAzeriteEssenceUI:SetPoint("TOPLEFT", MAEU)
  19.         MoveAzeriteEssenceUI:SetPoint("TOPRIGHT", MAEU)
  20.         MoveAzeriteEssenceUI:EnableMouse(true)
  21.         MoveAzeriteEssenceUI:SetHitRectInsets(-5, -5, -5, -5)
  22.         MoveAzeriteEssenceUI:RegisterForDrag("LeftButton")
  23.         MoveAzeriteEssenceUI:SetScript("OnDragStart", function(self, button)
  24.             if button=="LeftButton" and IsModifiedClick()then
  25.                 MAEU:StartMoving()
  26.             end
  27.         end)
  28.         MoveAzeriteEssenceUI:SetScript("OnDragStop", function(self, button)
  29.             MAEU:StopMovingOrSizing()
  30.         end)
  31.         --AzeriteEssenceUI
  32.     end
  33. end)

Doing multiple LOD objects:
Lua Code:
  1. EventFrame:SetScript('OnEvent', function(self, event)
  2.     if event == 'Blizzard_AzeriteEssenceUI' then
  3.         --AzeriteEssenceUI
  4.     elseif event == 'Blizzard_InsertNameHere' then
  5.         --InserNameHereUI mover code
  6.     end
  7. end)
I can no longer move a frame with the lua code. There is no error message, but moving the frames is no longer possible.
  Reply With Quote
01-30-20, 02:08 AM   #9
jeruku
A Cobalt Mageweaver
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 214
If you copy-pasted the first example it should have worked or threw an error if there was a typo (I'm prone to those.)
If you're attempting to use the example of "multiple LODs" for all frames you'll get nowhere. You should only use that in case you need it for another Blizzard addon that doesn't load at start.
And if all else fails post the full code, it helps leagues more than snippets as WoWI authors can help you in greater detail.
__________________
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison
  Reply With Quote
01-30-20, 03:17 AM   #10
BloodDragon
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2017
Posts: 16
I Have test this one:
Lua Code:
  1. local EventFrame = CreateFrame('Frame', nil, UIParent)
  2.     EventFrame:RegisterEvent('ADDON_LOADED')
  3.      
  4.     EventFrame:SetScript('OnEvent', function(self, event)
  5.         if event == 'Blizzard_AzeriteEssenceUI' then
  6.             --AzeriteEssenceUI
  7.             local MAEU = AzeriteEssenceUI
  8.             MAEU.ClearAllPoints = function() end
  9.             MAEU:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOM", 45, -5)
  10.             MAEU.SetPoint = function() end
  11.             MAEU:SetMovable(true)
  12.             MAEU:SetUserPlaced(true)
  13.             MAEU:SetClampedToScreen(true)
  14.              
  15.             local MoveAzeriteEssenceUI = CreateFrame("Frame", nil, MAEU)  
  16.             MoveAzeriteEssenceUI:SetHeight(15)
  17.             MoveAzeriteEssenceUI:ClearAllPoints()
  18.             MoveAzeriteEssenceUI:SetPoint("TOPLEFT", MAEU)
  19.             MoveAzeriteEssenceUI:SetPoint("TOPRIGHT", MAEU)
  20.             MoveAzeriteEssenceUI:EnableMouse(true)
  21.             MoveAzeriteEssenceUI:SetHitRectInsets(-5, -5, -5, -5)
  22.             MoveAzeriteEssenceUI:RegisterForDrag("LeftButton")
  23.             MoveAzeriteEssenceUI:SetScript("OnDragStart", function(self, button)
  24.                 if button=="LeftButton" and IsModifiedClick()then
  25.                     MAEU:StartMoving()
  26.                 end
  27.             end)
  28.             MoveAzeriteEssenceUI:SetScript("OnDragStop", function(self, button)
  29.                 MAEU:StopMovingOrSizing()
  30.             end)
  31.             --AzeriteEssenceUI
  32.         end
  33.     end)

There was no Error . This is the full code.
  Reply With Quote
01-30-20, 07:06 AM   #11
Vrul
An Onyxian Warder
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 352
The event is "ADDON_LOADED" and the name of the addon that just loaded would be "Blizzard_AzeriteEssenceUI"
Code:
local EventFrame = CreateFrame('Frame', nil, UIParent)
    EventFrame:RegisterEvent('ADDON_LOADED')
     
    EventFrame:SetScript('OnEvent', function(self, event, name)
        if name == 'Blizzard_AzeriteEssenceUI' then
            --AzeriteEssenceUI
            local MAEU = AzeriteEssenceUI
            MAEU.ClearAllPoints = function() end
            MAEU:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOM", 45, -5) 
            MAEU.SetPoint = function() end
            MAEU:SetMovable(true)
            MAEU:SetUserPlaced(true)
            MAEU:SetClampedToScreen(true)
             
            local MoveAzeriteEssenceUI = CreateFrame("Frame", nil, MAEU)  
            MoveAzeriteEssenceUI:SetHeight(15)
            MoveAzeriteEssenceUI:ClearAllPoints()
            MoveAzeriteEssenceUI:SetPoint("TOPLEFT", MAEU)
            MoveAzeriteEssenceUI:SetPoint("TOPRIGHT", MAEU)
            MoveAzeriteEssenceUI:EnableMouse(true)
            MoveAzeriteEssenceUI:SetHitRectInsets(-5, -5, -5, -5)
            MoveAzeriteEssenceUI:RegisterForDrag("LeftButton")
            MoveAzeriteEssenceUI:SetScript("OnDragStart", function(self, button)
                if button=="LeftButton" and IsModifiedClick()then
                    MAEU:StartMoving()
                end
            end)
            MoveAzeriteEssenceUI:SetScript("OnDragStop", function(self, button)
                MAEU:StopMovingOrSizing()
            end)
            --AzeriteEssenceUI
        end
    end)
Since you only register one event you don't need to check which event triggered the OnEvent script.
  Reply With Quote
01-30-20, 08:04 AM   #12
BloodDragon
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2017
Posts: 16
Originally Posted by Vrul View Post
The event is "ADDON_LOADED" and the name of the addon that just loaded would be "Blizzard_AzeriteEssenceUI"
Code:
local EventFrame = CreateFrame('Frame', nil, UIParent)
    EventFrame:RegisterEvent('ADDON_LOADED')
     
    EventFrame:SetScript('OnEvent', function(self, event, name)
        if name == 'Blizzard_AzeriteEssenceUI' then
            --AzeriteEssenceUI
            local MAEU = AzeriteEssenceUI
            MAEU.ClearAllPoints = function() end
            MAEU:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOM", 45, -5) 
            MAEU.SetPoint = function() end
            MAEU:SetMovable(true)
            MAEU:SetUserPlaced(true)
            MAEU:SetClampedToScreen(true)
             
            local MoveAzeriteEssenceUI = CreateFrame("Frame", nil, MAEU)  
            MoveAzeriteEssenceUI:SetHeight(15)
            MoveAzeriteEssenceUI:ClearAllPoints()
            MoveAzeriteEssenceUI:SetPoint("TOPLEFT", MAEU)
            MoveAzeriteEssenceUI:SetPoint("TOPRIGHT", MAEU)
            MoveAzeriteEssenceUI:EnableMouse(true)
            MoveAzeriteEssenceUI:SetHitRectInsets(-5, -5, -5, -5)
            MoveAzeriteEssenceUI:RegisterForDrag("LeftButton")
            MoveAzeriteEssenceUI:SetScript("OnDragStart", function(self, button)
                if button=="LeftButton" and IsModifiedClick()then
                    MAEU:StartMoving()
                end
            end)
            MoveAzeriteEssenceUI:SetScript("OnDragStop", function(self, button)
                MAEU:StopMovingOrSizing()
            end)
            --AzeriteEssenceUI
        end
    end)
Since you only register one event you don't need to check which event triggered the OnEvent script.
Oh I'm stupid, sorry I have it now. The frame can now be moved, but the position is reset with every reload or wow restart.

I thank you in advance for all the help you have invested in me so far. I really don't know much about lua.
  Reply With Quote
01-30-20, 08:54 AM   #13
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,206
Because the addon is LOD, its frame is created after the PLAYER_LOGIN event which means SetUserPlaced doesn't work (save/restore the last known position).

You will need to save/restore it's position manually or you could try creating your drag frame when your addon loads (ie. use your EventFrame (and give it a name) for the drag frame and set it as dragable, user placed, OnDragSart/Stop etc.) and when the AzeriteEssenceUI is loaded, resize it to the width of the AzeriteEssenceUIx15 and Clear/SetPoint the AzeriteEssenceUI to your EventFrame.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 01-30-20 at 09:30 AM.
  Reply With Quote
01-30-20, 10:46 AM   #14
jeruku
A Cobalt Mageweaver
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 214
Originally Posted by Vrul View Post
The event is "ADDON_LOADED" and the name of the addon that just loaded would be "Blizzard_AzeriteEssenceUI"

Thank you, I had brain fart.
__________________
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison
  Reply With Quote
01-30-20, 11:00 AM   #15
BloodDragon
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2017
Posts: 16
Originally Posted by Fizzlemizz View Post
Because the addon is LOD, its frame is created after the PLAYER_LOGIN event which means SetUserPlaced doesn't work (save/restore the last known position).

You will need to save/restore it's position manually or you could try creating your drag frame when your addon loads (ie. use your EventFrame (and give it a name) for the drag frame and set it as dragable, user placed, OnDragSart/Stop etc.) and when the AzeriteEssenceUI is loaded, resize it to the width of the AzeriteEssenceUIx15 and Clear/SetPoint the AzeriteEssenceUI to your EventFrame.
Ok then i have to look at which position i have to write what. Now it gets a bit complicated for me ^^.
  Reply With Quote
01-30-20, 11:26 AM   #16
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,206
Something like:

Lua Code:
  1. local EventFrame = CreateFrame("Frame", "BloodDragonAzMover", UIParent)
  2. EventFrame:Hide()
  3. EventFrame:SetSize(50, 15)
  4. EventFrame:SetFrameStrata("HIGH")
  5. EventFrame:SetPoint("TOPLEFT", 20, -100)
  6. EventFrame:SetMovable(true)
  7. EventFrame:SetClampedToScreen(true)
  8. EventFrame:EnableMouse(true)
  9. EventFrame:SetHitRectInsets(-5, -5, -5, -5)
  10. EventFrame:RegisterForDrag("LeftButton")
  11. EventFrame:SetUserPlaced(true)
  12. EventFrame:SetScript("OnDragStart", function(self, button)
  13.     if button=="LeftButton" and IsModifiedClick()then
  14.         self:StartMoving()
  15.     end
  16. end)
  17. EventFrame:SetScript("OnDragStop", function(self, button)
  18.     self:StopMovingOrSizing()
  19. end)
  20. EventFrame:SetScript('OnEvent', function(self, event, name)
  21.     if name == 'Blizzard_AzeriteEssenceUI' then
  22.         self:UnregisterAllEvents()
  23.         local MAEU = AzeriteEssenceUI
  24.         self:SetParent(MAEU)
  25.         self:SetSize(MAEU:GetWidth()-50, 15) -- -50 to not block the close button
  26.         MAEU:ClearAllPoints()
  27.         MAEU:SetPoint("TOP", self)
  28.         MAEU.ClearAllPoints = function() end
  29.         MAEU.SetPoint = function() end
  30.         self:Show()
  31.     end
  32. end)
  33. EventFrame:RegisterEvent('ADDON_LOADED')
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 01-30-20 at 11:37 AM.
  Reply With Quote
01-31-20, 05:33 AM   #17
BloodDragon
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2017
Posts: 16
Originally Posted by Fizzlemizz View Post
Something like:

Lua Code:
  1. local EventFrame = CreateFrame("Frame", "BloodDragonAzMover", UIParent)
  2. EventFrame:Hide()
  3. EventFrame:SetSize(50, 15)
  4. EventFrame:SetFrameStrata("HIGH")
  5. EventFrame:SetPoint("TOPLEFT", 20, -100)
  6. EventFrame:SetMovable(true)
  7. EventFrame:SetClampedToScreen(true)
  8. EventFrame:EnableMouse(true)
  9. EventFrame:SetHitRectInsets(-5, -5, -5, -5)
  10. EventFrame:RegisterForDrag("LeftButton")
  11. EventFrame:SetUserPlaced(true)
  12. EventFrame:SetScript("OnDragStart", function(self, button)
  13.     if button=="LeftButton" and IsModifiedClick()then
  14.         self:StartMoving()
  15.     end
  16. end)
  17. EventFrame:SetScript("OnDragStop", function(self, button)
  18.     self:StopMovingOrSizing()
  19. end)
  20. EventFrame:SetScript('OnEvent', function(self, event, name)
  21.     if name == 'Blizzard_AzeriteEssenceUI' then
  22.         self:UnregisterAllEvents()
  23.         local MAEU = AzeriteEssenceUI
  24.         self:SetParent(MAEU)
  25.         self:SetSize(MAEU:GetWidth()-50, 15) -- -50 to not block the close button
  26.         MAEU:ClearAllPoints()
  27.         MAEU:SetPoint("TOP", self)
  28.         MAEU.ClearAllPoints = function() end
  29.         MAEU.SetPoint = function() end
  30.         self:Show()
  31.     end
  32. end)
  33. EventFrame:RegisterEvent('ADDON_LOADED')
ohhh cool thx alot, that works very nice.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Error on Move Frame Addon

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off