arkane Posted January 9, 2010 Share Posted January 9, 2010 (edited) Hi mates ! First, sorry for my bad english... Okay, my bot is now over and working fine on my computer. But I noticed it wasn't reacting the same way depending of what computer runs it. Keypresses doesn't always last the same time. Here is one exemple : I've a Function like this : Func _sleep($sleeptime) $timer = TimerInit() while TimerDiff($timer) < $sleeptime sleep(10) wend Return 0 EndFunc And I do for exemple : Func ChercherBalle() Send("{s down}{q down}") if _Sleep(3000) = 1 then Return Send("{s up}{q up}") if _Sleep(30) = 1 then Return Send("{z down}{d down}") if _Sleep(1950) = 1 then Return Send("{z up}{d up}") if _Sleep(30) = 1 then Return Send("{z down}") if _Sleep(30) = 1 then Return Send("{z up}") if _Sleep(30) = 1 then Return Send("{z down}") if _Sleep(7700) = 1 then Return Send("{z up}") EndFunc Which works great, I mean, this is the perfect timing for my computer, but not for every computers. Do you have any idea about how I can make it a lot more accurate, so it'll work the same for everybody ? Thanks in advance for your advices ! Someone said me : You should base the movement of the character on the time elapsed, not the other way around (we did this in the 1980s and it sucked ). Isn't it what I'm doing ? Edited January 9, 2010 by arkane Link to comment Share on other sites More sharing options...
gte Posted January 9, 2010 Share Posted January 9, 2010 Can you use do until's and have certain windows (or other items) end the until portion? I don't know what your bot does, but this is what I do with some of my scripts when processor speed seems to vary the timing of things HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
arkane Posted January 9, 2010 Author Share Posted January 9, 2010 My bot mostly do key presses, to move from an A point to a Z point. I can try to use do/until and use pixel detection, but it will be very hard. But I have a few ideas. Thanks for your advice. I hope there is an another solution ? Link to comment Share on other sites More sharing options...
gte Posted January 9, 2010 Share Posted January 9, 2010 I use do/until for window detection and it works perfect. I use the consolewrite() command inside of the do/until function for testing as well, it helps you see exactly when the program recognizes something, because it stops writing to the console at that momentMy bot mostly do key presses, to move from an A point to a Z point.I can try to use do/until and use pixel detection, but it will be very hard. But I have a few ideas.Thanks for your advice. I hope there is an another solution ? HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
arkane Posted January 10, 2010 Author Share Posted January 10, 2010 Thanks for your interest. So you think I should only use pixel detection ? The fact is, I don't understand when you say "Windows detection". Link to comment Share on other sites More sharing options...
Xand3r Posted January 11, 2010 Share Posted January 11, 2010 try Opt("SendKeyDelay" , 0) Opt("SendKeyDownDelay" , 0) Func _sleep($sleeptime) $timer = TimerInit() while TimerDiff($timer) < $sleeptime sleep(0) wend Return 0 EndFunc that way you eliminate the things that might be slower on some pc's (sleep is not very accurate) and with the Opt keys are sent instantaneously Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro Link to comment Share on other sites More sharing options...
arkane Posted January 11, 2010 Author Share Posted January 11, 2010 Okay, but is sleep(0) useful ? Link to comment Share on other sites More sharing options...
arkane Posted January 12, 2010 Author Share Posted January 12, 2010 The behaviour is a lot better like this. there is still a small difference, but it's already very good. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now