Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scan cant find image
#4
Just to ease your mind here is my function:
Code:
Copy      Help
;*******************************************
;,FindImage v1.0
;*******************************************
;This is a macro to find images in screen.
;*******************************************

function# tIR&IR [int'bWait] [int'bCenterMouse] [int'bTransparent] [int'bDebug]
int bFound, iScanFlags
POINT-- pCurMousePos

iScanFlags = 16
if(bCenterMouse)
,iScanFlags | 1
if(bTransparent)
,iScanFlags | 4
;Fill rectangle with search area.
IR.r = Application.IR.Search

;Save curpos
xm(pCurMousePos, Application.sClientWindowClass, 1)
;Move mouse at skill buton "S", to not obstruct IR
mou 432 576 Application.sClientWindowClass 1
;wait Application.dMousePosDelay
;Find the image

err-
if(bWait)
,bFound = wait(Application.IR.dTimeout, S, IR.filename, Application.sClientWindowClass, IR.r, iScanFlags)
else
,bFound = scan(IR.filename, Application.sClientWindowClass, IR.r, iScanFlags)
err+
,;end _error 1

if(!bCenterMouse)
,;Move mouse back to saved pos
,mou pCurMousePos.x pCurMousePos.y Application.sClientWindowClass 1
,wait Application.dMousePosDelay

if(bDebug)
,out "Search: left=%i, top=%i, right=%i, bottom=%i", Application.IR.Search.left, Application.IR.Search.top, Application.IR.Search.right, Application.IR.Search.bottom
,out "Button: file=''%s'', left=%i, top=%i, right=%i, bottom=%i", IR.filename IR.r.left, IR.r.top, IR.r.right, IR.r.bottom
,out "Found: %i", bFound

ret bFound
Well thats all for now, 3M


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)