Push 'infinitely' keyboard button

Asked

Viewed 1,363 times

0

I am running a python3.5 test using the pyautogui library. My goal is for the algorithm to press buttons for me.

import pyautogui

while True:
 pyautogui.press('f1')

In this case, it is pressing F1. I did several tests and it really works on my pc. But, I would like to test it in a game, Lineage II, but it does not catch :S. I have tested it with letters a,b,c... (on my pc it works, on the server no :S). They would have tips on how to put to work on the server?

  • 1

    What do you mean it doesn’t work on the server? I don’t know this game.

  • To do this you have to open the interactive Unreal Engine command line and write the equivalent of this code in Unreal C++.

1 answer

1

The "press()" function is no more than the use of the "keyDown()" and "keyUp()" functions in sequence.

It may be that the two functions are evoked with an interval too short between them to be recognized by the game.

Try doing the following:

import pyautogui, time

while True:
    pyautogui.keyDown('f1')
    time.sleep(1)
    pyautogui.keyUp('f1')

However, most games block the execution of third-party script precisely to avoid circumventing the interface with the player.

  • I’ve been doing some research and have to circumvent a protection of their server. : S

Browser other questions tagged

You are not signed in. Login or sign up in order to post.