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) Lua Code:
Can you tell me where the mistake is? With the frames: ObjectiveTrackerFrame, VehicleSeatIndicator, SpellBookFrame it works without problems. |
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.
|
hmmm how can i do this?
|
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:
|
Quote:
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. |
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:
Doing multiple LOD objects: Lua Code:
To export interface files:
|
Quote:
|
Quote:
|
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 test this one:
Lua Code:
There was no Error . This is the full code. |
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) |
Quote:
I thank you in advance for all the help you have invested in me so far. I really don't know much about lua. |
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. |
Quote:
Thank you, I had brain fart. |
Quote:
|
Something like:
Lua Code:
|
Quote:
|
All times are GMT -6. The time now is 11:27 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI