How to send a key #1996
-
I want do a command that will press a key i will send with a command like: /press w 10 - press w for 10 secs |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Key presses typically don't work that way in any programming system. Key presses are stored internally by the operating system in a buffer/queue which a program will then poll and respond to by executing some routine. The same routine will likely also be bound to mouse/controller events.
So what you need to know is what routine/method is bound to F10 or esc in your example(s) above. But assuming you do know what piece of code should be run, Otherwise you need to send a network request to the client which will in turn execute that method when the network message is received. I suspect you are trying to write an "autoclicker" or some kind of macro automation? |
Beta Was this translation helpful? Give feedback.
Key presses typically don't work that way in any programming system.
Key presses are stored internally by the operating system in a buffer/queue which a program will then poll and respond to by executing some routine. The same routine will likely also be bound to mouse/controller events.
This linkage is usually arbitrary, in Minecraft these could be:
So what you need to know is what routine/method is bound to F10 or esc in your example(s) above.
This will in general be context sensitive based on what UI is displayed.
But assuming you do know what piece of code should be run,
it …