Jump to content

Pixel Functions Lagging


Recommended Posts

There really isn't much code to show (because you'd need to have my exact same set up and everything), but basically here's what happening:

I am clicking a button on my screen, waiting for a pixel to appear (it appears anywhere from 5-50ms - it loops my script until that pixel appears), then search for another pixel on a different part of the screen right after the previous one was found. On my best computer (my main one), all works well and dandy and it finds that second pixel and clicks it. However, I have tested on TWO completely different computers and also a Virtual Machine on this main computer and they bug out like so:

After that first pixel is found, I made an environment where that second pixel is always there as well. Well, with the bugged ones, it never even notices that second pixel - and repeats my process and clicks that first button and looks for that first pixel yet again. So, to debug my theory of the title of this thread, I made a While loop to search for that second pixel (on the bugged computers) and it basically searched for it and Sleep(30). I TimerDiff'ed the results after it finally found that second pixel and it was a whopping 200-300 milliseconds before it noticed that second pixel on my screen (I could see it on my monitor way before it ever saw it) ! -- tested this loop on my main computer and it was a mere 10-50ms, which is ideal.

So my question would be:

What would be causing the major lag between finding that second pixel? (P.S. - I am searching on ONE coordinate - not my whole screen or anything... I also did PixelGetColor, same result)

I want to note that a friend of mine made the exact same program, only his was in AutoHotKey. His works flawlessly on all, and any, of my machines. The ONLY difference I saw in his code was that he was using the ImageSearch function for the "first pixel" in my scenario. So the only probable theory I could come up with is that the Pixel Functions are overlapping somehow and causing strain/lag? (I really have no idea :/). I would be able to accept that it is just performance issues between the computers (because my other ones are significantly less qualified than my main one), but beings my friend made it the exact same way, I cannot possibly go with that reason of thinking.

Thanks, I hope someone can take the time to read my rant and provide some insight :(.

Edited by UnknownWarrior
Link to comment
Share on other sites

I did read about that also through some searches, but didn't really try it until you mentioned it again (remember, I've been working on this for 7 hours straight so I've forgotten a few things lol).

I basically added in another pixel search of an item on screen to make sure it waits until that 'second phase' is ready, and also disabled Aero. So far it's looking alright *fingers crossed*. It's such a suicidal moment when you work on something for SO long, and instead of getting it to work - it DOESN'T! I don't mind spending the amount of time fixing a bug, as long as it gets fixed :(.

Link to comment
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
 Share

  • Recently Browsing   0 members

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