Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
scan function in wait command
#1
Im still creating a macro for a game here.
The game can be run in windowed mode as well as fullscreen.
Thats why i created my code to use client area for scans, so it works in both modes.
All commands that accept this mode like mou/lef/rig/pixel all work, but.....

When you use the scan functionality in the wait command i get a RT error about window not found when i use flag 16, while the application is in fullscreen.
When its in windowed mode no error is generated and all works fine.

Here is the piece of code:
The 1st line generates the error mentioned.
While the 2nd works. (Only for fullscreen ofcourse)
Code:
Copy      Help
bFound = wait(Application.IR.dTimeout, S, IR.filename, Application.sClientWindowClass, IR.r, iScanFlags)
bFound = wait(Application.IR.dTimeout, S, IR.filename, Application.sClientWindowClass, IR.r, iScanFlags ^ 16)

So i think there is a small bug in that functionality...

Complete function code im using:
Code:
Copy      Help
/
*******************************************
    FindImage v1.0
*******************************************
This is a macro to find images in screen.
*******************************************
function# tIR&IR [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-
bFound = wait(Application.IR.dTimeout, S, IR.filename, Application.sClientWindowClass, IR.r, iScanFlags)
bFound = wait(Application.IR.dTimeout, S, IR.filename, Application.sClientWindowClass, IR.r, iScanFlags^16)
err+
    out "%s[]%s" IR.filename, Application.sClientWindowClass
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)