Jump to content

Pixelsearch not responding


Recommended Posts

Heres my code.

#region --- ScriptWriter generated code Start --- 
Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
SplashTextOn("","Starting D2 Insanity in 4...","250","40","100","100",5,"Courier New","10","700")
Sleep(1000)
SplashTextOn("","Starting D2 Insanity in 3...","250","40","100","100",5,"Courier New","10","700")
Sleep(1000)
SplashTextOn("","Starting D2 Insanity in 2...","250","40","100","100",5,"Courier New","10","700")
sleep(1000)
SplashTextOn("","Starting D2 Insanity in 1...","250","40","100","100",5,"Courier New","10","700")
Sleep(1000)
;Run($D2_Path & '\' & $D2_Executable & )
Run($D2_Path & '\' & $D2_Executable & ' ' & $D2_CmdParameters, $D2_Path)
If Not WinActive("Diablo II","") Then WinActivate("Diablo II","")
WinWaitActive("Diablo II","")
Sleep(1500)
Send("{Space}")
Sleep(500)
Send("{Space}")
Sleep(500)
Send("{Space}")
sleep(5100)
MouseMove(402,350)
MouseDown("left")
MouseUp("left")
sleep(5000)
$LoginTextcheck1 = PixelSearch( 510, 264, 538, 227, 0xC4C4C4)
If Not @error Then
;;do whatever you want it to do when it finds green here, my example will be to send a key
MouseClick("Left", $LoginTextcheck1[0],$LoginTextcheck1[1])
EndIf
sleep(15000)

Here are my coordinates

510, 264 Top left

538, 227 bottom right

Why isnt it clicking O.o :S

Edited by ecstatic
Link to comment
Share on other sites

how can it be the 227 is righter to 264?

$LoginTextcheck1 = PixelSearch( 443, 254, 585, 282, 0xC4C4C4)

If Not @error Then

;;do whatever you want it to do when it finds green here, my example will be to send a key

MouseClick("Left", $LoginTextcheck1[0],$LoginTextcheck1[1])

EndIf

sleep(15000)

Fixed but still not workin >.<

Link to comment
Share on other sites

OK it's getting closer :]

What exactly is not working? the mouse moves? the element isn't getting clicked? explanation please. and ;]

:D

ok

heres a pic of the location im trying to scan.

Posted Image

The color of the text, is C4C4C4

Im trying to search for the color of the text, so my bot will know when to login.

:S

My script will not select the text i made it scan for, so i assume the scanning is off.

Edited by ecstatic
Link to comment
Share on other sites

Take a screen shot, I suspect it's probably not the true color. Maybe it's also require to do pixelsearch relative to the window, try "Opt('PixelCoordMode', 0)" also.

I did a screenshot to get the color, which was C4C4C4 cause the Au3info was flipping out ingame.

I thought u told me to get rid of Opt('PixelCoordMode', 0)

Link to comment
Share on other sites

Nope, it was "MouseCoordMode". Anyway, if you get this rectangular dimensions from AutoIt Window Info then it matter if it's from the Mouse tab or Control tab. Try to get the rectangular dimensions relative to the window then you can use Opt with "MouseCoordMode" and "PixelCoordMode" set to be relative to the active window. Otherwise, you're mixing different values that are interpreted wrong, or at least not the way you want them to be interpreted.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...