sezanzeb / input-remapper

🎮 ⌨ An easy to use tool to change the behaviour of your input devices.
GNU General Public License v3.0
3.8k stars 156 forks source link

Make an autoclicker with start and stop #547

Open supertriodo opened 1 year ago

supertriodo commented 1 year ago

Hey there! First thanks for all the hard work in such an amazing tool. I use it everyday for all my games.

I can make an autoclicker of left click linking it to right click as long as I press it.

hold(key(BTN_LEFT).wait(200))

But, is there a way to make it so when I right click it starts the autoclick (on left click) until I press it again (right click)?

Thanks!

sezanzeb commented 1 year ago

This requres a new macro, maybe something like while_eq, which works similar to if_eq, but repeats the macro similar to repeat

sezanzeb commented 1 year ago

Writing macros is actually fairly easy. See the various add_... functions in inputremapper/injection/macros/macro.py

sezanzeb commented 1 year ago

it could then be used like

set(toggle, 1).while_eq(
    $toggle,
    1,
    hold(key(BTN_LEFT).wait(200))
)

the button that stops the loop:

set(toggle, 0)
supertriodo commented 1 year ago

That sounds great, I'll watch closely for when it's implemented, thanks for the answer!

Thorinori commented 1 year ago

Bumping this, it would be a fantastic feature to have included soon, and would functionally allow input-remapper to be a reasonable replacement for AutoHotKey that works with Linux for the people that want to make clickers etc. May look into implementing it myself as well potentially.

jonasBoss commented 1 year ago

Just leaving this here as an idea how to solve this with mapping handlers (from https://github.com/sezanzeb/input-remapper/pull/578#issuecomment-1374673063):

Add a InputConfig.toggle parameter which can solve https://github.com/sezanzeb/input-remapper/issues/547 and https://github.com/sezanzeb/input-remapper/issues/378 by inserting a ToggleHandler in the event-pipeline

RickAndTired commented 7 months ago

Would something like this work? (This exact example doesn't work)

Set a to hold(key(BTN_LEFT).wait(200)) Set b to if_eq($toggle, 0, key_down(a).set(toggle, 1), key_up(a).set(toggle, 0))