Author Topic: Trouble holding down [f2] key.  (Read 2362 times)

getfear

  • Guest
Trouble holding down [f2] key.
« on: December 06, 2017, 11:05:35 PM »
hello, I am using voice attack as a copilot in this flight simulator. so far I've had very good results making it do stuff like gear down/up, control flaps etc.

now I am trying to add a "reverse thrust" command, for that the key bind is to hold down the f2 key until the engines are where you want them then release it, about 1 to 2 seconds holding it. seems simple right?

when I do it on my keyboard it works no problem, but when I set it up in voice attack it doesn't work, I used the switch-hitter program to confirm that the key is being pressed correctly and it seems that it is, but when I go to http://www.keyboardtester.com/ the key behaves differently.

on the website when I hold the f2 key it makes a continuous clicking noise[in the website a click is heard everytime a key is pressed] but when I run the voice attack command it only clicks once but it still registers that it was kept held down. if anybody could help me set this up id be very happy it's driving me nuts

thanks!

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Trouble holding down [f2] key.
« Reply #1 on: December 07, 2017, 06:40:28 AM »
The website not "clicking" multiple times is normal, see this topic.

However, the lack of character repeat should not affect most games, which flight simulator are you testing this with?

getfear

  • Guest
Re: Trouble holding down [f2] key.
« Reply #2 on: December 07, 2017, 11:02:17 PM »
I'm using Microsoft flight simulator x steam edition. and the key not repeating is affecting in this case because it is not working correctly.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Trouble holding down [f2] key.
« Reply #3 on: December 08, 2017, 04:39:38 AM »
I don't have FSX installed, but IIRC the controls have a "repeat" slider next to them, have you tried moving that to the right?

Alternatively, you can have VoiceAttack press the key repeatedly:
Code: [Select]
Start Loop : Repeat 10 Times
Press F2 key and hold for 0,06 seconds and release
Pause 0,01 seconds
End Loop
This is the "simple" solution, where the key is pressed a set number of times. You can adjust the key down and pause timing so that each press will be registered correctly by FSX, or add more presses than you need to compensate for those that are lost(if you're moving a control to the maximum/minimum value).

You could also use a loop to repeat the key for a certain amount of time:
Code: [Select]
Set decimal [~timeStart] value to the converted value of {DATETICKS}
Start Loop While : [{EXP: {DATETICKS} >= {DEC:~timeStart} + 10000000}] Equals '0'
Press A key and hold for 0,06 seconds and release
End Loop
Again, you can adjust the key hold down time(likely reduce it, as 60ms is longer than many applications require). The amount of times the key is pressed in the given timespan depends on how long it's held down each time.

You can adjust the total repeat time by changing 10,000,000(which is one second in ticks), to another number.

getfear

  • Guest
Re: Trouble holding down [f2] key.
« Reply #4 on: December 08, 2017, 03:41:34 PM »
I thought about using the "repeat slider" but it only appears when mapping to a HOTAS button and not a keyboard key, but the repeat a key for a set amount of time worked like a charm thanks for the help!