I’ve used [mod/nomod], button clicks, etc for /use and /cast, but now I am trying to use conditions for other slash commands, and it doesn’t seem to work any way I have tried.
Are the conditions only limited to a few slash commands?
For example, if I want to make 1 button bring up macros and reload, I would try this;
Thanks!
That works.
Where do you find a language ref for this?
I’ve been looking on wowinterface, but maybe it’s not as easy as I thought.
If I wanted to add an “or RightClick” to the logic is that even possible?
I can’t find a right-click function.
I tried this, but no luck…
/run if IsModifierKeyDown() or OnMouseDown(self,RightButton) then ReloadUI() else ShowMacroFrame() end
/run if IsModifierKeyDown() and IsKeyDown("RightButton") then ReloadUI() else ShowMacroFrame() end
But macros (as fas as I know) run on KeyUp so the IsKeyDown is never going to be true.
You could use a specific modifier key:
Not everything in the lua WoW API can be used in macros which is why the macro language and conditionals exist. To control what and how actions work, primarily but not only in combat.
Thanks, I’ll keep playing and trying to learn it.
I changed the “and” to an “or” and it still doesn’t work, but I’m learning…
If I can’t get it, I’ll just leave it the way it is in your first example, and forget the right-click.
I was just trying to get it to reload on a right-click, or a modifier click.
It seems like every simple macro I try to make is not so simple after all.
I have to edit my old post, because I cannot reply again. The forum is terrible;
Maybe you can fix my try…
/run if IsModifierKeyDown() or IsMouseButtonDown(“RightButton”) then ReloadUI() else ShowMacroFrame(not ShowMacroFrame()) end
I was trying to toggle the macro frame, but that part isn’t working either in a separate test;
/run ShowMacroFrame(not ShowMacroFrame()) end
But even trying without that part, the Right-Click isn’t working either.
Just for the macro frame toggle, I got this to work, but it’s sloppy. For some reason, it walks across the screen as I toggle it.
If I can figure out the right-click part, maybe I can work on the rest.
/run if MacroFrame:IsShown() then MacroFrame:Hide() else ShowMacroFrame() end
If the macro runs on key up then IsMouseButtonDown("RightButton") is never going to work as it will always return false.
I suggested maybe using a specific modifer and a macro frame toggle, something like:
/run if IsShiftKeyDown() then ReloadUI() else if MacroFrame and MacroFrame:IsShown() then HideUIPanel(MacroFrame) else ShowMacroFrame() end end
There is a limit to what you can/can’t do with macros and macro buttons but for this type of thing you could create a small addon with a button that CAN detect which button is down.
Copy/paste the following to the website addon.bool.no to create/download the code as an addon (the button will be at the top/middle of your screen but you can reposition it by changing the SetPoint(…) parameters).
local f = CreateFrame("Button", "BellenäMacroUIButton", UIParent, "UIPanelButtonTemplate")
f:SetSize(100, 30)
f:RegisterForClicks("LeftButtonDown", "RightButtonDown")
--f.icon:SetTexture(4638435)
f:SetText("Macro/Reload")
f:SetPoint("TOP", UIParent, "TOP", 0, -15)
f:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_TOP")
GameTooltip:SetText("Shift-right click ro reload\nelse toggle Macro UI.")
end)
f:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
f:SetScript("OnClick", function(self, button, down)
if IsShiftKeyDown() and button == "RightButton" then
ReloadUI()
else
if MacroFrame and MacroFrame:IsShown() then
HideUIPanel(MacroFrame)
else
ShowMacroFrame()
end
end
end)
There is a limit in what you can do with this sort of button as well like no combat actions or anything else the games considers secure.