1. #1

    Script/Addon to Hide Certain UI Elements

    So I want to make a script (and eventually an addon) that hides the group text above the default raid frames when the "Keep Groups Together" option is checked. According to Blizzard's framestack tooltip, these titles are called:
    CompactRaidGroup1Title
    CompactRaidGroup2Title
    CompactRaidGroup3Title
    CompactRaidGroup4Title
    CompactRaidGroup5Title
    CompactRaidGroup6Title
    CompactRaidGroup7Title
    CompactRaidGroup8Title
    CompactPartyFrameTitle
    So I made an addon with the .lua file containing:
    Code:
    CompactRaidGroup1Title:SetAlpha(0)
    CompactRaidGroup2Title:SetAlpha(0)
    CompactRaidGroup3Title:SetAlpha(0)
    CompactRaidGroup4Title:SetAlpha(0)
    CompactRaidGroup5Title:SetAlpha(0)
    CompactRaidGroup6Title:SetAlpha(0)
    CompactRaidGroup7Title:SetAlpha(0)
    CompactRaidGroup8Title:SetAlpha(0)
    CompactPartyFrameTitle:SetAlpha(0)
    And nothing happens. I was wondering if anyone could help me out (I have a proper .toc file aswell).

    I have a picture of the text I'm talking about, but can't link yet...

  2. #2
    High Overlord Crudor's Avatar
    Join Date
    Nov 2011
    Location
    Berlin
    Posts
    161
    I guess this should work (untested)

    Code:
    local function HideFrame(frame)
    	frame:HookScript("OnShow",function()
    		frame:Hide()
    	end)
    	frame:UnregisterAllEvents()
    	frame:Hide()
    end
    
    local myFrame = CreateFrame("Frame")
    myFrame:RegisterEvent("ADDON_LOADED")
    myFrame:RegisterEvent("PLAYER_LOGIN")
    myFrame:SetScript("OnEvent",function(self,event,addon)
    	if event == "PLAYER_LOGIN" then
    		HideFrame(CompactPartyFrameTitle)
    	elseif addon == "Blizzard_CompactRaidFrames" then
    		for i = 1,8 do
    			HideFrame(_G["CompactRaidGroup"..i.."Title"])
    		end
    	end
    end)
    Last edited by Crudor; 2013-07-05 at 07:16 AM.

  3. #3
    Quote Originally Posted by Crudor View Post
    I guess this should work (untested)

    Code:
    local function HideFrame(frame)
    	frame:HookScript("OnShow",function()
    		frame:Hide()
    	end)
    	frame:UnregisterAllEvents()
    	frame:Hide()
    end
    
    local myFrame = CreateFrame("Frame")
    myFrame:RegisterEvent("ADDON_LOADED")
    myFrame:RegisterEvent("PLAYER_LOGIN")
    myFrame:SetScript("OnEvent",function(self,event,addon)
    	if event == "PLAYER_LOGIN" then
    		HideFrame(CompactPartyFrameTitle)
    	elseif addon == "Blizzard_CompactRaidFrames" then
    		for i = 1,8 do
    			HideFrame(_G["CompactRaidGroup"..i.."Title"])
    		end
    	end
    end)
    Unfortunately, that doesn't seem to work... Maybe my .toc is wrong, do I have to put anything special in there?

  4. #4
    High Overlord Crudor's Avatar
    Join Date
    Nov 2011
    Location
    Berlin
    Posts
    161
    You don't need anything special in the TOC. The script was wrong. This works for me now:

    Code:
    local done1, done2 = false, 0
    
    local function HideTitles()
    	if done1 and (done2 == 8) then
    		return
    	end
    	
    	if CompactPartyFrameTitle and not done1 then
    		CompactPartyFrameTitle:SetAlpha(0)
    		done1 = true
    	end
    	
    	for i = 1,8 do
    		if _G["CompactRaidGroup"..i.."Title"] then
    			if i > done2 then
    				_G["CompactRaidGroup"..i.."Title"]:SetAlpha(0)
    				done2 = i
    			end
    		end
    	end
    end
    
    local myFrame = CreateFrame("Frame")
    myFrame:RegisterEvent("GROUP_ROSTER_UPDATE")
    myFrame:SetScript("OnEvent",function()
    	HideTitles()
    	if done1 and (done2 == 8) then
    		myFrame:UnregisterAllEvents()
    	end
    end)
    If you switch between "keep groups together" and "keep groups NOT together" (for whatever reason...) you will also need this line: hooksecurefunc("CompactUnitFrameProfiles_ApplyCurrentSettings",HideTitles)

  5. #5
    Quote Originally Posted by Crudor View Post
    You don't need anything special in the TOC. The script was wrong. This works for me now:

    Code:
    local done1, done2 = false, 0
    
    local function HideTitles()
    	if done1 and (done2 == 8) then
    		return
    	end
    	
    	if CompactPartyFrameTitle and not done1 then
    		CompactPartyFrameTitle:SetAlpha(0)
    		done1 = true
    	end
    	
    	for i = 1,8 do
    		if _G["CompactRaidGroup"..i.."Title"] then
    			if i > done2 then
    				_G["CompactRaidGroup"..i.."Title"]:SetAlpha(0)
    				done2 = i
    			end
    		end
    	end
    end
    
    local myFrame = CreateFrame("Frame")
    myFrame:RegisterEvent("GROUP_ROSTER_UPDATE")
    myFrame:SetScript("OnEvent",function()
    	HideTitles()
    	if done1 and (done2 == 8) then
    		myFrame:UnregisterAllEvents()
    	end
    end)
    If you switch between "keep groups together" and "keep groups NOT together" (for whatever reason...) you will also need this line: hooksecurefunc("CompactUnitFrameProfiles_ApplyCurrentSettings",HideTitles)
    That works, thank you very much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •