Addon or Macro or whatever to change Bag names

I want to be able to change the names of my bags, including my bank bags. Instead of “Wildercloth Bag”, I want to call it “Legion” (for example). I’m not looking for categories to separate the items, I just want to name the bags. Is there any way at all to do this?

You could play with this (copy/paste to the website addon.bool.no to create/download as an addon):

local Bagname = {
	[0] = "Is Backpack?",
	[1] = "Bag 1",
	[2] = "Not your normal bag",
	[3] = "You stored what in here?",
	[4] = "An Old Bag (not mother-in-law)",
	[5] = "The Prince Reagent...bag",
----------- Bank Bags -----------
	[6] = "My Banksy Collection",
	[7] = "Bank Left NOW!",
	[8] = "I've been robbed!!!",
	[9] = "When I said deposits...",
	[10] = "Worthless",
	[11] = "You stored that in here also?",
	[12] = "I'M RICH!<cough>",
}

local function SetBagTitle(bag)
	local bagName = Bagname[bag:GetID()]
	local text = bag:GetTitleText()
	if bagName and text:GetText() ~= bagName then
		bag:SetTitle(bagName)
	end
end

local function SetTooltip(bag)
	GameTooltip:Hide()
	local tipText = {}
	local i = 1
	while _G["GameTooltipTextRight"..i] do
		local text = _G["GameTooltipTextLeft"..i]:GetText()
		tipText[#tipText + 1] = text
		i = i + 1
	end
	local id = bag:GetID()
	if bag.isBankHook then
		id = id + Enum.BagIndex.BankBag_1 - 1
		GameTooltip:SetOwner(bag, "ANCHOR_RIGHT")
	else
		GameTooltip:SetOwner(bag, "ANCHOR_LEFT")
	end
	local isPortraitTip = bag:GetParent().PortraitButton
	if id > 25 then
		id = id - 30
	end
	GameTooltip:AddLine(BLUE_FONT_COLOR:WrapTextInColorCode(Bagname[id]))
	if not isPortraitTip and not bag.isBankHook then
		local bindingKey = GetBindingKey(bag.commandName);
		if bindingKey then
			bindingKey = GetBindingText(bindingKey);
			GameTooltip:AppendText(NORMAL_FONT_COLOR:WrapTextInColorCode(" ("..bindingKey..")"));
		end
	end
 	for i=2, #tipText do
		GameTooltip:AddLine(tipText[i])
	end
	GameTooltip:Show()
end

for i=0, #Bagname do 
	local bag = _G["ContainerFrame"..i+1]
	hooksecurefunc(bag, "SetTitle", SetBagTitle) 
	bag.PortraitButton:HookScript("OnEnter", SetTooltip)
	if i < 4 then
		hooksecurefunc(_G["CharacterBag".. i .."Slot"], "OnEnterInternal", SetTooltip)
	end
end
hooksecurefunc(MainMenuBarBackpackButton, "OnEnterInternal", SetTooltip)
hooksecurefunc(CharacterReagentBag0Slot, "OnEnterInternal", SetTooltip)
hooksecurefunc("UpdateBagSlotStatus", function()
	for i=1, NUM_BANKBAGSLOTS, 1 do
		button = BankSlotsFrame["Bag"..i]
		if not button.isBankHook then 
			button.isBankHook = true
			hooksecurefunc(button, "UpdateTooltip", SetTooltip)
			button:HookScript("OnEnter", SetTooltip)
		end
	end
end)
1 Like

It worked flawlessly!!! Thank you so much!! Is there a way to add the bank bags?

I’m sure there is. If no-one pitches in first and I get some time later on I’ll take a look.

Updated the original code post to include banks (not guild as those tabs can have custom names). It’s a bit rough but all I had time for (retail only).

Works 99%… One minor thing…
When the bank (and all the bank bags) are open. All of the names are there EXCEPT the last bag (#12 in the list). It still shows as “Wildercloth Bag” as the bag title… HOWEVER, when I mouse over the bag slot in the “main” bank window, the title “I’m RiCH!” shows up for that bag in the tooltip.

If you could tell me what line of code needs tweaked, I would appreciate it. I know nothing of coding but I’m trying to learn. Thanks again for all your help!

Updated the original code. Removed the -1 from

for i=0, #Bagname-1 do 

Because of the change of adding bank bags no longer using the max. bags constant… Like I said, rough :wink:

Perfect! Thank you!

1 Like