Thread Tools Display Modes
12-11-20, 05:17 PM   #1
Noctys
A Kobold Labourer
Join Date: Dec 2020
Posts: 1
OnMouseUp and mouseover

I last created Mods back before Cataclysm. It's been a long time. Just now getting back into it. I'm just trying to write a very basic mod that cancels attacking with the right mouse button.

Code:
WorldFrame:HookScript("OnMouseUp", function(self, button)
    if button == "RightButton" then
        local mouseoverName = UnitName("mouseover") or "Unknown";
        local reaction = UnitReaction("mouseover", "player") or 10;
        if reaction < 5 then			
            DEFAULT_CHAT_FRAME:AddMessage("Stopped Attack on: "..mouseoverName);
            MouselookStop();
        else
            DEFAULT_CHAT_FRAME:AddMessage(mouseoverName.." is friendly! "..reaction);
        end
    end
end)
The code I have should be working (from what I can tell) - but it's not. The code always returns Unknown & 10. If I swap out `mouseover` for `player` it works fine (but doesn't actually give me the data I need).

Also, if I swap out and hook-into `OnMouseDown` it also works, but then I can't actually interrupt the attack.

Any insight on why it's not working or how to fix it would be appreciated... Also if there is just a better way to do things I'm all ears.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » OnMouseUp and mouseover

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off