• 0

    posted a message on Mana regen graph
    Well, being a library that draws graphs and pie charts, I highly suggest you get yourself an active account...
    Posted in: Addon Ideas
  • 0

    posted a message on Mana regen graph
    Quote from myrroddin
    I will dig though Recount to see what how it is coded, then remove anything not pertaining to the player.

    As for LibGraph-2.0, its internal location for the docs is outdated ( http://www.wowace.com/wiki/GraphLib -- which doesn't exist) so I will have to do some digging through that as well.

    Both good suggestions, thank you.


    There are no documentation apart from the small section of "sample test code" that you can view and test at the end of the file in LibGraph-2.0.lua. Those 4 examples are usually adequate enough for anyone that wants to use the library.

    GraphLib --> LibGraph-2.0 actually has no code functionality changes apart from internal minor optimizations (global math.blah calls -> local function calls), and changing the upgrade path to be LibStub compatible. Oh and uh compressing the TGA files with RLE so its like 100 kb smaller.
    Posted in: Addon Ideas
  • 0

    posted a message on Temporary weapon enchants in SecureAuraHeader
    I don't know then.

    But my intuition tells me that obtaining the expiration time of the 16th-18th buff is going to give you the wrong values, especially during combat when you are gaining and losing buffs rapidly.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Need help creating a minimap button
    Quote from wwwDot
    They use LDB. If i use LDB i have to do a MASSIVE change with my code because the xml. I also cant find anywhere how i would go about using "GameToolTip"

    My addon BankItems has an extremely "outdated" way of providing an optional minimap button with the features you want.

    (Outdated meaning the whole addon doesn't use any library, is standalone, every function is a global, and so are the 800 or so frames created. Mainly for backwards compatibility reasons for the multitude of addons that hook or call functions or change how the frames look directly in BankItems.)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Defining script handlers from XML
    In the case of the first format, you are defining an anonymous function that calls BRM.OnUpdate(self, elapsed), basically a wrapper function.

    It is usually better to use the second and newer format using function="" in XML to avoid the extra function call. In particular, if you defined a lot of Scripts in XML, the small functions can add up in memory use whereas if you pointed multiple frames to BRM.OnUpdate(), they would all just share that one function.

    You can also assign the script in Lua code:

    BRM_Frame_Timer:SetScript("OnUpdate", BRM.OnUpdate)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Temporary weapon enchants in SecureAuraHeader
    local name, _, texture, count, dtype, duration, expiration = UnitAura(header:GetAttribute("unit"), button:GetID(), header:GetAttribute("filter"))
    You appear to be attempting to get and use the expiration time of the 16th, 17th or 18th buff that you have on your respective 3 buttons, since you are using button:GetID(), which you have stored their IDs with using

    self:SetID(self.slotInfo)
    in your UpdateTime() update function, and self.slotinfo was assigned those numbers from the returns of
    GetInventorySlotInfo() in your ParseAuras() header function.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Need help creating a minimap button
    Look at the code of any number of addons that have optional minimap buttons.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Mana regen graph
    Recount has a "Mana Gained" entry that you can look at, along with all the usual stuff you look at such as "Damage Done" and "Healing Done". While it doesn't provide a graph view over the whole fight, it will tell you how much mana each player gained, and from what sources that mana came from (judgement, evocation, mana tide, etc).
    Posted in: Addon Ideas
  • 0

    posted a message on Problems iterating a template.
    Another alternative you can use is to create the buttons as you need them. Instead of predefining them in XML. Your buttons are relatively simple right now.

    You can easily remove all the 250 XML buttons and replace them by this Lua function that you can call in code:

    local function FunctionToCallWhenClicked(self, button, down)
        -- Do something
        print("You clicked on button "..self.id.." using mouse button "..button)
    end
    
    local buttons = {}
    local function CreateMyButton(num)
        -- First check if button already exists for num and return it if so
        if buttons[num] then return buttons[num] end
    
        -- Create the button num since it doesn't exist
        local b = CreateFrame("Button")
        -- Set the default text on the button
        b:SetText("Char "..num) -- Don't need to do this
        -- Position the button relative to the previous button
        if num == 1 then -- If its buttons[1]
            b:SetPoint("TOPLEFT", TheNameOfMyParentFrame, "TOPLEFT", 0, 0)
        else -- Else set the top left of this to the bottom left of the previous with offset 0, 0
            b:SetPoint("TOPLEFT", buttons[num-1], "BOTTOMLEFT", 0, 0)
        end
        -- Set the size of the button
        b:SetWidth(100)
        b:SetHeight(30)
        -- Set the parent
        b:SetParent(TheNameOfMyParentFrame)
    
        -- Assign scripts
        b:SetScript("OnClick", FunctionToCallWhenClicked)
    
        -- Put it in our array of buttons[]
        buttons[num] = b
        -- Let our button know its own number
        b.id = num  -- This is the same as b["id"] = num, frames are just a Lua table like any other table
    
        -- Now return our button
        return b
    end
    You don't actually need to set any default text as your update function replaces the default text with a guild member's name anyway. Now whenever you need button 5, you will call CreateMyButton(5), which will create and position the button for you relative to button 4 (which hopefully you already have created before button 5).

    This is the equivalent of a "XML template" in Lua. You simply have a function that creates buttons with a specific set of attributes, in this case buttons of 100 width and 30 height with the default text of "Char X".
    Posted in: AddOn HELP!
  • 0

    posted a message on Problems iterating a template.
    One technique to avoid having 250 buttons is to have a fake scrollframe (or more appropriately called by Blizzard as a FauxScrollFrame).

    Lets say your left side is large enough to view 14 buttons, then all you have is to create 14 buttons. Depending on the scrollbar's positioning, your 14 buttons will show the appropriate members. For example, if the scrollbar is at the very top, the 14 buttons will show member 1 to 14. If the scrollbar is in the middle, it might be showing member 112-125. But the trick is that you are really just using 14 buttons that are shown all the time, nothing is actually scrolling, the text on the 14 buttons are just updated accordingly to show a slice of 14 members out of 250, so you just need the "starting index" of the first guy to show.

    Fake scrollframes are used all over the place such as in your quest log.

    If you want something really scrollable, then yes, you DO need 250 buttons, one per member (an example is the scrollframe used for all the guild item rewards on the guild panel, it is really 1 button per reward). Your current method (to call getglobal("charbutton"..i) is perfectly fine and normal. One thing you could do though is to store references to those buttons in a table first:

    local buttons = {}
    for i = 1, 250 do -- if you have 250 buttons
      buttons[i] = getglobal("charbutton"..i)
    end
    Now whenever you want to use button 159, you can just use button[159] directly instead of calling getglobal() every time. For example, button[159].ident = i and button[159]:SetText(currentCharTables[159].name)
    Posted in: AddOn HELP!
  • 0

    posted a message on tracking ChatFrame on Event error
    Quote from essmene
    think i found it:
    [...]
         ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", TalentSpam);
    
    [...]
    function TalentSpam(self, event, ...)
        local msg = ...;
        -- If System Chat Message is "You have Learned..."
        if strfind(msg, learnspellmsg) or strfind(msg, learnabilitymsg) then
            -- If option for hiding "Learned" messages is set for dual or respec and if for dual spec player is changing between dual specs.
            if (hidelearndual and changingspec) or (hidelearnrespec and not changingspec) then
                return true
            else        
                [B]return false, args[/B]
            end
    args is not defined. If i replace args with msg (which is ...) things are fine?

    Incorrect.

    local msg = ...

    merely assigns the first item in the entire list (... is a list) on the right hand side to the 1 variable on the left hand side of the assignment statement. Any excess items in the list on the right hand side are discarded. Likewise,

    local a, b, c = ...

    would assign the first 3 items in the ... list to a, b, and c. If the right hand side list has less than 3 items, then nils get padded on the right hand side to be assigned to the left hand side.

    So if you changed "return false, args" to "return false, msg", you would be returning 2 items, and the calling function that is expecting 16 return values will assign nils to the last 14.

    To fix the problem, the correct statement should be "return false, ..."

    "return false" by itself will also works since the default UI's code checks to see if the 2nd return value exists. Since it doesn't if you only returned 1 value, it doesn't overwrite the 15 arguments. (See the default UI's code in reply #14 a few posts up.)
    Posted in: AddOn HELP!
  • 0

    posted a message on RegisterEvent and CHAT_MSG_ADDON
    Your function definition needs to change from

    function GuildRecr.EventAddonMsg(event, arg1, arg2, _, _)

    to

    function GuildRecr:EventAddonMsg(event, arg1, arg2, _, _)

    That is, the . needs to change to a : to work.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Correctly embeded (Ace3) Libs?
    Quote from Seerah
    ..... Including FriendsFu. Perhaps they should ditch that and FuBar (since it's been long dead)....


    I actually still use FuBar (and a number of plugins, some converted by Broker2FuBar) without any errors. Lol.
    Posted in: General Chat
  • 0

    posted a message on tracking ChatFrame on Event error
    The stacktrace doesn't say which filter function caused the error because the filterfunc didn't cause any error. It is the return values after the function ran that are causing errors. As you can see, as long as newarg1 returned non-nil, it assigned newarg1-newarg15 to be the new values of arg1-arg15.

    You will need to check the code in each addon to see if the filterfunc returned more than just 1 value.
    Posted in: AddOn HELP!
  • 0

    posted a message on Correctly embeded (Ace3) Libs?
    Hi Ketho,

    I downloaded your addon through the link in your post. The TOC is perfectly fine and correct (though I'll recommend removing colors from #Title because its not really needed).

    Then I installed your addon through the Curse Client and looked at the installed addon. The addon installed correctly, has the exact same TOC file, and even though I had specified all addons of mine to be installed nolibs, the Libs folder is present and intact (because you do not have a nolibs version of the addon, the Curse Client just extracts the whole zip as-is, it doesn't do voodoo and remove the Libs folder. Incidentally you don't even have to call the Libs folder "Libs", you could call it "Voodoo" if you like as long as you also change all the paths in the TOC to point to Voodoo\Blah\Blah.xml instead of Libs\Blah\Blah.xml, its just that... well convention sticks huh).

    Conclusion: There is nothing wrong with your addon.

    However, you should move line 1710 of your addon (the line that calls GetClassColor()) into the sanity check because classFileName is nil if name is nil (duh) and an error would result on line 1270 when that happens.
    Posted in: General Chat
  • To post a comment, please or register a new account.