Hamminnamm

Noob need help with script

2 posts in this topic

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

 

 

Share this post


Link to post
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 :)

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.