ddr4lyfe Posted February 4, 2008 Share Posted February 4, 2008 I've been at this thing for a few hours now and I just can't seem to get it right. What I want the script to do is scan a specific region (very small) for red (0xFF0000). And when that section is red, then click somewhere else on the screen. I need to do this with 4 different click locations. This is what I have so far: While 1 Global $pos, $var, $search HotKeySet ("s", "Start") HotKeySet ("o", "CursorPos") WEnd Func CursorPos() $pos = MouseGetPos() EndFunc Func Start() $search = PixelSearch (775, 785, 790, 790, 0xFF0000, 0, 2) If Not @error Then If Hex ($search, 6) = FF0000 Then MouseClick ("left", 655, 465, 1, 1) EndIf EndIf $search = PixelSearch (775, 785, 790, 790, 0xFF0000, 0, 2) If Not @error Then If Hex ($search, 6) = FF0000 Then MouseClick ("left", 745, 465, 1, 1) EndIf EndIf $search = PixelSearch (775, 785, 790, 790, 0xFF0000, 0, 2) If Not @error Then If Hex ($search, 6) = FF0000 Then MouseClick ("left", 835, 465, 1, 1) EndIf EndIf $search = PixelSearch (775, 785, 790, 790, 0xFF0000, 0, 2) If Not @error Then If Hex ($search, 6) = FF0000 Then MouseClick ("left", 925, 465, 1, 1) EndIf EndIf EndFunc What am I doing wrong? Thanks in advance Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted February 4, 2008 Share Posted February 4, 2008 I've been at this thing for a few hours now and I just can't seem to get it right. What I want the script to do is scan a specific region (very small) for red (0xFF0000). And when that section is red, then click somewhere else on the screen. I need to do this with 4 different click locations. This is what I have so far: While 1 Global $pos, $var, $search HotKeySet ("s", "Start") HotKeySet ("o", "CursorPos") WEnd Func CursorPos() $pos = MouseGetPos() EndFunc Func Start() $search = PixelSearch (775, 785, 790, 790, 0xFF0000, 0, 2) If Not @error Then If Hex ($search, 6) = FF0000 Then MouseClick ("left", 655, 465, 1, 1) EndIf EndIf $search = PixelSearch (775, 785, 790, 790, 0xFF0000, 0, 2) If Not @error Then If Hex ($search, 6) = FF0000 Then MouseClick ("left", 745, 465, 1, 1) EndIf EndIf $search = PixelSearch (775, 785, 790, 790, 0xFF0000, 0, 2) If Not @error Then If Hex ($search, 6) = FF0000 Then MouseClick ("left", 835, 465, 1, 1) EndIf EndIf $search = PixelSearch (775, 785, 790, 790, 0xFF0000, 0, 2) If Not @error Then If Hex ($search, 6) = FF0000 Then MouseClick ("left", 925, 465, 1, 1) EndIf EndIf EndFunc What am I doing wrong? Thanks in advance Put quotes around your hex value "FF0000" Link to comment Share on other sites More sharing options...
ddr4lyfe Posted February 4, 2008 Author Share Posted February 4, 2008 Alright, well I'm not getting any errors...but the script won't even click, lol? Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted February 4, 2008 Share Posted February 4, 2008 Alright, well I'm not getting any errors...but the script won't even click, lol?Are you sure the red your checking is EXACTLY FF0000? Link to comment Share on other sites More sharing options...
ddr4lyfe Posted February 4, 2008 Author Share Posted February 4, 2008 Yes, I've used the window information application and the PixelGetColor example in the Online Documentation to find the color. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted February 4, 2008 Share Posted February 4, 2008 Yes, I've used the window information application and the PixelGetColor example in the Online Documentation to find the color.You do know pixelsearch returns mouse coords not a decimal value. I recommend using PixelGetColor Link to comment Share on other sites More sharing options...
ddr4lyfe Posted February 4, 2008 Author Share Posted February 4, 2008 But I thought that PixelGetColor will click only at the location that it finds the specified color. How would I make the mouse click somewhere else? Link to comment Share on other sites More sharing options...
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