Author Topic: Holding down one key while intermittently pressing another key?  (Read 1105 times)

Canescj

  • Guest
Holding down one key while intermittently pressing another key?
« on: October 24, 2019, 03:54:18 PM »
Trying to set up voice commands for GTA 5, but driving forward you build up too much speed if you don't intermittently brake. I can't figure out how to have the brake key be hit every few seconds only while the drive key remains held down. Any suggestions?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4761
  • RTFM
Re: Holding down one key while intermittently pressing another key?
« Reply #1 on: October 24, 2019, 03:59:55 PM »
You could do something like this:
Code: [Select]
Press down W key
Start Loop While :  Keyboard Key 'W' Is Pressed
Pause 0,5 seconds
Press S key and hold for 0,01 seconds and release
End Loop

Because VoiceAttack is holding the W key down, the loop will keep going until you release that key (either by pressing and releasing the physical key, or by another method, E.G. using another VoiceAttack command), after which the command will stop (depending on where in the cycle the loop is, that can take up to the pause length you have set to occur).

Canescj

  • Guest
Re: Holding down one key while intermittently pressing another key?
« Reply #2 on: October 24, 2019, 04:04:44 PM »
Thanks, it worked!