• 0

    posted a message on Help with bind the my own button

    Hello addon developers! Sorry if I'm writing in the wrong place. 

     

    I want to create a button that would track the buff on me. And when a button appears, I would press it and use a spell.

    For this, I decided to use the addon Weakauras 2.  This addon can track buffs, it remains only to write the code for the button.

     

    The button only responds to a mouse left click.
    Please tell me what needs to be added to the code so that my button responds to the "1" key.
    Thanks!

     

     

    My code

     

    -- Creating button
    local captor = CreateFrame("Button", nil, aura_env.region, "SecureActionButtonTemplate")

    -- Setting position
    point
    , relativeTo, relativePoint, xOfs, yOfs = aura_env.region:GetPoint()
    captor
    :SetPoint(point, relativeTo, relativePoint, xOfs, yOfs)
    captor
    :SetWidth(aura_env.region:GetWidth())
    captor
    :SetHeight(aura_env.region:GetHeight())

    captor
    :SetAttribute("type", "spell");
    captor
    :SetAttribute("spell", "Spellname");

    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.