Toggle hold key?

I’m pretty sure this has been answered before, but I can’t seem to find the thread. At least, the search results I found aren’t exactly the answer I’m looking for.

Is there a way to set a macro to toggle holding down a key? For example, in gaming: I want to set autorun for games that don’t have this feature. So, tap a button and it holds the Forward key (probably w for most), then releases the key when pressing the same key assigned to that macro.

Also, can it repeatedly tap e while holding this key down? So, this would help with games with a Gather ability, such as resources. I’d like to tap one key to set autorun while rapidly tapping the gather key, then disable the functions completely by tapping the same key again.

1 Like

I just updated my Gaming Config (Tips & Tricks?) thread. Check out the “Double-Tap to sprint/crouch” and “Auto-Walk” sections.


I’m not sure how to autoRepeat tapKey e without manually holding down the macro key…
I also don’t know if repeating a steady (non-variably delayed) tapKey will trigger any anti-cheat systems.:man_shrugging:

Here’s a modification to my to Auto-Walk macro to include persistent e. I tried it in Once Human, but persistent e seems like it’s just interpreted as a held key and ignored after the initial action (instead of being interpreted as spamming e).:disappointed_face: The auto-walk part (persistent w) still works fine though…

Anyway this was my attempt:

Auto-Walk and Gather

toggleKey persistent w
toggleKey persistent e

That should just toggle holding w and e. I’d place it on backtick.

Then these will cancel the persistent w & persistent e when tapping the w or s keys, but make them work as normal otherwise:

Place the following on your W key:
Auto-Walk and Gather release persistent (W)

pressKey w
releaseKey persistent w
releaseKey persistent e
holdKey w

Place this one on your S key:
Auto-Walk and Gather release persistent (S)

pressKey s
releaseKey persistent w
releaseKey persistent e
holdKey s

Maybe also place the following on your E key, to cancel only the persistent e, while continuing to auto-walk:

Auto-Walk and Gather release persistent (E)

pressKey e
releaseKey persistent e
holdKey e
2 Likes

Also, can it repeatedly tap e while holding this key down?

Something like this should work fine, while holding this key down:

start:
pressKey a
delayUntil 50
releaseKey a
delayUntil 50
ifKeyActive $thisKeyId goTo start

Without holding the key, you will need to modify the condition and add some variable to keep the macro alive.

2 Likes

Toggled autotapper should be possible with something like:

if ($autotapperOn == true) final setVar autotapperOn false
setVar autotapperOn true

start:
  pressKey a
  delayUntil 50
  releaseKey a
  delayUntil 50
if ($autotapperOn == true) goTo start

Now you can combine it with the sprint modifier (say shift) like:

if ($autotapperOn == true) final setVar autotapperOn false
setVar autotapperOn true

pressKey LS
start:
  pressKey a
  delayUntil 50
  releaseKey a
  delayUntil 50
if ($autotapperOn == true) goTo start
releaseKey LS
3 Likes

Thanks Karel! I never would’ve figured that out myself.:sweat_smile:

I tested the following in Once Human, and it works really well. Toggles holding w and LShift to sprint forward while spamming e:

if ($autotapperOn == true) final setVar autotapperOn false
setVar autotapperOn true

pressKey w
pressKey LS
start:
  pressKey e
  delayUntil 50
  releaseKey e
  delayUntil 50
if ($autotapperOn == true) goTo start
releaseKey w
releaseKey LS

I think I’d prefer to keep the sprint, auto-walk, and auto-tapper as separate/independent functions though. I’ll work out some variations and add them to my Gaming Config thread, if you guys don’t mind?

1 Like

That “keep the macro alive” is exactly why I forked the snap-worker macro in my snap smart macros. It is kept running and can manipulate keys to it’s liking without them getting released automatically.

2 Likes

I’m convinced I’ll never fully understand the smart macro language. I can kinda make sense of bits & pieces, but most of the stuff you guys come up with is indistinguishable from magic to a derpy dude like myself.:top_hat::magic_wand::sparkles: