After some trial and error it looks like I get the data I need with OnMouseDown instead of using OnMouseUp -- however, doing it that way I can't cancel the attack.
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.
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. I'm guessing that the unitId "mouseover" is no longer valid because if I swap it out for "player" it works fine. 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.
You probably already figured this out, but you are correct - Pet Bar is not considered one of your bars as the message is telling you. It needs to be on bar 1 - 10
0
After some trial and error it looks like I get the data I need with OnMouseDown instead of using OnMouseUp -- however, doing it that way I can't cancel the attack.
0
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.
The code I have should be working (from what I can tell) - but it's not. I'm guessing that the unitId "mouseover" is no longer valid because if I swap it out for "player" it works fine. 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.
0
You probably already figured this out, but you are correct - Pet Bar is not considered one of your bars as the message is telling you. It needs to be on bar 1 - 10