Jump to content
Sign in to follow this  
Sardith

Correction Factor

Recommended Posts

Sardith

I have a few questions, on how to go about making a correction factor for a program I'm making.

Explanation:

I'm in the process of making a program that is -VERY- sensitive to the sleep amounts.

If the sleep is off by a little bit Ex. 5- 10ms, it can cause the program to not work successfully.

I wanted to know if there's some correction factor I could build into a custom sleep that would take the current CPU usage and take that into effect as a correction basis.. That way the sleeps wouldn't be off when the CPU usage went up, making the working environment -More- repeatable. Consistency is a big key.

Not sure if it's even possible with any coding language.. Not looking for the 'C++ is the answer'.

I'd like to keep it in AutoIt.

Any help would be great.


[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites
Sardith

Side thing.

Not sure.. but is this possible?

Sleep(10.5)

Can you have a fraction of a ms in the sleep? Or does it ignore that?


[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites
PsaltyDS

Lots of things affect execution time that have nothing to do with CPU usage, like disk I/O. Your better solution is to find a way to do the job without the sleeps. Like testing GUI controls for when they become enabled, and things like that.

What are you scripting? Why is the timing so critical?

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Sardith

It's for a game, and I cannot hook the funcations, or use GetcontrolID. It's a drag racing game, enough said. Time is important.

I don't see any other method other then sleeps.


[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites
Sardith

Can anyone lend some advice?


[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites
Siao

Advice on what? You didn't give any example which gives you trouble.

I don't understand how a Sleep can "be off"... Problem is not in Sleep. Problem may be that execution time of ANY AutoIt (or any other program) command varies depending on system it's run on. And that's a general problem, old hardware can't be as fast as high-end hardware, or else everyone would be playing F.E.A.R. on a P-133... And for that very reason generally you don't play games while running other resource-hungry processes in the background, regardless of your PC ability.

Anyway, you can try setting process priority to High or Realtime, if you're that worried about CPU loads, although this isn't remedy to all problems of course...

And why can't you use something like:

Do Sleep(1) Until $condition

instead of:

Sleep(10)

if you need to resume script exactly at some specific moment?

Edited by Siao

"be smart, drink your wine"

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  

×