Thread Tools Display Modes
08-07-10, 05:55 PM   #1
Bleckpan
A Fallenroot Satyr
 
Bleckpan's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2010
Posts: 22
Frame Visibility Issue

Hello everyone!

As being in the process of learning how to create addons, I have been able to break my addon in at least 50+ different ways, but I am unable to solve what I have done. With my recent update to World BG, I added an extra frame for EotS, but now neither the AB frame or the EotS frame will show up when I am in the respective battleground. After several hours of scanning over this,testing it, looking over previous version, etc. I have developed a very large feeling that this is something quite obvious that I am missing, and I think that I need a new set of eyes to look this over and see if they can find my mistake. As far as I can tell, there are no lua errors from the addon. Here is the coding to my AB frame, and here is the coding to my EotS frame. Any assistance that you could give would be appreciated. Thanks in advance.

Last edited by Bleckpan : 08-07-10 at 05:58 PM.
  Reply With Quote
08-07-10, 07:15 PM   #2
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
You can't put in a check for the event in an OnEvent script if you don't set up the function declaration properly. All your OnEvent scripts that are similar to:
Code:
ABFrame:SetScript("OnEvent", function()
	if event == "PLAYER_ENTERING_WORLD" then
		areaID = GetCurrentMapAreaID()
		if areaID == 462 then
			ABFrame:Show()
		else
			ABFrame:Hide()
		end
	else
		return
	end
end)

Should be changed to:
Code:
ABFrame:SetScript("OnEvent", function(self, event)
	if event == "PLAYER_ENTERING_WORLD" then
		if GetCurrentMapAreaID() == 462 then
			ABFrame:Show()
		else
			ABFrame:Hide()
		end
	end
end)

That said, you only register the one event so you could just remove the event check and instead do:
Code:
ABFrame:SetScript("OnEvent", function()
	if GetCurrentMapAreaID() == 462 then
		ABFrame:Show()
	else
		ABFrame:Hide()
	end
end)
  Reply With Quote
08-08-10, 09:33 AM   #3
Bleckpan
A Fallenroot Satyr
 
Bleckpan's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2010
Posts: 22
Red face

Thanks for the help, I knew it would be something obbvious.
__________________
“This is my last message to you: in sorrow, seek happiness.”
― Fyodor Dostoyevsky, The Brothers Karamazov
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Frame Visibility Issue


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