Sign in to follow this  
Followers 0
bangbrosonline

PLEASE help me with this ImageSearchArea function

3 posts in this topic

#1 ·  Posted (edited)

i have been trying to get this to work for 2 days now ;)

It will execute and run, but it will not find the images that i am calling it for. All it does is go to the very top left corner (0, 0) of the window and repeat the function

all of the images are in the folder under "directory", the shading of them is possibly a little dull which i can easily change, but they are there and are cropped with a 0x000000 background.

this is the script i am using

Opt('MouseCoordMode', 0)
Opt('PixelCoordMode', 0)
HotKeySet('{END}', 'Quit')
HotKeySet('{SPACE}', 'Pause')
#include <ImageSearch.au3>
Global $Paused
Global $Picked = False
Global $DebugOn = True
;ImageSearch Looting Variables
$ImgLoot = True ; set this to true if you want to use ImageSearch looting system. False will revert to old PixelSearch method
$directory = "C:UsersTimDocumentsDiablo IIIimg" ; CHANGE THIS! Point it to the directory with the imagesearch pngs
$totalItems = 16 ; This needs to match the number of pngs you are loading
Global $pick[$totalItems], $size = WinGetClientSize("Diablo III"), $default_resolutionX = 800, $default_resolutionY = 600, $go = True, $Leave = False, $Dead = False, $Logout = False, $Window = False, $i = 0, $currentArrayItem = 0, $gX = 0, $gY = 0
If $size[1] <> 800 Then $size[1]-=30 ;adjusts ratio for titlebar if not default resolution. Comment if you are NOT running windowed but also not 1080 height
$pick[0] = "FlawlessSquare.png|110"
$pick[1] = "legendaryA.png|20"
$pick[2] = "legendaryE.png|20"
$pick[3] = "legendaryI.png|10"
$pick[4] = "legendaryO.png|20"
$pick[5] = "legendaryU.png|20"
$pick[6] = "setA.png|30"
$pick[7] = "setE.png|30"
$pick[8] = "setU.png|30"
$pick[9] = "setO.png|30"
$pick[10] = "setI.png|30"
$pick[11] = "rareA.png|20" ; comment/delete these and adjust $totalItems to disable rare looting
$pick[12] = "rareE.png|20"
$pick[13] = "rareI.png|20"
$pick[14] = "rareO.png|20"
$pick[15] = "rareU.png|20" ; end comment
Pause()
While 1
   Call("pickItems")
    Sleep(1000)
WEnd
Func pickItems()
$currentArrayItem = 0
For $gI = 0 to ($totalItems - 1)
   $array = StringSplit($pick[$gI],"|")
   $file = $array[1]
   $accuracy = $array[2]
   $urlString = $directory & $file
   DEBUG("searching")
   $target = _ImageSearchArea($urlString,0,160,130,700,500,$gX,$gY,$accuracy)
      While $i <= 12 ; max: 13 gems and pieces of gear to loot
   DEBUG("not working")
          If Not @error Then
            DEBUG("FoundStuff")
                 ;MsgBox(4096,"Debug",$urlString & " " & $gX & "-" & $gY)
     DEBUG("Click")
                 MouseClick("left", $gX, $gY, 1, 0)
     DEBUG("stuck")
                 Sleep(Random(1200,1400))
                 MouseMove(14,14,0) ;Reset cursor position, it doesn't need to hover
                 Sleep(1000)
             DEBUG("FoundMore")
    Sleep(1000)
                 $target = _ImageSearchArea($urlString,0,160,130,700,500,$gX,$gY,$accuracy)
     $i+= 1
     DEBUG("Done")
     Sleep(1000)
          Else
                 ExitLoop
             DEBUG("Fuck You")
          EndIf
WEnd
Next
EndFunc
Func Pause()
   $Paused = Not $Paused
   While $Paused
      Sleep(100)
      ToolTip('Paused...', 0, 0)
   WEnd
   ToolTip("")
EndFunc   ;==>Pause
Func DEBUG($MESSAGE)
   If $DebugOn Then
      ToolTip($MESSAGE, 0, 0)
   EndIf
EndFunc   ;==>Debug Info
Func Quit()
   Exit
EndFunc   ;==>Quit

thank you SO much for any help. i am about to pull my hair out with this

Edited by bangbrosonline

Share this post


Link to post
Share on other sites



alrighty then

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0