• 0

    posted a message on LibGuildPosition issues.
    I have a couple of questions regarding communication of guild positions.

    1.)
    Question: Is there any other library/addon besides LibGuildPosition-1.0 which does this?


    2.)
    Background information:
    LibGuildPosition-1.0 fires a callback of the following form:
    -- somehere in addon:OnEnable
    LibGuildPositions.RegisterCallback(self, 'Position', function(...)
        self:OnGuildPositionChange(...)
    end)
    
    function addon:OnGuildPositionChange(event, unitName, zoneX, zoneY, zone)
        -- do stuff
    end

    Where event will be the string "Position", unitName will be the name of a guild member, zoneX and zoneY range from 0 to 1 and zone will be the map texture name of a zone, for example "StormwindCity" as returned by GetMapInfo.

    Question: Is there an easy way to translate the texturename to a areaID (as returned by GetCurrentMapAreaID

    The only approach, besides hard coding, that comes to mind is to iterate over every map with SetMapByID and compare the result of GetMapInfo.


    3.)
    Background Information:
    -- [...]
    function addon:OnEnable()
        -- [...]
        LibGuildPositions.RegisterCallback(self, 'Position', function(...)
            self:Debug("Position")
            self:OnGuildPositionChange(...)
        end)
        -- [...]
        self:Debug("LibGuildPositions-1.0 callbacks registered.")
    end
    -- [...]
    function addon:OnGuildPositionChange(event, unitName, zoneX, zoneY, zone)    
        self:Debug(("OnGuildPositionChange(unitName=%s, zoneX=%f, zoneY=%f, zone=%s)"):format(unitName, zoneX, zoneY, tostring(zone)))
        error("why is this never executed?")
        -- [...]
    end
    

    I can see that registration was done ("LibGuildPositions-1.0 callbacks registered." appears in chat).
    Question: Why is neither "Position" nor the other debug mesage ever printed. And why does the error never occur?
    I can not totally exclude the possibility that my guild members are doing something wrong. However, at least two have the library stand alone installed.

    Edit: After additional testing it seems that LibGuildPositions-1.0 does not work standalone. Or my guild mates failed to install it stand alone. Embedded in my addon it works.
    Posted in: Lua Code Discussion
  • 0

    posted a message on LibMapPins-1.0
    Can you clarify the difference between metric and imperial?
    I know that in locale enUS the spell Penance has 40 yd range.
    However, in deDE it has 40 Meter Reichweite (translation: 40 meter range).
    That being said, it seems to me that 1 gameyard = 1 gamemeter, hence the distinction is not needed. Or are you talking about kilometers and (imperial) miles?
    I don't think this is something the library needs, just return gameyard/meters, if anyone wants to display them in miles they can do the translation themselves.
    Posted in: Libraries
  • 0

    posted a message on "Convention" for certain commonly hooked functions?
    I'm confused. Isn't that the purpose of AceHook-3.0?
    Cause thats exactly the reason I use it for.
    Posted in: Lua Code Discussion
  • 0

    posted a message on LibFunctional-1.0
    Quote from slaren
    The name is taken from underscore.js. In the context of this library (one that mainly works on lists and tables) I think it is good enough, but I am open to suggestions.

    After thinking about a table as a map, invert totally makes sense. Would be interesting to know what the behaviour of non-injective tables is.
    Consider:
    local t = { a = "c", b = "c" }
    

    I suppose the result is undefined? Might be worth mentioning.

    Quote from slaren

    Both of these functions are implemented on terms of reduce, for example min is a call to reduce(list, math.min), so the rationale there is that if you need something more specialized you should use reduce instead.

    That makes sense.

    Quote from slaren

    In the spirit of functional programming, all the functions should return copies. The exceptions are sort and shuffle, which work in-place by default for performance (but both have versions that return copies). Probably I should make sort and shuffle returns copies by default, and name the versions that work in-place something else ?

    I agree that they should return copies. I was complaining about the inconsistent naming.
    Maybe shuffle_inplace?


    Also I am missing zipWith. While this can be done by
    zipWith = function(f, a, b) 
        return map(zip(a, b), function(t) f(t[1], t[2]) end
    end
    

    this creates unecessary tables. Maybe a direct implementation would be more efficient?
    Posted in: Libraries
  • 0

    posted a message on LibFunctional-1.0
    • I don't like the name invert, does not feel intuitive.
    • min and max could optionally take a comparator function.
    • Some names are strange, for example reverse returnes a copy, while shuffle does so inplace. Maybe reversed would be a better name?
    • It is unclear (from the api) whether the following will terminate:
    • local t = {}
      local s = {}
      s[1] = t
      t[1] = s
      equal(t, s)
      
      [*] equal takes an argument for shallow or not, why doesn't clone do?
      

    Also some usage examples might be nice.
    Posted in: Libraries
  • 0

    posted a message on Crafting an Item
    Thanks for your suggestion, I will have a look.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Anchoring to certain interface elements not possible?
    Dridzt, in theory that could cause a conflict with another addon also using "PreClick" or am I missing something here?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Anchoring to certain interface elements not possible?
    Please keep in mind that the second argument of
    http://wowprogramming.com/docs/api/CreateFrame
    will become a global variable, i.e, these names should be unique.

    Of course it is possible to anchor more than one frame (buttons are frames) to the same frame. That happens all the time. In fact in your scenario they are all anchored to MacroFrame.
    An of course you can use the same relative point in a frame more than once.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Crafting an Item
    Short version: Can I craft an item by clicking a button? (Without opening the tradeskill window)

    Long version:
    Is crafting an item protected?
    DoTradeskill is not marked as protected.
    The main problem with this is however that this requires the correct tradeskill window to be opened which I would like to skip.
    A simple approach with SetAttribute did not work.

    I am looking for a simple way (ideally without scanning all professions first) to craft an item (like Imperial Silk) by clicking a button.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Anchoring to certain interface elements not possible?
    Some thoughts.
    a)
    You are giving the relative point as a string. I never do that. I suppose it works, though wowprogramming does not lists string as allowed arguments. However I suggest using a reference instead.
    Replace
    MacroCancelButton:SetPoint("BOTTOMRIGHT", "MacroFrameScrollFrame", "TOPRIGHT", 25, 6)

    by
    MacroCancelButton:SetPoint("BOTTOMRIGHT", MacroFrameScrollFrame, "TOPRIGHT", 25, 6)


    b) Taint.
    I suppose clicking on a macro with your addon enabled will create taint.
    You might want to rewrite your
    _G["MacroButton"..i]:HookScript("OnClick", function(self) btn:SetAttribute("macro",MacroFrame.selectedMacro) end)


    At least you should add a InCombatLockdown check.

    c) Typo?
    btn:SetAttribute("type1", "macro")

    I thought (and used) always "type", maybe I am missing something.

    d) Delayed loading.
    It seems your frame is only used for receiving the "ADDON_LOADED" event.
    In that case I would suggest only creating the frame when you need it. You will need to move the f:UnregisterEvent(...) out of the CreateRunButton method.

    e) Framestrata
    You might want to have the run buttons framestrata the same as the others.
    I suggest
    btn:SetFrameStrata(MacroCancelButton:GetFrameStrata())



    Answering your original question would be easier if you stated the exact problem. Maybe a Screenshot can help.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Finding tradeskill cooldowns
    Okay, works perfectly to query the information.
    Thank you very much Phanx.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Finding tradeskill cooldowns
    On my tailor, which does not have enchanting:
    -- Imperial Silk (Tailoring)
    [URL="http://wowprogramming.com/docs/api/IsSpellKnown"]IsSpellKnown[/URL]([URL="http://www.wowhead.com/spell=125557"]125557[/URL]) -- false on my tailor
    [URL="http://wowprogramming.com/docs/api/IsPlayerSpell"]IsPlayerSpell[/URL]([URL="http://www.wowhead.com/spell=125557"]125557[/URL]) -- true on my tailor
    -- Sha Crystal (Enchanting)
    [URL="http://wowprogramming.com/docs/api/IsSpellKnown"]IsSpellKnown[/URL]([URL="http://www.wowhead.com/spell=116499"]116499[/URL]) -- false on my non-enchanter
    [URL="http://wowprogramming.com/docs/api/IsPlayerSpell"]IsPlayerSpell[/URL]([URL="http://www.wowhead.com/spell=116499"]116499[/URL]) -- false on my non-enchanter


    tl;dr: IsSpellKnown does not work for tradeskills, IsPlayerSpell does
    Posted in: Lua Code Discussion
  • 0

    posted a message on Finding tradeskill cooldowns
    Is there an easy way to get a players tradeskills and their cooldowns?
    What I have seen so far seems pretty complicated.
    (http://www.wowace.com/addons/broker-tradecooldowns/) for example.

    Basically I only want to know whether a tradeskill (Imperial Silk, Sha Crystal for example) is ready for a player.

    What I tried so far is
    local start, duration, enable = [URL="http://wowprogramming.com/docs/api/GetSpellCooldown"]GetSpellCooldown[/URL]([URL="http://www.wowhead.com/spell=125557"]125557[/URL])
    -- returns 0,0,1 if I have the spell and it is not on cooldown
    -- returns 2091844.252, 19966.7, 1 if I have the spell and it is on cooldown
    -- returns also 0,0,1 if the player does not have the skill
    


    So the Problem seems to be the players without the skill.

    Any good ideas?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Lua buttons
    Quote from Seerah
    Hearth:SetAllPoints()

    http://wowprogramming.com/docs/widgets/Region/SetAllPoints

    In other words... You're telling it to anchor to all points of its parent. ;)

    ... which is UIParent, hence the fullscreen.
    Maybe you want to have your NibsMain as the parent?

    Generally It does not make sense to specify both Width and Height and more than one point.

    Also "Hearth" is probably not a good frame name, as this will become a global variable. "NibsHearth" would be preferable.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Policy on updating old addons
    Well... I can't agree to most of your points. But I am not a lawyer. I am also incapable of even considering non german copyright law. I am not even sure if this is the right term.
    Nevertheless I am pretty sure that there is a law which forbids using software.

    Your second paragraph is orthogonal to what I wrote about.
    Fact remains that "All rights reserved" conflicts with that implicit/explicit license via curse.
    Posted in: General Chat
  • To post a comment, please or register a new account.