Python Forum
Pyautogui, İmagesearch, Moving target
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pyautogui, İmagesearch, Moving target
#1
"
while True:

p01 = imagesearch("p01.png")
        if p01[0] != -1:
            pyautogui.click(p01[0], p01[1])            (click)
            pyautogui.click(p01[0]+200, p01[1])    (range)
            time.sleep(5)                                         (approaching the target)
            pyautogui.press("space")                      (attack)
"

İ have simple code like this but i have a problem xd, as second command i make 200 unit right click of target,

When "p01" detects its target on the screen, for example 500x700, and if i repeat this line of code it constantly clicks on the 500x900 unit and moving away from target.

Since what I want to do is a "moving target", scanning the image continuously and having a distance of 200 units between the target and the target with variable coordinates.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  What is the Target value in this GridSearchCV problem? Led_Zeppelin 0 662 Feb-15-2023, 07:32 PM
Last Post: Led_Zeppelin
  PyautoGUI- How to use If - Else with pyautogui.locateCenterOnScreen Tiel 3 8,407 Jun-27-2022, 02:00 PM
Last Post: DeaD_EyE
  pyautogui.locateOnScreen producing error dude8074 6 3,862 Apr-17-2022, 05:05 PM
Last Post: bowlofred
  How to read python shortcut target profile directory of Chrome Ink file sunny9495 1 1,670 Apr-12-2022, 06:12 PM
Last Post: sunny9495
  Control Mouse and Keyboard Across the Country Without VNC on Target PC Khuber79 5 3,016 Feb-21-2021, 02:42 AM
Last Post: NullAdmin
  how to take a screnshot by Pyautogui automatically and randomly rachidel07 0 3,562 Feb-03-2021, 01:16 PM
Last Post: rachidel07
Sad problem with Pyautogui rachidel07 1 2,478 Jan-27-2021, 05:43 PM
Last Post: nilamo
  pyautogui with a display emulator? gumby4231 0 2,611 Jul-30-2020, 02:46 PM
Last Post: gumby4231
  pyautogui.screenshot region is not working alexlu 6 6,526 Jun-04-2020, 10:46 AM
Last Post: alexlu
  Automated compile - Multiple Target OS? nogi 5 2,610 Mar-24-2020, 11:44 AM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020