Closed SolemnDucc closed 4 years ago
Hi @SolemnDucc - This is great! I’m really glad to hear how your bot is going!
I wanted to let you know I have your message and I’ll post a code sample later today (and an updated nugget).
What game?
Hi @SolemnDucc - I wanted to let you know I just published an updated nuget package (6.1.1) that contains a lot of enhancements, fixes, and tweaks.
There are a couple of different ways to accomplish what you want to do and it will depend on how advanced you want to get with you code.
First, at a high level, this is what you'll want to do: When you simulate keystrokes, run it in an alternate thread. Pass a cancelation token into the Simulate method can cancel that token when you want simulation to stop.
In order to detect when the W key is pressed, you can do the following:
I hope this helps!
Hello, first of all i want to thank you. Really nice project. I tried several other things before but none let me actually simulate key presses that get accepted by the game that i want to write a bot for. So my bot can move my character thanks to your
await WindowsInput.Simulate.Events() .Hold(KeyCode.W).Wait(100) .Release(KeyCode.W) .Invoke();
Methode. Now, the bot shall stop moving my character as soon as i press "W". So i need something like:if(!WindowsInput.IsKeyPressed(KeyCode.W) { await WindowsInput.Simulate.Events() .Hold(KeyCode.W).Wait(100) .Release(KeyCode.W) .Invoke(); }
Is there a Methode like this or how can i archieve this? By the way my program is a console application. So i don't know if or how i can use your KeyEvent Methode you showed in your Capture Keys example.