ImageSearchArea

08/04/2013 22:03 deathletum#1
Alright im trying to search a certain area And cant seem to wrap my head around the code.

_ImageSearchArea("$vcl.bmp",$resultPosition,$x1,$y 1,$right,$bottom,ByRef $x, ByRef $y, $tolerance)


The place im trying to search is:

- Top Left corner : 298,211
- Bottom Right corner: 507, 279


but not sure how to write the bloody code and was hoping somebody could help me out.

the image.bmp name i use is vcl.bmp

thx for the help

not to sure how to do it hoping somebody could help me out

Hoping somebody can help im kinda stuck on this
08/05/2013 09:06 SwarN#2
Your Code:
Code:
_ImageSearchArea("$vcl.bmp",$resultPosition,$x1,$y 1,$right,$bottom,ByRef $x, ByRef $y, $tolerance)
$vcl.bmp <-------- this is your real name for the bmp in the script folder? so use ' @ScriptDir & "\vcl.bmp" '
$y 1 <----- no spaces !!!


try this line instead fo yours:

Code:
_ImageSearchArea(@ScriptDir & "\vcl.bmp",$resultPosition,$x1,$y1,$right,$bottom,ByRef $x, ByRef $y, 50)
08/05/2013 14:37 deathletum#3
Alright but what else do do i need to pit as code to make it work?

Do i have to set numbers for the variable $x1 ,$y1, $bottom , $right?

Im guessing i make it equal to my coords.

Also how do i have the code return a certain value if he finds the image and a other if he dosent. Like 1= true. And 0=false
08/05/2013 17:19 SwarN#4
Code:
Func _ClickPicture()
	$X = 0
	$Y = 0
	$bResult = _ImageSearchArea(@ScriptDir & "\vcl.bmp",1,298,211,507,279,$X, $Y, 40)
	If $bResult <> 0 Then
		_Click($X, $Y)
	EndIf
EndFunc
08/05/2013 17:33 deathletum#5
sick thx man ill give it a try.

Last question the " <> o " mean when false or when true.?

Ad how can i make it a infinite loop to check untill its true. I tried adding

While 1 and then finish up with Wend but that gave a error hehe

Also im trying to search for this in a game screen ao does x=0 and y=0 still apply? Or i need to do something special so it does not search on the desktop but on the actual game screen



Code:
#include<ImageSearch.au3>

#RequireAdmin
WinActivate("Ashen Empires")
WinWaitActive("Ashen Empires")
sleep(2000)


Func _ClickPicture()
	$X = 0
	$Y = 0
	$bResult = _ImageSearchArea(@ScriptDir & "\vcl.bmp",1,529,258,810,332,$X, $Y, 40)
	Sleep(1000)
	If $bResult <> 0 Then
		MouseMove(596, 452)
		sleep(1000)
		MouseClick("Left")
	EndIf
EndFunc
08/07/2013 19:08 deathletum#6
Anyone?
08/08/2013 11:15 SwarN#7
ImageSearch scans your current SCREEN, not only the desktop or only the game.

if result <> 0 your pictures was found by the function. If = 0 the picture are not found on your screen.
08/08/2013 17:12 deathletum#8
hmm weird ok. i was having it search on the desktop but never finds anything :P

guess ill try to mess around with it again even if i already lost 4hours trying lol