Jump to content

Noob need help with script


Recommended Posts

Hello i recently started with autoit and Im trying to make a script for a game where it Search for a pixel color and if it found it then continue with the script but if it cant find the pixel color then restart from the while loop at top. What Am i doing Wrong? And is it possible to make a certain action to be made Every 60 seconds while the rest of script is working ?. Like move mouse to a position and left click.. And i warn you, this is probably the ugliest script you have seen :P.

 

$testx = 159
$testsy = 101
$handx = 857
$handy = 411

While      ;Here start main loop
    Sleep(20)
    $coord = PixelSearch(970, 260, 975, 265, 0x7260FF) ;Check if color is true
     If @error Then ;how to make it reload from the while loop?

If Not @error Then
       Sleep(20)
    $coord1 = PixelSearch(155, 98, 159, 101, 0x948E85) ;check for pixel at left pos
    if Not @Error Then
           Sleep(20)
       MouseClickDrag("left", $testx, $testsy, $handx, $handy) ;click and drag
      Send("Hello")
      sleep(20)
      Send("{ENTER}")
      MouseClickDrag("left", $handx, $handy, $testx, $testsy);move it back
      Endif
      endif
      If @Error Then
     MouseClick("primary", 182, 76, 1) ;click on this position and then reload from start (while)
  EndIf
  sleep (1000)
  WEnd

 

 

Link to comment
Share on other sites

Welcome to AutoIt and the forum!

Seems you missed to read the forum rules on your way in. Game automation of any kind is not permitted here.
That's why you won't get any help on this subject.

Hope to see you with a regitimate question quite soon :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...