Thread Tools Display Modes
05-27-18, 10:47 AM   #1
Xancepants
A Deviate Faerie Dragon
Join Date: Oct 2014
Posts: 17
Lua to hide default Arena Frames?

Hello all!
I'm using the addon GladiusEx, which is a replacement for Blizzard's default Arena Frames, but there is no option to hide the default arena frames. I've dug through a lot of forums and found numerous different suggestions, but have yet to find one that works. Is there a simple /console command or CVAR that I haven't come across yet? Or perhaps a Lua script to turn them off?


Here is what I've tried so far:

Lua Code:
  1. --[Hide Default Blizzard Arena Frames]
  2. showArenaEnemyFrames = 0
  3. SetCVar("showArenaEnemyFrames", 0)
  4. LoadAddOn("Blizzard_ArenaUI");ArenaEnemyFrames:Hide();ArenaEnemyFrame1:Hide();ArenaEnemyFrame2:Hide();ArenaEnemyFrame3:Hide();ArenaEnemyFrame4:Hide();ArenaEnemyFrame5:Hide();ArenaEnemyFrame1CastingBar:Hide();ArenaEnemyFrame2CastingBar:Hide();ArenaEnemyFrame3CastingBar:Hide();ArenaEnemyFrame4CastingBar:Hide();ArenaEnemyFrame5CastingBar:Hide();


Any help is appreciated, and thank you in advance!
  Reply With Quote
05-27-18, 10:55 AM   #2
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
You can disable them in the Interface Options..
  Reply With Quote
05-27-18, 11:03 AM   #3
Xancepants
A Deviate Faerie Dragon
Join Date: Oct 2014
Posts: 17
If you check in game yourself, I believe you'll find that's not true, (at least anymore). You used to be able to, before Blizzard pruned a bunch of things from Interface Options in Legion. I know there is the addon Advanced Interface Options, which essentially brings those back, but I'm hoping to achieve this w/o the use/need of an addon.
  Reply With Quote
05-27-18, 11:03 AM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
You could try calling this function on each of the Arena Frames. This is called when you adjust the CVAR variable
Lua Code:
  1. function ArenaEnemyFrames_Disable(self)
  2.   self.show = false;
  3.   ArenaEnemyFrames_UpdateVisible();
  4. end

This is the function that calls it in Blizzards addon.
Lua Code:
  1. function ArenaEnemyFrames_CheckEffectiveEnableState(self, cvarUpdate)
  2.   if (C_PvP.IsInBrawl()) then
  3.     ArenaEnemyFrames_Disable(self);
  4.   else
  5.     if ( GetCVarBool("showArenaEnemyFrames") or cvarUpdate ) then
  6.       ArenaEnemyFrames_Enable(self);
  7.     else
  8.       ArenaEnemyFrames_Disable(self);
  9.     end
  10.   end
  11. end

Which is called by the Event Manager function
Lua Code:
  1. if ( (event == "CVAR_UPDATE") and (arg1 == "SHOW_ARENA_ENEMY_FRAMES_TEXT") ) then
  2.     ArenaEnemyFrames_CheckEffectiveEnableState(self, arg2 == "1");

Your code should work I believe but you will need to have an frame to monitor the event ADDON_LOADED so that once you Load Blizzards addon it will trigger the event and its information should be available to use and adjust. I thought the SetCVar would trigger the CVAR_UPDATE event but it is looking for a different CVAR value to what you are setting which could explain why it isn't doing anything noticable. Maybe changing

SetCVar("showArenaEnemyFrames", 0)

to

SetCVar("SHOW_ARENA_ENEMY_FRAMES_TEXT", 0)

and see how that works, then try the ADDON_LOADED steps I suggested.
__________________
  Reply With Quote
05-27-18, 11:25 AM   #5
Xancepants
A Deviate Faerie Dragon
Join Date: Oct 2014
Posts: 17
I added the line SetCVar("SHOW_ARENA_ENEMY_FRAMES_TEXT", 0), which when you enter the arena the frames still show, but once the gates open then the default frames disappear, which works just fine for me!

Thank you a ton!
  Reply With Quote
05-27-18, 12:49 PM   #6
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
SetCVar has a third parameter that is used to trigger the CVAR_UPDATE event and is the value passed as the first arg. So you would want to use
Code:
SetCVar('showArenaEnemyFrames', 0, 'SHOW_ARENA_ENEMY_FRAMES_TEXT')
to trigger that OnEvent handler (provided that Blizzard_ArenaUI is loaded).

I'm not sure why setting that CVar before Blizzard_ArenaUI is loaded isn't working though, unless some other code is unparenting ArenaEnemyFrame1-5 from ArenaEnemyFrames.
  Reply With Quote
05-28-18, 09:10 AM   #7
Cogwerkz
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2017
Posts: 12
Another thing to keep in mind when disabling things using CVars, is that you have to make sure the CVar is changed after the blizzard user settings are fully loaded for your character, or it will likely have no effect.

I usually add a check for VARIABLES_LOADED whenever I change CVars, as this is when the blizzard settings have been loaded.

Originally Posted by Vrul View Post
SetCVar
I'm not sure why setting that CVar before Blizzard_ArenaUI is loaded isn't working though, unless some other code is unparenting ArenaEnemyFrame1-5 from ArenaEnemyFrames.
Probably the above. If we change the CVar when our addon is loaded, there's a chance that the blizzard saved variables are loaded at a later point, thus rendering our CVar change useless as we did it too early in the loading process. The Blizzard_ArenaUI isn't loaded until much later, and the VARIABLES_LOADED event has probably fired long before this, thus the CVar change will have effect.

Last edited by Cogwerkz : 05-28-18 at 09:13 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Lua to hide default Arena Frames?

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