Jump to content

AutoItv3 and processes...


Recommended Posts

Recently for some odd reason, whenever the script is being ran, my framerate goes down significantly...I've noticed that it has to do with how it seems to think it needs to be running at a higher process than the program I'm running it with. SO what did i do? Well, I set it's process priority to 'Below Normal' and it worked out, but I have to do this every single time I run the script - so I'm curious what could be causing this and how could I fix this without doing it specifying 'Below Normal' each time...might I add this started just today and it never happened before today that's why I am curious as to what is going on so if you can give me some insight into this more if you know what I'm talking about please respond and thanks again. Also, I am running Windows XP and I know it's not a hardware issue.

Link to comment
Share on other sites

My guess is that the script is using 100% of the avaiable processor power, probably by a loop that is always running code (as opposed to using the Sleep() function somewhere in the loop.) Your solution of running the process at a lower priority level would give it less chance to run this constant code, thus speeding your game up.

I would look at any code that is being run inside a loop and drop a Sleep(100) (play with the number to see what works) in the loop.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

I know you didn't want the code I looked at publically avaiable, so what appears below is a conceptual illustration of the problem so that it may help others who are searching the forums with similar issues.

Your code used the following technique:

While 1;infinate loop
  If <TEST_NUMBER_1> Then
    Function_1()
  EndIf
  If <TEST_NUMBER_2> Then
    Function_2()
  EndIf
WEnd

Func Function_1()
  Sleep(2000)
;do stuff here as required
EndFunc

Func Function_2()
  Sleep(2000)
;do other stuff here as required
EndFunc

Although this example does pause inside each function, it will only pause if one, or both, of the conditional tests are true. If you wish to prevent this script from maxing out your CPU, you must put a sleep call in the main body of your loop, which in this case is your While loop. To do this, you may place a Sleep(100) line inside the While loop, but outside of any conditional code to make sure it is always executed. If required, you may lower or raise this number depending on the situation.

Minor edit

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

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...