1. #1

    Help: Make an addon to hide totem icons

    Hi all,
    I'm currently running TMW to display all the buffs I feel is important, which includes the time left on totems.
    I do have a script that'll hide the default totem icons, but it requires me to run it manually after I've logged into wow.
    Is there a way I could turn the script into an add-on, so it does the required job automatically?
    Thanks in advance!

  2. #2

  3. #3
    Thank you for the reply. I followed the link and made 2 files using notepad.
    *******************************************************************************
    Hide.toc
    ## Interface: 50400
    ## Title: Hide
    Hide.lua

    Hide.lua
    /run local f = CreateFrame("Frame"); f:SetScript("OnUpdate", function(self) TotemFrame:Hide() end)
    ********************************************************************************
    I put both files into a folder called "Hide". But it doesn't work. Could you give me more pointers?
    Much appreciated!

  4. #4
    Delete the "/run".

    /run is just a chat command that tells the game's chat interface that everything after the "/run" will be Lua. Lua files loaded as addons are already entirely Lua, and don't accept chat commands.

  5. #5
    It works!

    Workable version to hide default totem icons:
    *******************************************************************************
    Hide.toc
    ## Interface: 50400
    ## Title: Hide
    Hide.lua

    Hide.lua
    local f = CreateFrame("Frame"); f:SetScript("OnUpdate", function(self) TotemFrame:Hide() end)
    ********************************************************************************

  6. #6
    If you value performance, something like this would be better:

    Code:
    local c=TotemFrame c:SetScript("OnShow",c.Hide) c.Show = function() end c:Hide()
    UI & AddOns expert | Interface & Macros moderator - My work

  7. #7
    Using an OnUpdate script should always be a last resort. After a quick look at Blizzard's code, an easy way to do it without taint seems to be (untested):
    Code:
    TotemFrame:Hide()
    TotemFrame:UnregisterAllEvents()
    TotemFrame:SetScript("OnEvent", nil)
    TotemFrame:SetScript("OnHide", nil)
    TotemFrame:SetScript("OnShow", TotemFrame.Hide)

  8. #8
    Thanks for all the helps.
    This is a great community.

Posting Permissions

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