From an earlier discussion, I copied text that Keith Lammers had provided for having Voicebot continuously presses (presses and hold), until another key is pressed, but that doesn't seem to be working.
using System;
using System.Drawing;
public static class VoiceBotScript
{
public static void Run(IntPtr windowHandle)
{
// Send W continuously
BFS.Input.SendKeyDown("{VK_87}");
// loop forever
while (true)
{
// breaks loop if you press any of the following keys: SHIFT
if (BFS.Input.IsKeyDown("15"))
{
BFS.Input.SendKeyUp ( "{VK_87}" );
break;
};
// sleep for a bit so we don't run-up the CPU
BFS.General.Sleep(50);
}
BFS.Input.SendKeyUp ( "{VK_87}" );
}
}
The code above simply presses "w" once, and stops.
This is for use in the game,. DayZ, for running long distances. I want to just 'aim' and then when needed press a key to stop the running. (I got it to work earlier (continuously press/hold W, but then couldn't get it to stop, no matter what, so I had to exit voicebot.
Any ideas?
Thanks,
Van
EDIT: I've also added in a number of other break keystrokes, none of which work:
====================================
// Send W continuously
BFS.Input.SendKeyDown("{VK_119}");
// loop forever
while (true)
{
if (BFS.Input.IsKeyDown("15")) { BFS.Speech.TextToSpeech("Virtual Key 15 detected down"); BFS.General.Sleep(1250); break; }
if (BFS.Input.IsKeyDown("14")) { BFS.Speech.TextToSpeech("Virtual Key 14 detected down"); BFS.General.Sleep(1250); break; }
if (BFS.Input.IsKeyDown("32")) { BFS.Speech.TextToSpeech("Virtual Key 32 detected down"); BFS.General.Sleep(1250); break;}
====================================
The script, in fact, stays running, no matter which key I press (and I've tried a lot), I have to stop it by cliking the icon in the systray.