Zachlr Posted January 18, 2008 Share Posted January 18, 2008 I am trying to make a simple bot that beeps when a certain pixel changes color, such as watching a health bar to alert you when it is low. So far my code looks like this: $pos = MouseGetPos() $desired_color = PixelGetColor($pos[0], $pos[1]) ToolTip("Watching: "& $pos[0] & $pos[1], $pos[0], $pos[1], "Information", 1, 1) Sleep(5000) ToolTip("For the color: "& $desired_color, $pos[0], $pos[1], "Information", 1, 1) Sleep(5000) ToolTip("", $pos[0], $pos[1], "", 0, 1) While 1 $actual_color = PixelGetColor($pos[0], $pos[1]) If Not $actual_color = $desired_color Then Beep(400, 500) EndIf ToolTip("Color: "& $actual_color, $pos[0], $pos[1], "Information", 1, 1) ;(line 13) this line was added only to make sure the color value did in fact change Sleep(50) Wend What I can conclude is that it will only compare black vs not black. So say I put my cursor on a white explorer window, if I move the window so that the watched pixel is at a yellow icon, it will not beep. However, when I slide a black icon under the watched pixel, it will beep. It seems as though 0 is the only value not equal to any other color value, but I know it isn't by using line 13 of my script. I guess I could use pixel checksum, but I'd rather not unless I have to. And because as far as I can tell, there is no reason why this should not be working. I'm rather new to AutoIt3 scripting, so it could easily be something obvious. Thanks, Zach Link to comment Share on other sites More sharing options...
Richard Robertson Posted January 18, 2008 Share Posted January 18, 2008 Try using a message box to check the actual contents of the variables, so that you can see if they are even being picked up correctly. Link to comment Share on other sites More sharing options...
Zachlr Posted January 18, 2008 Author Share Posted January 18, 2008 Why would variables show up differently in a message box than in a tool tip? The variables are showing up correctly in both the message box and the tooltip. I tried it and it does the same thing both ways. 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