GodsPain Posted October 2, 2016 Posted October 2, 2016 So im very new to scripting as well as autoit, so far im getting a basics down but what im trying to do is if BOTH Functions fail to find image is there a way to have it sleep or go to a sleep line? I know theres no GOTO in Au3 so im a little lost This is the 2ed script ive actually made im still trying to figure everything out Quote #include <Imagesearch.au3> HotKeySet("{ESC}", "Terminate") $mins = 5 ;press every 5 mins $pressed = 0 global $y = 0, $x = 0 $L = 0 $T = 66 $B = 983 $R = 1279 While 1 ;5min Timer?? $nowmin = @MIN if $nowmin = 0 then $nowmin = 60 if mod($nowmin,$mins) = 0 and $pressed = 0 Then Send("{F5}") $pressed = 1 Sleep(10000) Elseif mod($nowmin,$mins) <> 0 and $pressed = 1 then $pressed = 0 EndIf WinActivate("Tribal") MouseClick("Left", 410,940);Click Report Sleep(750) Howell() Sleep(500) Freehold() WEnd Func Howell();HOWELL $V1report = _ImageSearchArea("Images/V1report.png",1,$L,$T,$B,$R, $x, $y, 50) If $V1report = 1 Then MouseMove( $x, $y,10) MouseClick("Left",$x,$y) $V1 = _ImageSearchArea("Images/V1.png",1,$L,$T,$B,$R, $x, $y, 50) If $V1 = 0 Then MouseClick("Left", 451, 85) EndIf MouseClick("Left", 562,860);Atk Again Sleep(500) $AtkCon = _ImageSearchArea("Images/Atkcon.png",1,$L,$T,$B,$R, $x, $y, 50) If $Atkcon = 1 Then MouseClick("Left",$x,$y) Sleep(500) EndIf MouseClick("Left", 657, 860) EndIf EndFunc Func Freehold();Freehold $V1report = _ImageSearchArea("Images/V2report.png",1,$L,$T,$B,$R, $x, $y, 35) If $V1report = 1 Then MouseMove( $x, $y,10) MouseClick("Left",$x,$y) $V1 = _ImageSearchArea("Images/V2.png",1,$L,$T,$B,$R, $x, $y, 50) If $V1 = 0 Then MouseClick("Left", 451, 85) EndIf MouseClick("Left", 562,860);Atk Again Sleep(500) $AtkCon = _ImageSearchArea("Images/Atkcon.png",1,$L,$T,$B,$R, $x, $y, 50) If $Atkcon = 1 Then MouseClick("Left",$x,$y) Sleep(500) EndIf MouseClick("Left", 657, 860) EndIf EndFunc Func Terminate() MsgBox(0,"Exiting", "Bot is Quitting") Exit EndFunc Expand
Anoop Posted October 2, 2016 Posted October 2, 2016 (edited) Create function and call it. https://www.autoitscript.com/autoit3/docs/keywords/Func.htm Edited October 2, 2016 by Anoop
GodsPain Posted October 2, 2016 Author Posted October 2, 2016 On 10/2/2016 at 4:16 PM, Anoop said: Create function and call it. Expand would i put the call at the end of the first image if it fails to call the 2ed pic and if that fails then call a sleep function?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now