Jump to content

PixelSearch is Offset


Recommended Posts

Hello,

 

I'm pretty new to AutoIt, but I have avery strange Problem with the PixelSearch() Function

The code I have is:

$Coord = PixelSearch(0, 0, 1920, 1080, 0xFF0000)
MouseMove($Coord[0], $Coord[1], 0)

This should look for a Color (in this example red) on the whole screen and move the mouse to this position.

It seems that it's finding the red color, but always with a offset to the right and bottom.

 

So let's say the red Pixel is at 1000, 500 and PixelSearch returns 1200, 600. But it's not always off by a fixed value let's say 200 or 100. If the red Pixel is more to the right, the return of PixelSearch is even more to the right...

Hopfully you could understand my problem.

 

Thanks for the help :)

Link to comment
Share on other sites

  • Developers
5 minutes ago, OrangeTiger said:

Hopfully you could understand my problem.

not really. What are you actually trying to do?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

No kidding ...  That much I got from you initial post, but that doesn't really answer the question about what you are really asking as nothing is shown, so all you want us to do is guess?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

If you are trying to search your entire screen you might want to use what is within the software to calculate it instead of manually typing it, its more accurate and returns safer values.
 

$Coord = PixelSearch(0, 0, 1920, 1080, 0xFF0000)
MouseMove($Coord[0], $Coord[1], 0)

To

$Coord = PixelSearch (0, 0, @DesktopWidth, @DesktopHeight, 0xFF0000, 0) ; The last 0 there is the tolerance added, to make sure it finds red exactly.
MouseMove($Coord[0], $Coord[1], 0)

 

Link to comment
Share on other sites

You mean, what I want it for? Actually I don't really know yet. Maybe some aimbot, but I don't have any game for it in mind. I'm more interested in the "programming" part, not the "use" part. But I don't see why this is important for the question.

Ok, thanks for the tip with @DesktopWith, but it still gives me wrong values.

 

Link to comment
Share on other sites

  • Moderators

@OrangeTiger please ensure you make yourself familiar with our forum rules - especially the part on game automation - before you proceed any further. You will not receive any assistance on this subject.

Also, the old "No specific goal, just trying to learn" wears a bit thin. How are we to assist if you do not have a specific goal in mind that you want to accomplish?

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...