input-remapper icon indicating copy to clipboard operation
input-remapper copied to clipboard

Make an autoclicker with start and stop

Open supertriodo opened this issue 2 years ago • 8 comments

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!

supertriodo avatar Nov 18 '22 10:11 supertriodo

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

sezanzeb avatar Nov 18 '22 11:11 sezanzeb

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

sezanzeb avatar Nov 18 '22 11:11 sezanzeb

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)

sezanzeb avatar Nov 18 '22 12:11 sezanzeb

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

supertriodo avatar Nov 18 '22 12:11 supertriodo

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.

Thorinori avatar Jun 08 '23 03:06 Thorinori

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

jonasBoss avatar Jun 16 '23 13:06 jonasBoss

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))

RickAndTired avatar Mar 03 '24 21:03 RickAndTired