1. #1

    launching custom scripts after UI is rendered

    hi there,
    I am working on my UI and got to a roadblock: I'm trying to anchor one addon to another (vuhdo to bartender in my case) and place it 10px below. I have the script that does it for me:

    Code:
    local a,b=Vd1,BT4Button13 a:ClearAllPoints() a:SetPoint("TOPLEFT", b, "TOPLEFT", 0, -40)
    it works when fired in game through /run however I would like it to run automatically (i assume every time i log in?). I made a simple addon with just that one line in it however it doesn't work (I assume it fires the script before the frames are created and placed?)

    is there a quick way to fix?
    thanks

  2. #2
    Add the following tag in your .toc:
    Code:
    ##Dependencies: Bartender4, VuhDo
    That will ensure that your code is executed after the specified addons'.
    UI & AddOns expert | Interface & Macros moderator - My work

  3. #3
    cheers Treeston,
    I have added the code , however it still seems not working...
    Is there an easy way to check if the addon is actually starting? I do see it in active addons so I guess up to this point I didn't screw up, and if I use /run it works no problem so I assume the issue is somewhere in between (my .lua file is literally that one line from my first post)

  4. #4
    Simply add a:
    Code:
    print("Loaded!")
    which should tell you if it loads. Try enabling Lua errors, that should give you a good guess of what doesn't work.
    UI & AddOns expert | Interface & Macros moderator - My work

  5. #5
    adding that indeed prints out stuff, yet the script doesn't work
    is there another way to wait for the addons to be initialized? maybe something brutal like waiting couple of seconds before the code executes? can lua do this?

  6. #6
    I guess, yeah. But before we go brute force mode, try this:

    Code:
    local fN = ...
    local f=CreateFrame("Frame")
    f:SetScript("OnEvent",function(s,e,n)
        if (e == "ADDON_LOADED") and (n == fN) then
            local a,b=Vd1,BT4Button13 a:ClearAllPoints() a:SetPoint("TOPLEFT", b, "TOPLEFT", 0, -40)
        end
    end)
    f:RegisterEvent("ADDON_LOADED")
    UI & AddOns expert | Interface & Macros moderator - My work

  7. #7
    sadly enough, this didnt work as well (it did as it launched and executed without errors)
    I think that after vuhdo loads (then the script fires given where I see print outputs) it takes some time before it launches the configuration profiles and I guess that's the point where is starts creating frames (so after the script launches)

    I tried to do the same with Skada and SUF and got nothing as well, so maybe it is time for the brute force approach?

  8. #8
    Code:
    CreateFrame("Frame"):SetScript("OnUpdate",function(s,e)
        s.e = (s.e or 0)+e
        if s.e >= 15 then -- this is the delay in seconds
            local a,b=Vd1,BT4Button13 a:ClearAllPoints() a:SetPoint("TOPLEFT", b, "TOPLEFT", 0, -40)
            s:Hide()
        end
    end)
    UI & AddOns expert | Interface & Macros moderator - My work

Posting Permissions

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