Mausbewegung im Spiel (Fortnite) mit PydirectinputPython

Python-Programme
Guest
 Mausbewegung im Spiel (Fortnite) mit Pydirectinput

Post by Guest »

Ich möchte, dass sich meine Maus zum Namensschild des Spielers bewegt. Wenn ich auf Windows drücke, funktioniert es mit dem Windows-Fadenkreuz, aber im Spiel bewegt sie sich an eine zufällige Stelle.

Code: Select all

import pyautogui
import pydirectinput
import time
import keyboard

def loop1():
while True:
image_files = ["Screenshot 2025-01-25 153403.png"]

for filename in image_files:
try:
center_x, center_y = pyautogui.size()
center_x = center_x // 2
center_y = center_y // 2
region = (center_x - 750, center_y - 600, 1500, 1200)
nametag = pyautogui.locateCenterOnScreen(filename, confidence=0.6, region=region)

if nametag:
print("found")
x, y = nametag
pydirectinput.moveRel(x, y, duration=0.1)
print("found file", filename, "in", nametag)
time.sleep(1)
continue

except pyautogui.ImageNotFoundException:
time.sleep(2)
print('not found')
continue
time.sleep(1)

while True:
if keyboard.is_pressed('`'):
loop1()
Ich habe versucht, relativ noch das gleiche Problem zu verwenden, das sich an einen "zufälligen Ort" bewegt, nachdem Nametag gefunden wurde.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post