View Single Post
10-06-15, 10:02 AM   #2
Nikita S. Doroshenko
A Cyclonian
 
Nikita S. Doroshenko's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2015
Posts: 45
This should works perfectly, this code will Hide your Minimap and Objective tracker frame, and it will show Minimap onEnter event:

Lua Code:
  1. local function HideAdvancedInderface()
  2.     -- [[ ###### HIDE CERTAIN FRAMES ###### ]]
  3.     local objects = { MinimapCluster, ObjectiveTrackerFrame } -- [[We can add here more frames for hiding on Login, for example: UIErrorsFrame, PlayerFrame, TargetFrame, PetFrame, MainMenuBar and so on...]]
  4.     for _,object in pairs(objects) do
  5.         if object then
  6.             object:Hide()
  7.         end
  8.     end
  9.     -- [[ ###### HIDE/SHOW MINIMAP ON MOUSE ENTER/LEAVE ###### ]]
  10.     local function MinimapTrigger()
  11.         local frame = CreateFrame("FRAME","MinimapTrigger",UIParent)
  12.         frame:SetAllPoints(MinimapCluster)
  13.         frame:Show()
  14.         frame:SetScript("OnEnter", function() MinimapCluster:Show() end)
  15.         frame:SetScript("OnLeave", function() MinimapCluster:Hide() end)
  16.     end
  17.     MinimapTrigger()
  18. end
  19. HideAdvancedInderface()

If you want to hide special frame, for example target, self, focus. party, raid, then change this line:
Lua Code:
  1. local objects = { MinimapCluster, ObjectiveTrackerFrame }
To something like this:
Lua Code:
  1. local objects = { MinimapCluster, ObjectiveTrackerFrame, UIErrorsFrame, PlayerFrame, TargetFrame, PetFrame }
You can find Frame names by typing in game chat "/fstack" without quotes. Then hover over frame that you want to hide, and search for Orange Fame Name, and add it to the list of objects to hide:
Lua Code:
  1. local objects = {  }

For your action bars I suggest you to use Bartender of other similar AddOns.

Remember that you can't :Hide() and :Show() Action Bars in combat (Blizzard block this for security and anti-cheat/bot reason), but you can :SetAlpha([value])

P.S. Use this code after "PLAYER_ENTERING_WORLD" Event to make thing works correctly, for sure hide all frames when LogIn, other way, some frames might not be hidden.
I use XML to load my AddOn, and track an events (but most of AddOn authors uses lua), this is XML i use to load my own AddOns:

Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
	
	<Script file="MyAddOnLuaFile.lua"/>
	<Frame>
		<Scripts>
			<OnLoad>
				self:RegisterEvent("PLAYER_ENTERING_WORLD")
			</OnLoad>
			<OnEvent>
				self:UnregisterEvent("PLAYER_ENTERING_WORLD")
				MyGlobalFunction()
			</OnEvent>
		</Scripts>
	</Frame>
</Ui>

Last edited by Nikita S. Doroshenko : 10-06-15 at 10:11 AM.
  Reply With Quote