steelys Posted September 11, 2005 Posted September 11, 2005 I tried using PixelGetColor but the results were 0 and i guess the game disables pixel color grabbing thingy. So is there anyway i can get the true color of the pixel ?
peethebee Posted September 11, 2005 Posted September 11, 2005 (edited) Hi!From the help file:Return ValueSuccess: Returns decimal value of pixel's color. Failure: Returns -1 if invalid coordinates....$var = PixelGetColor( 10 , 100 )MsgBox(0,"The decmial color is", $var)MsgBox(0,"The hex color is", Hex($var, 6))The return values 1 and 0 indicate black and white pixels.Good luck with further scripting, peethebee Edited September 11, 2005 by peethebee vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
steelys Posted September 11, 2005 Author Posted September 11, 2005 Yeah, but the problem is the pixel color is clearly not black/white, its some other. I guess the game could have some protection that makes all pixel grabbing programs to think that its a black/white pixel.
peethebee Posted September 11, 2005 Posted September 11, 2005 Hi! I can rarely imagine this. Could you please post your code aroun this function call and a jpeg screenshot i possible? Thank you, peethebee vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
steelys Posted September 11, 2005 Author Posted September 11, 2005 My code is $pos = MouseGetPos() $color = PixelGetColor ( $pos[0] , $pos[1] ) Msgbox( 1, "Test", $color )
LxP Posted September 11, 2005 Posted September 11, 2005 (edited) You are very likely checking the colour of the tip of your mouse pointer. Does this work for you? --Edit: It seems that this mouse-moving procedure is only really needed if you're in some form of game where the mouse pointer is custom-drawn. PixelGetColor() doesn't seem to notice the cursor when dealing with ordinary Windows.local $pos = mouseGetPos() mouseMove($pos[0] + 1, $pos[1] + 1) local $color = pixelGetColor($pos[0] , $pos[1]) mouseMove($pos[0], $pos[1]) Msgbox(0x40, "Colour at Cursor", $color) Edited September 11, 2005 by LxP
peethebee Posted September 11, 2005 Posted September 11, 2005 (edited) Hi! What would this line (instead of your debug line) produce: MsgBox(0,"The hex color is", Hex($color, 6)) ? Edit: very nice idea of LxP. Please test his solution first. peethebee p.s. no screenshot possible? Edited September 11, 2005 by peethebee vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
steelys Posted September 11, 2005 Author Posted September 11, 2005 (edited) Thanks alot for all of your reply. I really appreciate it. I tried LxP code and it work ! Thanks alot dude ! and not forgetting peethebee Thanks both of you ! EDIT: i tried it and it gave me the true pixel color, but if i run the program twice with the code below local $pos = mouseGetPos() mouseMove(515, 133) sleep(1000) local $color = pixelGetColor($pos[0] , $pos[1]) Msgbox(0x40, "Colour at Cursor", $color) It gave me 2 different color *answer*. Everytime i run it, it would give me a different color. How do i go about solving that ? Thanks once again Edited September 11, 2005 by steelys
peethebee Posted September 11, 2005 Posted September 11, 2005 Hi! It is depending on the MousePos and if you position it by hand, you cannot (or almost not) be pover the same pixel... peethebee vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
LxP Posted September 11, 2005 Posted September 11, 2005 Another thought: games often use antialiasing which results in subtle variations of colours at any one time. 3D games are particularly hard to process (although not impossible) because there are always different shades of the colour in question.You may want to consider PixelSearch() with a 1x1 search rectangle as a solution as you will be able to specify an acceptable shade variation.
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