• 0

    posted a message on GetItemInfo, servercache and localcache
    I've noticed with new items added that indeed the code is too quick for the server to respond. It is usually used for items where I know it has dropped; the scenario is usually this:

    1. Boss is killed
    2. Masterlooter announces loot
    3. Addon shows dialogs
    4. Raiders click need/greed on the dialog boxes shown by my addon.
    Now, if the raider hasn't seen the loot yet, the dialog can show up empty.

    I now announce the loot in a raidwarning. But it still happens occasionally for loot we haven't seen yet. We've cleared all current content but with Ulduar around the corner it is sure to happen that loot is new.

    Haven't found a good way around this. I was wondering how addons like 'atlasloot' solve this?

    btw. I've added an extensive description of my addon here: http://www.wowace.com/projects/epgploot2/
    Posted in: Lua Code Discussion
  • 0

    posted a message on looking for suggestions; checking if a player has itemX
    I've created a project page here http://www.wowace.com/projects/epgploot2/

    I can't find the option to add files yet, but I assume it has to be approved first (?)
    Posted in: Lua Code Discussion
  • 0

    posted a message on looking for suggestions; checking if a player has itemX
    I'll make a project page for it.
    Posted in: Lua Code Discussion
  • 0

    posted a message on looking for suggestions; checking if a player has itemX
    The vast knowledge of this forum never ceases to amaze me. Thanks :)
    Posted in: Lua Code Discussion
  • 0

    posted a message on looking for suggestions; checking if a player has itemX
    I've made a need/greed/roll tool for my guild- it works on EPGP priority and automates stuff for the masterlooter. I've included some stuff to make looting quicker (automatic pass etc.)
    Players have asked me to include a 'wishlist' - a list of items they really want and automatically want to send a 'need' command to the masterlooter. What I've done is compile a string with itemIDs in them seperated by a ';' token. When an item drops I do a strfind and issue the 'need' command.
    So far this works like a charm.

    Now, I want to alert players "The addon detected that you received an item from your wishlist, do you want to remove it from the list?" and remove the item from the list on confirm. Now I'm looking for suggestions on how to achieve this. Clearing the item from the string is not the problem; detecting if a player has the item is.

    A couple of things; I've considered to send a addonmessage to the winner, to trigger the dialogbox. This may be the route I'll go if no better solution comes up. However it does not work for items received outside guildruns (such as pugs). It is mandatory for guildmembers to have the addon (otherwise they wouldn't receive loot during guildruns) so it is safe to assume the addon is running in the background all the time (it currently is only active when the player joins a raidgroup).

    Any suggestion is welcomed!
    Posted in: Lua Code Discussion
  • 0

    posted a message on GetItemInfo, servercache and localcache
    I changed the code to:
     
      for i=1,#exceptionitems do
       EPGPLoot2TooltipScan:SetHyperlink("item:"..exceptionitems[i])
       local sName, sLink, iRarity, iLevel, iMinLevel, sType, sSubType, iStackCount = GetItemInfo(exceptionitems[i]);
       self:Print(sLink);
      end


    ...and it works! thanks!
    Posted in: Lua Code Discussion
  • 0

    posted a message on GetItemInfo, servercache and localcache
    Hi,

    I have a list of itemids in a small table. When I loop the table like this:

     
      for i=1,#itemlist do
       local sName, sLink, iRarity, iLevel, iMinLevel, sType, sSubType, iStackCount = GetItemInfo(itemlist [i]); 
       self:Print(sLink);
      end


    The itemlist contains these numbers 32458,43953, 43952, 43954, 44083, 43959 (these are the mounts where our guild uses a /roll instead of DKP)

    The output is:
    nil,nil,nil,[Reins of the Twilight Drake],nil,nil

    However, if I use the "link" function from WoWhead ingame like this:
     
    /script DEFAULT_CHAT_FRAME:AddMessage("Shift-click this to place a link into a chat message: \124cffa335ee\124Hitem:32458:0:0:0:0:0:0:0:0\124h[Ashes of Al'ar]\124h\124r");


    The item Ashes from Al'ar appears. Now I run my code again:
    The output is:
    [Ashes from Al'ar],nil,nil,[Reins of the Twilight Drake],nil,nil

    How do I force the getiteminfo function to read from the servercache and not from the local cache? I understand the nil if the server has never seen that item before, but why do I see nil on items I'm sure are on the server?

    Any ideas or insight in this? Thanks in advance
    Posted in: Lua Code Discussion
  • 0

    posted a message on OnUpdate question, or: how to timeout a dialog?
    Our guild uses EPGP and I'm writing an addon that streamlines the loot distribution, so the Masterlooter initiates a loot round that triggers custom dialogs on each raiders screen. I've added automatic responses for items that players cannot use and for players that have their /afk flag set.

    However sometimes the masterlooter still has to wait for afk players (who aren't flagged as such). Therefore I want to include a timeout for the dialog.

    I found the sample code below:
    local f = CreateFrame("Frame")
    f:Hide()
     
    local timer
     
    f:SetScript("OnShow", function() timer = 30 end)
    f:SetScript("OnUpdate", function(self, elap)
      timer = timer - elap
      if timer > 0 then return end
     
      --do stuff here-- 
     
      self:Hide()
    end)
     
    f:Show()


    My questions are:

    1) is this the appropiate way of handling this (given the context of what I want to do).

    2) how often does OnUpdate trigger? The wowwiki page tells me it is only triggered when the frame is redrawn- does that mean each screenrefresh or each time the frame is changed (repainted)?

    3) if the frame is hidden, the OnUpdate is no longer triggered in the background? (which seems to imply an update on screenrefresh, but just asking to be sure).

    The questions may sound a bit n00bish, but I want to be sure not to cause a major performance issue for calling this event like 60 times per second. Especially if I want to add a bar later on, ticking down the time left to answer the question.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Tooltip confusion
    I've found the error. I had a typo in my variable name a couple of lines above the code (where I did the GetItemInfo).

    Sorry for bothering you guys and thanks for the help! (I did pick up something new still- a good hint by creating a function instead of the inline method as mentioned by OrionShock)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Tooltip confusion
    Ah, should have seen that myself *blush*

    The thing is, now I get this error:
    Error: Original call failed while running hooks: GameTooltip.SetHyperlink:
    Auc-Advanced-5.3.4105 (DingoIII)\Libs\LibExtraTip\LibExtraTip.lua:251: Usage: GameTooltip:SetHyperlink(link)(tail call): ?
    <in C code>: ?
    <in C code>: in function `SetHyperlink'
    epgploot2-2.0\raider.lua:116: in function <Interface\AddOns\epgploot2\raider.lua:114>

    Where epgploot2 is the name of my addon, and raider.lua line 116 is the following snippet:
     
    114: LootIcon:SetScript("OnEnter", function (self)
    115:         GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
    116:         GameTooltip:SetHyperlink(self.link)
    117:         GameTooltip:Show()
    118:         end)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Tooltip confusion
    Quote from jerry
    add the following :
    looticon.link = sLink
    looticon:SetScript("OnEnter", function (self)
        GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
        GameTooltip:SetHyperlink(self.link)
        GameTooltip:Show()
    end)
    looticon:SetScript("OnLeave", function ()
        if GameTooltip:IsOwned(self) then
            GameTooltip:Hide()
        end
    end)


    Okay, I've added this code and it worked. I've rewrote my addon to work in the Ace3 way but now it throws this error:

    GameTooltip:IsOwned(): Couldn't find 'this' in frame object

    I am suspicious about the 'self' part. Since I use self:Print in that same function, I assume the 'self' in the code above also refers to my addon and not the looticon object. However, if I replace the 'self' by 'looticon' it does not solve the problem. In that case I receive an error having something to do with hooks:
    Original call failed while running hooks: GameTooltip.SetHyperlink:
    Auc-Advanced-5.3.4105 (DingoIII)\Libs\LibExtraTip\LibExtraTip.lua:251: Usage: GameTooltip:SetHyperlink(link)(tail call): ?


    What am I doing wrong here (and what's the right way to do it?)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Tooltip confusion
    Thanks for the responses! Can't wait to test it- got a day at work ahead of me first :(
    Posted in: Lua Code Discussion
  • 0

    posted a message on Tooltip confusion
    That sounds amazingly simple!

    To make sure if I understand correctly- the GameTooltip object is a globally available object? It's not something I need to 'declare' in my own addon?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Tooltip confusion
    Hi,

    I'm confused by how to add tooltips to my addon. Here is what I'm trying to do:

    When I loot a corpse, I iterate through the lootslots and create buttons in a dialog. Clicking a button starts our EPGPloot round in the raid. So far this works like a charm. Now to make it more clear what item is up for auction, I added a square button, with the texture set to the item's icon. This works as well... but now I am confused how to add a tooltip to that item.

    I tried to create a gametooltip object for each button but it doesn't show. So I was thinking, perhaps do I need to create one gametooltip object and have the onenter events set the proper item and do a show?

    Either way, I'm stuck. I am also wondering if showing a item via a textured button is the easiest way of doing it.

    I use this code to put the icons on my frame (f), sLink holds the itemlink string:
           local looticon = CreateFrame("Button", nil, f)
           looticon:SetFrameStrata("BACKGROUND")
           looticon:SetWidth(42) -- Set these to whatever height/width is needed 
           looticon:SetHeight(42) -- for your Texture
           local tx = looticon:CreateTexture(nil,"BACKGROUND")
           tx:SetTexture(GetItemIcon(sLink))
           tx:SetAllPoints(looticon)
           looticon.texture = tx
           looticon:SetPoint("TOP",-100,-16-i*45)


    Any help or pointers is greatly appreciated!
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detect wether a class can use an item?
    Thanks, I will take a look.

    You are right, I rather assume that someone can use it and only exclude stuff that I am absolutely certain of he/she cannot use (such as plate for a warlock).
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.