i know there hasn't been a relevant post for a couple months so dunno if theri plans on adding more or updating but because of how useful the code has been felt like sharing a snippet for the full core.au3 i use you can get it in the latest fossil restoration.
Quote:
;================================================= ==========
Func _mobSearch()
local $mouseorigin = MouseGetPos()
$quantity = 0
_setSearchCoords("fullscreen")
Send("{ALTDOWN}")
_mover()
Local $imagefile
$result = 0
For $quantity = 1 To $MOBLISTING[0][0] Step 1
If $MOBLISTING[$quantity][1] = 1 Then
$file=_FileListToArray(@ScriptDir & "\Images\mob\", $MOBLISTING[$quantity][0] & "*.bmp", 1)
if not @error then
for $i =1 to $file[0]
$result = _ImageSearchArea(@ScriptDir & "\Images\mob\" & $file[$i],1,$searchbox[0],$searchbox[1],$searchbox[2],$searchbox[3],$x1,$y1,30)
sleep(100)
If $result = 1 Then
_target($x1,$y1)
Mousemove($mouseorigin[0],$mouseorigin[1],1)
Send("{ALTUP}")
Return 1
EndIf
next
endif
Else
$result = _ImageSearchArea(@ScriptDir & "\Images\mob\" & $MOBLISTING[$quantity][1],1,$searchbox[0],$searchbox[1],$searchbox[2],$searchbox[3],$x1,$y1,30)
sleep(100)
If $result = 1 Then
_target($x1,$y1)
Mousemove($mouseorigin[0],$mouseorigin[1],1)
Send("{ALTUP}")
Return 1
EndIf
EndIf
EndIf
Next
sleep(100)
Send("{ALTUP}")
Mousemove($mouseorigin[0],$mouseorigin[1],1)
Return 0
EndFunc
;================================================= ==========
Func _mover()
sleep(250)
Local $center[2]
$randomnumber = Random(50,150,1)
$center[0] = ($topleftcorner[0] + (($bottomrightcorner[0] - $topleftcorner[0])/2)) + $randomnumber- 100
$center[1] = ($topleftcorner[1] + (($bottomrightcorner[1] - $topleftcorner[1])/2)) + $randomnumber
MouseClickdrag("right",$center[0]-$randomnumber,$center[1],$center[0]+$randomnumber,$center[1],10)
sleep(500)
mouseup("right")
EndFunc
|
this can be applied to _findItems() as well and makes it scalable so you can do image searches of gold.bmp gold1.bmp gold2.bmp and so on without adding gold1=1, gold2=1 in config.ini and just keep the one gold=1
although i don't see a reason for gold to change so you wouldn't need more then one but other items do and other functions would need multiple images due to color interface or mods so this was a critical need imo and i have already applied it to a majority of the functions
other functions and global variables needed for this are $MOBLISTING,$searchbox,$x1,$y1,$topleftcorner,$bot tomrightcorner _setSearchCoords _FileListToArray _ImageSearchArea _target and can be found in fossil restoration 10.2