I have 4 action bars I want to hide and have them appear all at once at the press of one key. Its for toys and mounts, it does not matter which bars because they are the only bars I want to just be gone until I need them. Am using bar 1 - 4 now, would appreciate any help, thx.
For now I have it set to where all 4 bars only appear when I am in bear form but would rather toggle all 4 bars with a keybind if possible.
If you want to create a single keybinding that will toggle the visibility of action bars 1 through 4 in Bartender4, you can use the following code.
/script for i = 1, 4 do if _G["BT4Bar"..i]:IsShown() then _G["BT4Bar"..i]:Hide() else _G["BT4Bar"..i]:Show() end end
And then to bind it to a key, use this command and replace “X” with the key you want to use…
/bind X "script for i = 1, 4 do if _G["BT4Bar"..i]:IsShown() then _G["BT4Bar"..i]:Hide() else _G["BT4Bar"..i]:Show() end end"
If you want to control the visibility of each bar individually, you can use the same script but change the for loop to iterate only the specific bars you want to show or hide.
/script for i = 1, 2,3 do if _G["BT4Bar"..i]:IsShown() then _G["BT4Bar"..i]:Hide() else _G["BT4Bar"..i]:Show() end end
and then
/bind X "script for i = 1, 2,3 do if _G["BT4Bar"..i]:IsShown() then _G["BT4Bar"..i]:Hide() else _G["BT4Bar"..i]:Show() end end"
It will toggle the visibility of action bars 1,2,3 each time you press the “X” key.
May I remind you I haven’t tested this in game so you will need to try it out in your bartender settings visibility.
2 Likes
Thanks! That worked great! In that first line I made a macro out of it and it hid 3 of the 5 bars so I changed /script for i = 1, 4 into /script for i = 1, 6 and it worked great and hid them all. Thanks a lot.
Now if I can just get exp bar back, its been missing since last big patch, i figured if I don’t use the bartender exp bar the blizz one would work, but nope, still disappears as soon as I use the bartender addon. I will mess with a few more settings and hopefully get lucky.
It should be in the Bartender4 settings. The only solution I could come up with is.
To get the World of Warcraft experience bar to show while using Bartender4, you can follow these steps:
- Open Bartender4 options by typing “/bt” in your chat window.
- Go to the “Blizzard” tab.
- Check the “Experience Bar” option.
- Close the Bartender4 options.
If the Experience Bar is still not showing, try disabling all other bars in Bartender4 and then re-enabling the Experience Bar to see if that fixes the issue. If not you can always ask the creator of bartender4 in CurseForge I’m sure he would know more.
Glad the other code worked for you!
Hello bro, that scrip only works for my on bar1, any idea why? Thx mate!
I believe your issue is here:
for i = 1, 2, 3
you need to change the 1, 2, 3 to correspond to the bars you want to show or hide.
for i = 1, 2, 3 do
That expression is saying,
for i = 1 to 2 in steps of 3 do
So the loop goes
1
1 + 3 (4)
4 is more the 2 so only 1 is processed.
If you just want the first 3 bars then:
for i = 1, 3 do
-- ...
end
2 Likes
ah fair enough, my lua is incredibly rusty so I wasn’t sure if it was describing a range or providing an iterable and guessed based on the later part of Evilfranz’s answer it was an iterable.
I guess that’s what I get for not googling things first.
You could
local bars = { 1, 3, 4, 6, 7, } -- whichever bars you want to process.
for i, barNum in ipairs(bars) do
local bar = _G["BT4Bar"..barNum]
bar:SetShown(not bar:IsShown())
end
1 Like