Home python How to write a message to Minecraft chat in the twisted mode,...

How to write a message to Minecraft chat in the twisted mode, python

Author

Date

Category

How to write a message to Minecraft chat in the twisted mode, python

It is necessary on the server, on behalf of the player, a certain line was written.

previously wrote through Keyboard
But it is wildly uncomfortable, because Chat opens and due to the fact that the character in motion is written incorrectly, for example wwwwwing the world!


Answer 1

You can simply clamp the Ctrl key before printing the text. And after printing. When the Ctrl is swapped, the text from the keyboard is not printed. And with python continues.


Answer 2

Try using pyautogui – https://pypi.org/project/pyutogui/

import pyautogui
Pyautogui.Write ('Hello World!', Interval = 0.25)
pyautogui.write (['left', 'left', 'left', 'left', 'left', 'left'])

If you want to open chat, use the mouse (find the chat coordinates on the screen):

pyautogui.moveto (100, 150) # moves the mouse to the x, y - 100, 150 coordinates.
Pyautogui.Click () # Press on the left mouse button in current coordinates.
Pyautogui.Click (200, 220) # clicks on the left mouse button in X, Y - 200, 220 coordinates.

If you are already in the program, try to open the chat keyboard:

pyautogui.press ('Enter') # simulates the physical press of the Enter key

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions