Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 17:11

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Auto it: Loop problem and delay issue.

Discussion on Auto it: Loop problem and delay issue. within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Aug 2011
Posts: 442
Received Thanks: 78
Auto it: Loop problem and delay issue.

Ok i will star tof by saying im a noob at this but have been playign with auto it on and off for the past week or so, mainly to see how much i could do and ive done abit code wise but loops always seem to confuse me, specially when im needing an array too.

Anyway i'll try and explain the best i can.
The code below is to search for an image, one the image is found it contines with more code, what i would like to do is make it so that "if" it does not find the image its looking for it checks for an alternative image example: "warehouse1.png|warehouse2.png|warehouse3.png" this is what i have so far but it will not loop though images in my tests.

Code:
$img = "t"
$FileList = _FileListToArray($path, "*.png", 1)

For $i = 1 to $FileList[0]
	$array = StringSplit($FileList[$i],"|")
	$image = $array[1]
	;ConsoleWrite($img & @CRLF)
	$img = _ImageSearchArea($image, 1, 0, 0, @Desktopheight, @DesktopWidth, $x, $y, 100)
	MsgBox(0,"",$image & @crlf & "coords are: " & $X & "," & $Y)
	MouseMove($x,$y)
	sleep(1000)
	;ConsoleWrite($img & @CRLF)
Next
Second lot im just confused with how i would do it so many someone can help. Basically i want the code to run to a certain point and then "search" for an image before proceeding further, so far though all i ahve had is the code running in a loop repeating actions:

Code:
Func DoInstance()
	logfile("Setting up instance")
	ConsoleWrite("Setting up instance")
	MouseClick ("left", 500 , 608)
	sleep(Random(1000,1500))
	MouseClick ("left", 490 , 660)
	sleep(Random(1000,1500))
	MouseClick ("left", 290 , 580)
	sleep(Random(1000,1500))
	MouseClick ("left", 700 , 440) 
	sleep(Random(1000,1500))
	logfile("Selecting fleets")
	ConsoleWrite("Setting up fleets")
	call("fleet")
	logfile("Starting instance")
	ConsoleWrite("Starting instance")
	MouseClick ("left", 700 , 380); OK
    sleep(Random(1000,1500))
	logfile("End of instance")
	ConsoleWrite("End of instance") ; <====== need the code to stop here and wait till image below is found before restarting the loop
	$img = _ImageSearchArea($pngLoc & "close.png", 1, 0, 0, @Desktopheight, @DesktopWidth, $x, $y, 100)
	If $img = True Then
		logfile("collecting mail")
		ConsoleWrite("collecting mail")
	call ("mail")
EndIf
Hope this amde sens and if not sorry :/
logical691 is offline  
Old 11/01/2012, 13:02   #2
 
Imaginär's Avatar
 
elite*gold: 255
Join Date: Nov 2009
Posts: 2,900
Received Thanks: 1,408
Why StringSplit($FileList[$i],"|")?
According to you should be able to just use $FileList[$i].

_ImageSearchArea() does not return a boolean on success. It's actually an array with x and y coordinates.
-> If IsArray($img) ...
--> X-Coord: $img[0] // Y-Coord: $img[1]

If you want to store the certain value of the array on another var, you better use $image = $array[$i], instead of $image = $array[1].
Imaginär is offline  
Old 11/02/2012, 04:14   #3
 
elite*gold: 0
Join Date: Aug 2011
Posts: 442
Received Thanks: 78
Thanks for the reply Imaginar, i used it because it was from code i saw if im honest. So thught it was needed if not then when i look at the script again i will remove it.

As for your other answer i'll have a play when i open up the script again. Like i said im new to all this and arrays, loops and what not confuse me lol i just want to cut the code down and improve it a little.

Thansk for your time and like i said soon a i get hance i'll play about =)
logical691 is offline  
Old 11/04/2012, 11:05   #4
 
elite*gold: 0
Join Date: Aug 2011
Posts: 442
Received Thanks: 78
Nope not getting anywhere :/

Code:
Global $x = 0
Global $y = 0
MsgBox(0,"","script started")

$path = "incs\"
$num = "2"

$FileList = _FileListToArray($path, "instance" & $num & "*.png", 1)

For $i = 1 to $FileList[0]
	$array = $FileList[$i]

	$img = _ImageSearchArea($array, 1, 0, 0, @Desktopheight, @DesktopWidth, $x, $y, 100)
	MsgBox(0,"",$array & @crlf & "coords are: " & $x & "," & $y) ; display files name no cords
sleep(1000)

	if IsArray ($FileList) Then
		msgbox (0,"","array stuff")
		MsgBox (0,"",$FileList[1])
		$img = _ImageSearchArea($FileList[1], 1, 0, 0, @Desktopheight, @DesktopWidth, $x, $y, 100)
		MsgBox(0,"",$FileList[1] & @crlf & "coords are: " & $FileList[2] & "," & $Y) ;$filelist[2] fails
	EndIf
logical691 is offline  
Reply


Similar Threads Similar Threads
-xImsexy Public D3D [-Auto Medic- | -Auto Ammo- | -No Delay- | ..
05/01/2011 - WarRock Hacks, Bots, Cheats & Exploits - 24 Replies
http://i52.tinypic.com/14myog7.png Hotkeys: Jump: STRG Moon: Space Medic: F5 Ammo: F6 Tele: F5/F6
SRO-db Bot Loop Issue
07/28/2010 - SRO Private Server - 10 Replies
Can someone clarify it please? What we are going do EXACTLY? I ask this again and again because it is not really clear.
[zszc] loop issue.
07/11/2010 - SRO Private Server - 2 Replies
hey guys atm im trying to bot at zszc. and it start looping going to storage and stuck. is there anyway to bypass it? i mean not even putting stuff inside the storage just keep going or i have to do it manually to take him to the spot? thanks in advance
Lag delay issue (SWSRO-Updated)
09/02/2009 - SRO Private Server - 27 Replies
Tell me guys if lags are still in SWSRO horrible as they were before updating client or NOT. :handsdown: I quit SWSRO only for delay reason, i will rather play AdventureQuest then on swsro with such lags :mad: Main question : The current situation of SWSRO server ? :pimp:



All times are GMT +1. The time now is 17:17.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.