mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
add support for 'button' conditional (#3)
* add support for 'button' conditional * Route [button] through Multi, add [nobutton], register as static - [button] now reads conditionals.button via Multi(...) instead of indexing _groups.button[1].values[1] directly, so OR/AND lists and repeated groups behave like every other argument conditional. [button:1/2] now matches left or right; previously only the first value was ever checked and the rest were silently dropped. This also removes the unguarded _groups reach-in, which Multi itself defends against (it checks _groups is present and falls back to _operators). - Adds [nobutton:N] via NegatedMulti, following the convention that every conditional ships its negation (nomod, nostance, nokeydown, ...). - Bare [button] / [nobutton] now mean "any / no mapped mouse button held", mirroring bare [mod]. Bare [nobutton] doubles as an "activated by a keybind rather than a click" test. - Registers button/nobutton in STATIC_CONDITIONALS next to mod and keydown, so they are checked once up front rather than re-evaluated for every candidate unit during multiscan target scanning. Still open: IsMouseButtonDown reports live physical state, so a keybound macro has no button held and [button:N] is false for it, and whether the button still reads down at macro-execution time depends on whether the action button fires on mouse-down or mouse-up. Needs in-game verification. --------- Co-authored-by: Brues <5278969+brues-code@users.noreply.github.com>
This commit is contained in:
+18
@@ -656,6 +656,24 @@ function CleveRoids.PrintT(t, depth)
|
||||
end
|
||||
end
|
||||
|
||||
CleveRoids.buttons = {
|
||||
['1'] = 'LeftButton',
|
||||
['2'] = 'RightButton',
|
||||
['3'] = 'MiddleButton',
|
||||
['4'] = 'Button4',
|
||||
['5'] = 'Button5',
|
||||
}
|
||||
|
||||
-- True while any mapped mouse button is held. Backs the argument-less [button] /
|
||||
-- [nobutton], mirroring how a bare [mod] means "any modifier". Bare [nobutton] is
|
||||
-- the practical "activated by a keybind, not a click" test.
|
||||
function CleveRoids.AnyMouseButtonDown()
|
||||
for _, name in pairs(CleveRoids.buttons) do
|
||||
if IsMouseButtonDown(name) then return true end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
CleveRoids.kmods = {
|
||||
ctrl = IsControlKeyDown,
|
||||
lctrl = IsLeftControlKeyDown,
|
||||
|
||||
Reference in New Issue
Block a user