What you want to do isn't possible using macro conditionals.
[target=player, exists] show; hide means "if the player exists, then show, otherwise hide". The "target" condition specifies the target of the macro's action, eg.
/cast [target=focus] Polymorph to cast Polymorph on your focus unit.
There is no macro condition for comparing your target to a specific unit. You can only check whether the
target of the macro (by default, your target, though you can use the "target" condition to specify a different target, as in the Polymorph example) is friendly or hostile, with the "help" and "harm" conditions.
You could, however, write a small, separate addon to show or hide your bag bar depending on your current target:
Code:
local state
local BagBar = Bartender4:GetModule("BagBar")
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_TARGET_CHANGED")
f:SetScript("OnEvent", function()
local newstate = not not UnitIsUnit("player", "target") -- the "not not" forces it to be a boolean value
if newstate == state then return end -- quit if the state didn't change
state = newstate -- record the new state
BagBar:ToggleModule(state) -- toggle the BT4 BagBar module on/off based on the new state
end)
Use
http://addon.bool.no/ to turn the above code into an addon. Before downloading, click the "Show advanced (TOC) options" button and add this line in the additional box that appears, to make sure BT4 loads before your addon; otherwise you may get errors:
Code:
## Dependencies: Bartender4