j0sh Posted April 15, 2006 Posted April 15, 2006 Here's the situation, I want to mouseover something, and if the pixel = certain color, then left click... I'm kind of confused with this one, cause it won't be using exact coordinates. If PixelGetColor = 0x7c7470 Then Endif Something to do with that I think, hah... thanks for all the replies I get.
Moderators SmOke_N Posted April 15, 2006 Moderators Posted April 15, 2006 (edited) Try this... not really tested :Opt('PixelCoordMode', 2) Opt('MouseCoordMode', 2) Global $Mpos = '', $Color = 0x0000FF;(Blue) While 1 $Mpos = MouseGetPos() If IsArray($Mpos) Then $PixColor = PixelGetColor($Mpos[0], $Mpos[1]) If ($PixColor == $Color) Then MsgBox(0, 'Color Found', 'X: ' & $Mpos[0] & ' Y: ' & $Mpos[1]) EndIf ToolTip('Xcoord = ' & $Mpos[0] & @CR & 'Ycoord = ' & $Mpos[1] & @CR & 'Color = ' & '0x' & Hex($PixColor, 6)) EndIf Sleep(10) WEnd Edited April 15, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Thatsgreat2345 Posted April 15, 2006 Posted April 15, 2006 (edited) just to help u if your color is what u posted above then it would be HotKeySet("{esc}","close") Opt('PixelCoordMode', 2) Opt('MouseCoordMode', 2) Global $Mpos = '', $Color = 0x7c7470;(Blue) While 1 $Mpos = MouseGetPos() If IsArray($Mpos) Then $PixColor = PixelGetColor($Mpos[0], $Mpos[1]) If ($PixColor == $Color) Then MsgBox(0, 'Color Found', 'X: ' & $Mpos[0] & ' Y: ' & $Mpos[1]) EndIf ToolTip('Xcoord = ' & $Mpos[0] & @CR & 'Ycoord = ' & $Mpos[1] & @CR & 'Color = ' & '0x' & Hex($PixColor, 6)) EndIf Sleep(10) WEnd func close() Exit EndFunc Edited April 15, 2006 by thatsgreat2345
Moderators SmOke_N Posted April 15, 2006 Moderators Posted April 15, 2006 just to help u if your color is what u posted above then it would be HotKeySet("{esc}","close") Opt('PixelCoordMode', 2) Opt('MouseCoordMode', 2) Global $Mpos = '', $Color = 0x7c7470;(Blue) While 1 $Mpos = MouseGetPos() If IsArray($Mpos) Then $PixColor = PixelGetColor($Mpos[0], $Mpos[1]) If ($PixColor == $Color) Then MsgBox(0, 'Color Found', 'X: ' & $Mpos[0] & ' Y: ' & $Mpos[1]) EndIf ToolTip('Xcoord = ' & $Mpos[0] & @CR & 'Ycoord = ' & $Mpos[1] & @CR & 'Color = ' & '0x' & Hex($PixColor, 6)) EndIf Sleep(10) WEnd func close() Exit EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
greenmachine Posted April 15, 2006 Posted April 15, 2006 I'm going to take a wild guess here. He's working with Diablo II. The reason I say this is because Diablo II has its own cursor that replaces a normal cursor and is a general gray color. That way, when you use Au3Info.exe and get the pixel color of the mouse, you're getting gray. 0x7c7470 is not blue, it's gray. Solution - use 10 pixels up and 10 pixels left of the current position.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now