• 0

    posted a message on Officially stumped
    Noticed some inconsistencies.

    This is your commSend definition and implementation:
    local function commSend(contents, distribution, target) 
        CTL:SendAddonMessage("BULK", "gBankComm", contents, distribution, target) 
    end 


    But you're calling it in the pasted code the following ways:

    commSend("gBankComm", commString, "WHISPER", sender, lib:FinishComm(complete))
    ...
    commSend("gBankComm", "REQUEST", "GUILD")
    ...
    commSend("gBankComm", commString, "GUILD")


    I don't believe any of those will end up sending a message. Maybe you're intending to call CTL:SendAddonMessage instead?

    Also, once you do get the figured out, I think what you're trying to do with the callback is not what you expect. That callback will get fired when the message is sent, not after it's been received and processed but whoever is supposed to receive it. The purpse of that callback is due to the fact that the message may not be sent immediately due to throttling. So the callback is CTL's way of letting you know that the message was finally sent.

    Sending and receiving of messages is not instantaneous and the time it takes is never a known. There's not even a guarantee the player on the other end will receive the message (for example if they logoff, or have addons that block messages)
    Posted in: Lua Code Discussion
  • 0

    posted a message on LibQTip
    Finally working on some issues I've been having while using LibQTip. There are two issues, one is easier to describe than the other. I'm guessing that I'm just a bad user. But if you can confirm this isn't an incorrect usage then I'm happy to submit bug reports.

    First issue:
    I have a header row that spans 5 columns. If I don't use an actual value for each cell then the height gets calculated "oddly".

    Example A:
    local spellLine = ToolTip:AddHeader("", "", "", "", "")
    ToolTip:SetCell(spellLine, 1, ToolTip.button.trackerInfo.name, nil, "LEFT", 4)
    ToolTip:SetCell(spellLine, 5, tostring(Hermes:DecodeTrackerIdentifier(ToolTip.button.trackerInfo.id)), SpellIdFont, "RIGHT")


    Resulting tooltip:


    Example B:
    local spellLine = ToolTip:AddHeader("x", "x", "x", "x", "x")
    ToolTip:SetCell(spellLine, 1, ToolTip.button.trackerInfo.name, nil, "LEFT", 4)
    ToolTip:SetCell(spellLine, 5, tostring(Hermes:DecodeTrackerIdentifier(ToolTip.button.trackerInfo.id)), SpellIdFont, "RIGHT")


    Resulting tooltip:


    As you can see, I'm creating a line with 5 columns, and then afterwards making the first cell span 4 columns and updating the 5th.

    Expected Results:
    Example A produces a tooltip that has an unexpectedly large height. I believe Example B shows what I would expect in both cases.

    When tracing through LibQTip code, it would appear that FontString:GetHeight() does not return expected values when the strlen is zero. It looks like I should not be using nil for column values so that's why I was using "". I am not certain if this is only an issue for header rows.


    Second Issue:
    This issue is FAR more devious. I have to create a video to show you what's happening. This time, it seems to have to do with randomness in FontString:GetWidth()

    What's happening is the calculated widths of the cells are changing. I Clear() and recreate all the lines in the tooltip during an OnUpdate when I need to update duration text in the player rows.

    If I use the code you'll see below to set the 5th cell in the Header Row, then the cells will randomly vary in size during each OnUpdate.

    One critical piece of evidence however is that if I only ever show ONE tooltip for one of my buttons, then this issue will never show. I MUST hover over a different button in my addon (thus using different tooltip values) THEN hover over the prior button again before the issue will present itself. This could be important because maybe it has something to do with cell recycling?

    Please watch the following video and note how I at first hover over the same button over and over and you won't see the problem. Then, I hover over a different button, then back to the first button and now the problem shows. Also, it's not always the same cells that change....if I hover over another button then back to the one showing an issue then sometimes the cells that are changing are different. But so long as I stay hovered over the same button the cells with the issues will be constant.

    You'll have to look very closely at the cells as only a few exhibit the issue and it's only changing by a pixel or so.

    VIDEO LINK

    I did manage to find a workaround, which could be a good clue.

    Here is the code that will reproduce the issue:

    local spellLine = ToolTip:AddHeader("x", "x", "x", "x", "x")
    ToolTip:SetCell(spellLine, 1, ToolTip.button.trackerInfo.name, nil, "LEFT", 4)
    ToolTip:SetCell(spellLine, 5, tostring(Hermes:DecodeTrackerIdentifier(ToolTip.button.trackerInfo.id)), GameFontNormalSmall, "RIGHT")


    Note that I'm directly using GameFontNormalSmall

    The following change will fix the issue (I use my own local font instead of the global font):

    local spellLine = ToolTip:AddHeader("x", "x", "x", "x", "x")
    ToolTip:SetCell(spellLine, 1, ToolTip.button.trackerInfo.name, nil, "LEFT", 4)
    ToolTip:SetCell(spellLine, 5, tostring(Hermes:DecodeTrackerIdentifier(ToolTip.button.trackerInfo.id)), SpellIdFont, "RIGHT")


    Here's how I create the font. Note that I can't figure out why a simple CopyFontObject doesn't do what I thought it was supposed to do, I'll figure it out eventually...
    function HermesDisplay:SetupToolTipFonts()
    	SpellIdFont = CreateFont("HermesSpellIdFont")
    	local gfns = GameFontNormalSmall
    	local filename, size, flags = gfns:GetFont()
    	SpellIdFont:SetFont(filename, size, flags)
    	local r, g, b, a = gfns:GetTextColor()
    	local sr, sg, sb, sa = gfns:GetShadowColor()
    	SpellIdFont:SetTextColor(r, g, b, a)
    	SpellIdFont:SetShadowColor(sr, sg, sb, sa)
    end


    Here's a pastey link with all of the relevent code. It includes the OnUpdate handler showing how I call refresh, how I create the tooltip, and the entire refresh method. Note that this code is the "workaround" state.

    http://pastey.net/143572
    Posted in: Libraries
  • 0

    posted a message on Officially stumped
    You're right Phanx. Guess I got hung up on how it was being handled.

    I think the real problem, and I'm struggling how to communicate a solution, is that if you're waiting to receive an addon message, you should write the code in a way where it knows what to do when the message is finally received, as opposed to making a timer that waits some arbitrary time for the message.

    Looking at your code, I'd think you can fire off the message request the guild info and then be done with it. Eventually, in your code that receives messages, all you'll have to do is catch the message and then process it.
    Posted in: Lua Code Discussion
  • 0

    posted a message on AceConfig options: Widescreen GUI
    I'm not sure if this is turning into a debate or just a statement of facts.

    Although AceConfigDialog acts like yssaril described, there are a few things here and there that the addon author can do to influence layout a bit. So it's not completely inflexible.

    I think the tip I provided is actually very handy. Let's just hope Ace behavior doesn't change in a way that breaks it :)
    Posted in: Ace3
  • 0

    posted a message on AceConfig options: Widescreen GUI
    Quote from Xinhuan
    Apart from aesthetics, does it really matter?


    I think it depends on what someone classifies as aesthetics, and how much they value it.

    I will make up an example to show the things I've run across (and this doesn't mean there aren't other ways to organize the config, using groups, tabs, etc. but sometimes keeping things as compact as possible is also important)

    Let's say I have 3 named objects with a ranged width and height property. "Title", "Border", and "Icon":

    This is a lot easier for a user to find what they're looking for...
    [Height: Title]  [Width: Title]
    [Height: Border] [Width: Border]
    [Height: Icon]   [Width: Icon]


    than this...
    [Height: Title] [Width: Title]  [Height: Border]
    [Width: Border] [Height: Icon]  [Width: Icon]


    Especially when the user can immediately recognize the pattern that each row has a Height and Width value for the same object.

    In these cases, I think it's worth the trouble and goes beyond aesthetics.
    Posted in: Ace3
  • 0

    posted a message on Officially stumped
    I had a big long thing typed up but I need to keep this short:

    1. You shouldn't be using a frame and an OnUpdate just for a timer.
    2. Creating a new frame for each timer is not good.
    3. Your "timer" code won't do what you think it will (it won't wait for anything)
    4. You shouldn't be relying on 2 seconds always being enough time.
    5. The overall approach needs review.

    I'm sorry but I can't offer more right now. But generally speaking, you're going to have to handle this differently.
    Posted in: Lua Code Discussion
  • 0

    posted a message on AceConfig options: Widescreen GUI
    I only gave the general idea (which is to make a full width invisible description item after the items you want to force a new line on).

    It results in a subtle change in gap between items but not very large. You should probably play with it before you commit anything.

    But the concept does work, I've used it.
    Posted in: Ace3
  • 0

    posted a message on AceConfig options: Widescreen GUI
    If you did something like this, then you'd have two checkboxes for this row no matter how wide the option window was stretched. Note however that this doesn't do anything when they make the window very small

    toggleInterrupt = {
       type = "toggle",
       order = 5,
       width="normal",
    },
    toggleDispel = {
       type = "toggle",
       order = 6,
       width="normal",
    },
    spacer = {
       type = "description",
       name="", --use an empty value for name
       order = 7,
       width="full", --forces a new line after the items above it
    },
    
    Posted in: Ace3
  • 0

    posted a message on Hermes: The great messenger of your raid's cooldowns
    Release 1.0a fixes the two communication bugs mentioned above.

    I want to give a personal thank you to Tomber and his mod Raven. His code, and a brief conversation with him allowed me to fully understand the DK problem. I reviewed a lot of addons to see how they solved the problem and Raven appeared to have the most reliable and true approach. Thank you!
    Posted in: General AddOns
  • 0

    posted a message on Postponing BAG_UPDATE processing to the next frame
    Quote from rowaasr13
    Seeing BAG_UPDATE firing several hundreds of time while teleporting in/out LFG dungeon made me nervous.


    I see. I wasn't aware of the severity (not familiar with that event). In this case I'm be concerned too.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Postponing BAG_UPDATE processing to the next frame
    I'd think the worth of either approach depends entirely on the actual work being done inside ProcessBags.

    Why don't you just code it the "easy" way and worry about it if it becomes a real issue?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Grid — compact party/raid unit frames
    80 isn't a big number, so imagine 30,000 instead to set the example.

    Any time any addon needs to access a global value, it's looking into the same table that all other addons look into when accessing globals. It's not your own personal copy of a global table.

    It's considered bad practice because it slows down global lookups for all addons (simply because there are more records). It also presents more opportunity for key conflicts.

    If all addons put all their values in the global table things would be a mess.

    I'm sure someone will correct my ignorance shortly but this is my understanding.
    Posted in: Grid & Grid2
  • 0

    posted a message on Hermes: The great messenger of your raid's cooldowns
    Tonight I was able to get more guild members to help test Hermes. Nine of us total. I ran it for 1 hour and 45 minutes before we finished the raid. These were ICC fights including Sindragosa and LK normal (we were finishing up some achievements for people). I can't recall when I last reloaded UI and what bosses were there beforehand.

    Keep in mind that I discovered two bugs during this so it was very successful.

    1. First bug was that I neglected to filter out disabled spells when receivers send requests to senders. That will result in some unnecessary messages but I couldn't say how much so I didn't try to subtract it out. My guess is 4 or 5 at most per player in this time span.
    2. Second bug is that Hermes doesn't handle the cooldown for DK's Army of the Dead properly. I suspect there will be other DK spells with the same issue but that was the only one that I traced down.

    Here is a screenshot showing the results in terms of bandwidth. It's difficult to make any conclusions from these because there are a lot of variables. But I am pleased with the results.



    (I'm not sure what's up with the oRA3 numbers, they surprised me, I've only briefly looked at their code)
    Posted in: General AddOns
  • 0

    posted a message on Where to begin?
    Not sure if it's been mentioned yet but make sure you devote some time to understand data structures (tables really) in Lua. Especially how the indexing/hashing works and the implications of it all. Oh, and how strings are references, all that jazz.

    I made a lot of mistakes because I assumed a lot that was not correct. I think it's worth studying up a bit before coding too deeply.

    As far as resources for the WoW api goes, I found this site to be in a format to my liking: http://wowprogramming.com/docs, especially the "Hierarchical widget diagram" when I first delved into frames and what not. That is shows the defined methods and inherited methods was actually quite helpful to me.

    I'm also very new to wow addons but am having some success after absorbing myself into it and asking questions here.
    Posted in: General Chat
  • 0

    posted a message on Number format with commas
    I don't know if there's a better tool out there but I'd probably start with the modulus operator and create an algorithm based on that (%)
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.