Quantcast Lua, Help with Event for moving BuffFrame - WoWInterface
Thread Tools Display Modes
02-04-20, 06:49 AM   #1
tilik09
A Kobold Labourer
Join Date: Feb 2020
Posts: 1
Lua, Help with Event for moving BuffFrame

Hello Guys,

I am new to lua scripting, and I have a problem with RegisterEvent.
I was running a custom addon usually just to hide stuff like error speach or player text healing
ex: UIErrorsFrame:Hide()
This commands where executed on Frame:RegisterEvent("PLAYER_LOGIN") and was working ok.

Now I took it a step further and wanted to play a bit with the Buff, Debuff Frames to move an anchor them as I please.
The problem is that Frame:RegisterEvent("PLAYER_LOGIN") does not work for moving the BuffFrame.

From my understanding, it seems like my addon loads and executes the code before the Default Blizzard Action that handles the de buff positioning.

For testing, I tried to use "CHAT_MSG_YELL" and "UNIT_AURA" events. And it seems it is working as intended. When I type in chat "/y test" the addon fires and adjusts the positioning of the frame.
Same when I receive a new aura (Power world shield for example).

Is there a way, to simply execute my positioning commands just Once and not everytime I get a new aura?
(Similar behavior as Player_Login which executes commands /console reloadui)

Code:
local Frame = CreateFrame("Frame")
Frame:RegisterEvent("PLAYER_LOGIN")
Frame:RegisterEvent("CHAT_MSG_YELL")
Frame:RegisterEvent("UNIT_AURA")

--Frame:SetScript("OnEvent", function(self, event, ...)


Frame:SetScript("OnEvent", function(...)
	--Your hiding code goes between this line


	minimapSortButtons();
	playerBuffs();

	--And this one
end)


function minimapSortButtons()
	UIErrorsFrame:Hide();
	print ("function");
	print ("Test1");
end

function playerBuffs()
	local pb = BuffFrame:GetName();	
	BuffFrame:Show();
	BuffFrame:ClearAllPoints();
	BuffFrame:SetPoint("TOPRIGHT",MinimapCluster,"TOPLEFT",-5,-5);
	--BuffFrame:SetUserPlaced(true);
	print("test2");
	print("Argh, stop with the yelling!");

end
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Lua, Help with Event for moving BuffFrame

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