Jump to content

Recommended Posts

Posted (edited)

#include
HotKeySet("{PAUSE}", "checkForImage")
HotKeySet("{DEL}", "Terminate")
global $y = 0, $x = 0
Func checkForImage()
while 1
mousemove(960,600,10)
Local $search = _ImageSearch('FEM.bmp', 1, $x, $y, 0)
I f $search = 1 Then
MouseMove($x, $y, 10)
sleep(2000)
EndIf

wend
EndFunc
while 1
sleep(200)
WEnd
Func Terminate()
while 1
sleep(200)
wend
EndFunc

I want to add to this code and make it so that If $search returns 0 it continually searches for the image every 33ms for the next 2 seconds (time of the sleep after image is found) without having to repeat the code 60 times. Any help is much appreciated

I looked into using TimerInit and TimmerDiff but couldn't get it to act quite as i wanted.

Edited by silly135
Posted

What do you mean by that? I'm pretty new to auto it and have been using working examples to structure my scripts so i don't understand some of the lingo.

Posted

#include
HotKeySet("{PAUSE}", "checkForImage")
HotKeySet("{DEL}", "Terminate")

// script starts here, you need to keep it alive else it will just exit.
global $y = 0, $x = 0

whilw 1
sleep(100)
wend

Func checkForImage()
while 1
mousemove(960,600,10)
Local $search = _ImageSearch('FEM.bmp', 1, $x, $y, 0)
I f $search = 1 Then
MouseMove($x, $y, 10)
sleep(2000)
EndIf

wend
EndFunc
while 1
sleep(200)
WEnd
Func Terminate()
while 1
sleep(200)
wend
EndFunc

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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