Sign in to follow this  
Followers 0
lammaer25

PixelGetColor - how robust is it?

3 posts in this topic

#1 ·  Posted (edited)

Hi guys,

I'm a rather new guy with autoit with a good programmig experience in other languages.

I like Autoit so much, it is easy, and have lot of possibilities.

BUT:

I've created a simple script for a game, to constantly (in 1 minute intervals) check a pixel on the screen and if a given color appears there, then execute a couple keystrokes.

In 90% of the cases it is working well.. but there is a 10% of cases, when the getpixelcolor returns completely weird information (ive doublechecked the color of the given pixel from a screenshot, and it is not what getpixelcolor returned), and only the 3-4-5 th trial returns the correct color value. Of course, during these trials nothing happens on the screen...

So the question: have anyone noticed such behavior? If so, if there any way to fix/workaround it?

Can it casuse problem that Im trying autoit to control a DirectX game?

EDIT: meanwhile I've found lot of post about this stuff... so sorry for the hasty posting....

Edited by lammaer25

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If the window loses focus it could cause an issue. Do this when your testing... Open AutoInfo.exe .... Under each of the pixel searches put MouseMove(same x coord as pixel get color, same y coord as pixelgetcolor), and hit Ctrl+Alt+F so you can see that area enlarged and the actual color on the AutoInfo tool (I always keep it up top but not active).

This is how I debug alot of my own stuff, but I find often it was forgetting to do something specific in my code.

Edit:

Also make sure you use the same MouseCoordMode that your using the PixelCoordMode with.

Edited by SmOke_N

[center]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.[/center]

Share this post


Link to post
Share on other sites

Thanks for the advice... Im going to inspect the script as you described.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0