rendered paste body;X: 250 Y: 92 X: 755 Y: 161
;X: 11 Y: 165 X: 791 Y: 669
;X: 801 Y: 521 X: 1010
;set coorsd relative to client window
Opt ( "CaretCoordMode" , 2 )
opt ( "MouseCoordMode" , 2 )
opt ( "PixelCoordMode" , 2 )
WinActivate( 'Guild Wars' )
Sleep( 1000 )
;configs
global $ScanStep = 30 ;scan each x pixels on each consecutive scans
global $ScanIncrement = 1 ;the increment to add to the starting value of scanning area each time the scan loop
;consts
global const $StartX1 = 250, $StartX2 = 11, $StartX3 = 801, _
$StartY1 = 52, $StartY2 = 125, $StartY3 = 481, _
$EndX1 = 755, $EndX2 = 791, $EndX3 = 1010, _
$EndY1 = 121, $EndY2 = 629, $EndY3 = 627
global const $ItemColor_White = 16777215, $ItemColor_Blue = 0x99EEFF ;item colors definition
scan()
func Scan()
local $foundX=0, $foundY=0
for $i = 0 to $ScanStep step $ScanIncrement ;loop scanning to try to find an item faster so we scan big area only at once
;first box
for $x = ($StartX1 + $i) to $EndX1 step $ScanStep
for $y = ($StartY1 + $i) to $EndY1 step $ScanStep
if PixelIsItem( $x, $y ) then
;MouseMove( $x, $y )
$foundX = $x
$foundY = $y
ExitLoop 3
;MsgBox(0,'', $x & ' ' & $y )
;return True
EndIf
Next
Next
;2nd box
for $x = ($StartX2 +$i) to $EndX2 step $ScanStep
for $y = ($StartY2 + $i) to $EndY2 step $ScanStep
if PixelIsItem( $x, $y ) then
;MouseMove( $x, $y )
$foundX = $x
$foundY = $y
ExitLoop 3
;MsgBox(0,'', $x & ' ' & $y )
;return True
EndIf
Next
Next
;3rd box
for $x = ($StartX3 +$i) to $EndX3 step $ScanStep
for $y = ($StartY3 + $i) to $EndY3 step $ScanStep
if PixelIsItem( $x, $y ) then
;MouseMove( $x, $y )
$foundX = $x
$foundY = $y
ExitLoop 3
;MsgBox(0,'', $x & ' ' & $y )
;return True
EndIf
Next
Next
Next
for $x = $foundX to $foundX + 15
if PixelGetColor( $x, $foundY ) <> $ItemColor_White then
;MsgBox(0,'', PixelGetColor( $x, $foundY ) )
ExitLoop
EndIf
Next
if $foundX > 0 then
MouseMove( $foundX, $foundY )
EndIf
;7231281
EndFunc
func tempscan( $x, $y)
$Item_XMax = 100 ; maximum x size of an item name (used to search)
$Item_YMax = 20 ; same as above
$PixelsMatched = 0
$Item_MinimumPixel = 10
local $ItemFound[3]
for $iX = $x - $Item_XMax / 2 to $x + $Item_XMax / 2
for $iY = $y - $Item_YMax / 2 to $y +$Item_YMax / 2
$currPixel = PixelGetColor( $iX , $iY )
if $currPixel == $ItemColor_White or $currPixel == $ItemColor_Blue Then
$PixelsMatched += 1
if $PixelsMatched == $Item_MinimumPixel Then
$ItemFound[0] = true
$ItemFound[1] = $x
$ItemFound[2] = $y
return true
EndIf
EndIf
Next
Next
return False
EndFunc
func PixelIsItem( $x, $y )
$Color = PixelGetColor( $x, $y )
local $fooColor = 0
Switch $Color
case $ItemColor_White
;MsgBox(0,'','FOUND')
$fooColor = $ItemColor_White
Case $ItemColor_Blue
;MsgBox(0,'','FOUND')
$fooColor = $ItemColor_Blue
case Else
return False
EndSwitch
if $fooColor == 0 then return false
;if ($x > 16) and ($x < 53) then
; if ($y > 644) and ($y < 685) Then
; return False ;we found the dialog box hahaha
; EndIf
;EndIf
;MsgBox(0,'', $x & ' ' & $y )
if tempscan($x, $y) then
return true
Else
MsgBox(0,'','did not find any item')
EndIf
EndFunc
func GetItemCode( $x, $y )
;find the left side of the item
local $Left, $Top, $Right, $Bottom
local $LastLeft, $LastTop, $LastRight, $LastBottom
EndFunc