• 0

    posted a message on .PNG support?
    I remember reading that wotlk patch added .png support for images. Is this true or do we still have to convert to .tga?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Frame Re-use
    Quote from Wintrow2
    FYI: In BeneCast 10 I'm taking the "leave the frames where they are, repaint from frame 1 to x and add/retire/recycle frames as necessary"-route.

    "Painting" being:
    - Setting anchor
    - setting texture
    - setting attributes
    - setting my own custom members

    retiring then clears out all that info, anchors it's "next" neighbour to it's "previous" neighbour and hides the frame. Works pretty well...


    Yes this is exactly what I am doing with this mod. First I check if the amount of frames needed is > the amount of frames available, if so i create the extra. If not then I just re-paint them by setting the textures/text etc...Seems to be working great.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Group Roll Frame?
    Quote from Lombra
    It'll be in LootFrame.xml! Namely, GroupLootFrameN. They aren't secure, I guess, since that's for spell casting and targetting, basically.



    Awesome news! Thank you guys for your assistance! :cool:
    Posted in: Lua Code Discussion
  • 0

    posted a message on Group Roll Frame?
    Quote from Arkayenro

    you'll most likely still need some sort of frame for your mod (depending on what you want it to do), you could probably just create the frame you need to attach via code and parent it to the correct part of the frame (once you find it).


    Yes, that is exactly what I want to do. I was hoping it would be as easy as anchoring my frame to the Group Roll Frame. I wasn't sure if it was some sort of secure frame that you couldn't mess with or what. I'll search the need/greed icons and see what I can research, thanks :)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Group Roll Frame?
    I'm writing an AddOn that allows you to add a dropped item from an instance to your "item wish list". Ideally, I'd like to put a little check box in the frame that pops up when you roll on an item. The problem is I cannot find the frame in FrameXML so I'm thinking its probably put together programatically? Also, how would I add a checkbox to this frame? I've never really interfaced with any blizzard created frames. Would it be difficult? I am using a custom frame right now everytime an item drops but its redundant since the item roll frame is already on-screen.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Frame Re-use
    Quote from Xinhuan
    Yes. When you removeFrame(), the rest of your addon should treat that frame as though it never existed - that is, remove all references to it except in your recycling function.

    You will of course also need to make sure nothing is parented to it.


    Gotcha, thanks!
    Posted in: Lua Code Discussion
  • 0

    posted a message on Frame Re-use
    Quote from yssaril
    basically you should setup some sort of recycling function a getFrame and a removeFrame function

    the getframe function should either should either create a new frame which may then modify or use an old frame that you have removed vie the removeFrame function.

    the removeFrame function should reset the frame to its basic state so that it is ready for reuse and store a reference to the frame in a table from which the get function can pull

    also remember you need to make sure that when you call the removeFrame function that you are removing any other reference to that frame so that it can only be referenced thru the recycling table

    also you may want to think about achoring each frame to the same point with an offset. if you anchor from frame to frame to frame the game has to calculate the location of each frame whenever you change them or move them whereas when you simply anchor everything to the same location it will have to do alot less calculating to get the actual position of the frame


    So when you call removeFrame what would you be doing? Reseting all of its properties? files associated with textures, clearning out fontstrings and hiding the frame ? The frame would physically still be where it was but just invisible to the user right?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Frame Re-use
    Since frames cannot be deleted once created through code what is the proper way to re-use them?

    I'm writing an addon that generates frames in a list, one on top of the other. Sometimes I want to clear the list and repopulate it etc.. Right now the first frame is anchored to the parent window and each successive frame is anchored to the one created before it. The problem is I need to clear this list of frames and populate them with different data. I tried hiding / showing appropriate frames but that gives me too many anchor dependency problems.

    Now I've been mulling over in my head to not hide any frames but just "re-painting" the ones already there each pass. But my question is, what is the "proper" way to do this sort of thing?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Best Practice - OnUpdate
    Quote from taleden
    Won't that depends on the situation? Some buffs might have different durations depending who casts them, their talents, glyphs, set bonuses, etc, so on a new application the "total duration" might not be the same as the last time you saw it.

    Also, what's the relative frequency of COMBAT_LOG_EVENT_UNFILTERED events compared to UNIT_AURA or some other indication of (de)buff change?



    the mod is for self casted aura's, basically talent procs. I want to see when my "surge of light" procs so i can get a free flash heal etc...
    Posted in: Lua Code Discussion
  • 0

    posted a message on Best Practice - OnUpdate
    I've come up with a new way to calculate the expire time.

    Instead of calling UnitBuff() to get the new expire time each OnShow() you can store the fixed "buff duration" for the specific buff the first time that Aura fires. Then you can calculate the expire time by GetTime() + auraDuration each time the "COMBAT_LOG_EVENT_UNFILTERED" fires for that Aura. Then OnUpdate() can just subtract GetTime() - expireTime to get timeLeft. This alleviates the need to constantly query UnitBuff every OnShow()
    Posted in: Lua Code Discussion
  • 0

    posted a message on Best Practice - OnUpdate
    Quote from taleden
    I'm pretty new to WoW API coding myself, but if I understand correctly, it can be problematic to try to use the "elapsed" argument that way. WoW's event dispatcher may give you the elapsed time since the last OnUpdate cycle *started*, but since you don't know how long each cycle *takes*, you can't just tally it up every time you get one and treat that as an accurate measure of time. The more OnUpdate code is running (anywhere, from any addon), the more extra processing time will be taken up per frame, and the more skew you'll get by summing that "elapsed" argument.

    If you're tracking very short-term buffs that might not be noticeable, but I suspect if you ran the above on a several-minute buff you'd see your buff disappear while the timer was still ticking down.


    The mod is basically watching for any talent abilities (Aura's/buffs not sure of the proper in-game term) that proc while in combat, such as "holy concentration" and "surge of light" (for priest) or "clear casting" and "missle barrage" for mage. It also makes sure the Aura is under 30 seconds, that way normal buffs won't pop up. I havent run into any problems with the duration countdown. But awesome advice guys, I'm going to play around with some of these examples.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Best Practice - OnUpdate
    I finally got some spare time to work on this mod. Here is how I ended up calculating the buff count down timer. Let me know if you guys have any suggestions to make it better :)

    frame:SetScript("OnUpdate", function (self)  
     local auraName = self:GetName()
      if GetTime() < AuraExpireTimes[auraName] then
       timer:SetText(string.format("%1d",AuraExpireTimes[auraName]-GetTime()).." s") 
      end
    end )
    
    frame:SetScript("OnShow", function (self) 
     local auraName = self:GetName()
     AuraExpireTimes[auraName] = select(7,UnitBuff("player",auraName))
    end)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Best Practice - OnUpdate
    Quote from Xinhuan
    What about the same buff that stack from multiple people? Say multiple Renews from different people.


    The mod I am writing is just to track the Aura's that proc from the player. Basically if my "Surge of Light" aura procs etc...I'm not worried about buffs or heals etc.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Best Practice - OnUpdate
    Quote from egingell
    Just to nit pick, testing if a frame is shown inside its OnUpdate handler is redundant as the handler only runs when the frame is shown.


    That is not my actual code i was just slapping stuff together for example purposes.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Best Practice - OnUpdate
    Quote from yssaril
    there are no dynamic frames in WoW once created they cannot be destroyed without a reloadUI/relog[/CODE]


    Yeah I am only creating frames that do not exist. If that aura procs again then I just Show() that frame. Anyway. You're right though, no need to keep querying UnitBuff() function constantly.
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.