ā Need Help
I need to send a message when when i release any keyboard button. How can i do that?
20 Replies
this code will run a submarine drone. It should go forward when I press the key and stop when I release the key. Thanks for your help
you realize it will keep spamming writing "1" to the port if u keep holding W, right?
yeah
so if you stop holding the key, it wont write anymore
does the submarine drone still go forward after u release the key?
Actually "1" is running another function
my point is, does it still run the function after u release the key?
yes
there is a second code
well you might need to create an InputManager class
okey i will try
thanks
i can help you how to do it
it would be great
is there any function to get release key input
afaik for console, no
you'd have to make one
i need to google
it
when you press W for example
you will store a data that W is being held
okey after that?
and when you release it, the input class will check what keys are currently pressed, and what keys last updated were currently pressed
if you are not holding W but last time you updated, u were holding W
then that indicates that u just released the key W
oh i see
i will try
thanks for your help
š
@Med5801 just discovered its very hard to do on Console due to limitations u might need to use a keyboard hook instead https://stackoverflow.com/questions/52903672/wait-for-key-to-be-released
Stack Overflow
Wait for key to be released
In a simple test program that i made, you can increment a value with Console.ReadKey(). However, you can hold the button, and it will just keep increasing the value. I want my program to wait for t...
and dont try to close the thread as someone might have an answer better than mine
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.