jmoney Posted August 5, 2009 Share Posted August 5, 2009 Long time reader, first time poster. I want to write a script that will do the following: -When a pixel at a set position is color x, perform function x. If it is color y, perform function y. If it is color z, perform function z. -The function would either be to left click a certain point on the screen or press a certain button. Any help on a example script would really be appreciated. This is would be my first real script so I do not have a whole lot of code knowledge yet but I want to learn it >_< Link to comment Share on other sites More sharing options...
somdcomputerguy Posted August 5, 2009 Share Posted August 5, 2009 Code to do this could look like this $var = PixelGetColor( 120, 160 ) If $var = 0x000000 Then MouseClick("left", 20, 780) If $var = 0xFFFFFF Then MouseClick("left", 30, 790) Reading and Reading and Reading the docs, especially the 'Language Reference' section, is highly suggested. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Info Posted August 5, 2009 Share Posted August 5, 2009 snowmaker, why is your script working if the help file clearly says that PixelGetColor() returns a decimal value? It should be: $var = Hex(PixelGetColor( 120, 160 )) But it isn't... Link to comment Share on other sites More sharing options...
somdcomputerguy Posted August 5, 2009 Share Posted August 5, 2009 (edited) This works. I tried it before I posted it in another thread because I questioned the hex/dec thing myself. But I don't know why it does work. $var = PixelGetColor( 120, 160 ) ;$var is decimal value ;MsgBox(0,"The color is", $var) If $var = 0xc0c0c0 Then ;but matches with equiv hex value MouseClick("left", 20, 780) EndIf Edited August 5, 2009 by snowmaker - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Info Posted August 5, 2009 Share Posted August 5, 2009 I know it works, but why? Link to comment Share on other sites More sharing options...
jmoney Posted August 5, 2009 Author Share Posted August 5, 2009 So to do a key instead it would be then enter('key') ? Also how often does it scan for pixel changes? Could I put a delay on the scans? Thanks for the fast reply Link to comment Share on other sites More sharing options...
Info Posted August 5, 2009 Share Posted August 5, 2009 So to do a key instead it would be then enter('key') ? Also how often does it scan for pixel changes? Could I put a delay on the scans? Thanks for the fast reply Send("{Enter}") While 1 Sleep(1000) ;1 second delay $var = PixelGetColor( 120, 160 ) If $var = 0x000000 Then MouseClick("left", 20, 780) If $var = 0xFFFFFF Then MouseClick("left", 30, 790) WEnd 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