aznkid Posted June 15, 2007 Share Posted June 15, 2007 I'm currently new to autoit and scripting. I've looked around the forums to see if I can find a solution to my problem, but I don't really understand what people posted. Im trying to make a bot for a game, pressing C, F5 through F8 then F1 for X Minutes. I've managed to make: Sleep(5000) While 1=1 Send("C") Sleep(7500) Send("{F5}") Sleep(1200) Send("{F6}") Sleep(1200) Send("{F7}") Sleep(1200) Send("{F8}") Sleep(1200) Do $start = TimerInit() Send("{F1}") Until TimerDiff($start) = 300000 Wend This works, but the problem is that after it starts to hit F1, it doesn't repeat itself. Any solution would be helpful. Thanks in advanced. Link to comment Share on other sites More sharing options...
Gif Posted June 15, 2007 Share Posted June 15, 2007 (edited) I'm currently new to autoit and scripting. I've looked around the forums to see if I can find a solution to my problem, but I don't really understand what people posted. Im trying to make a bot for a game, pressing C, F5 through F8 then F1 for X Minutes. I've managed to make: Sleep(5000) While 1 Send("C") Sleep(7500) Send("{F5}") Sleep(1200) Send("{F6}") Sleep(1200) Send("{F7}") Sleep(1200) Send("{F8}") Sleep(1200) Do $start = TimerInit() Send("{F1}") Until TimerDiff($start) = WendoÝ÷ Ù8b³ +Æî¶Ø^¦ºé¢²ØZµ§íz¸²Ö«¶Ëh+EÖ+]¡ë'ßÛkz¶+lzWÀ+(ëb¢|(ºW[z¥¥û¥N§È§iÛÚÇþ«¨µè)䶬(!· +«¢+Ø9½QÉå%½¸()!½Ñ-åMÐ ÅÕ½ÐíyÌÅÕ½Ðì°ÅÕ½Ðí}ÍÑÉÐÅÕ½Ðì¤)!½Ñ-åMÐ ÅÕ½ÐíyÅÕ½Ðì°ÅÕ½Ðí}á¥ÐÅÕ½Ðì¤()]¡¥±Ä)ͱÀ ÄÀ¤)]¹()Õ¹}ÍÑÉÐ ¤)M±À ÔÀÀÀ¤)M¹ ÅÕ½ÐíÅÕ½Ðì¤)M±À ÜÔÀÀ¤)M¹ ÅÕ½ÐííÕôÅÕ½Ðì¤)M±À ÄÈÀÀ¤)M¹ ÅÕ½ÐííÙôÅÕ½Ðì¤)M±À ÄÈÀÀ¤)M¹ ÅÕ½ÐííÝôÅÕ½Ðì¤)M±À ÄÈÀÀ¤)M¹ ÅÕ½ÐííáôÅÕ½Ðì¤)M±À ÄÈÀÀ¤(ÀÌØí¤ôÀ)¼(M¹ ÅÕ½ÐííÅôÅÕ½Ðì¤(ÀÌØí¤ôÀÌØí¤¬Ä)U¹Ñ¥°ÀÌØí¤ôÌÀÀÀ)¹Õ¹()Õ¹}á¥Ð ¤)á¥Ð)¹Õ¹ didnt quite understood what you meant pressing it for X minutes, you mean keeping it pressed or pressing F1 every X minutes? EDIT: added some things, to make it more friendly EDIT2: Welcome to AutoIt! Edited June 15, 2007 by c4nm7 Link to comment Share on other sites More sharing options...
aznkid Posted June 15, 2007 Author Share Posted June 15, 2007 Ah Thanks for the welcome and the script. =D It works fine, however, is there a way to make the script press "F1" constantly for an amount of time rather then looping for an [#] amount of times (thats what I meant by "F1 for X Minutes", sorry I wasn't clear), then reloop the whole thing? I was thinking of adding a code to press the hotkey to start again, but not sure where to place it. Link to comment Share on other sites More sharing options...
fu2m8 Posted June 15, 2007 Share Posted June 15, 2007 Check out TimerInit and TimerDiff in the Helpfile. Pretty sure thats what your after. The following example just moves the mouse back and forth for 5 seconds. $begin = TimerInit() $timeToDoIt = 5000 ;time in Milliseconds to run for Do ;actions to do MouseMove(50, 100, 5) MouseMove(500, 100, 5) $dif = TimerDiff($begin) Until $dif >= $timeToDoIt Link to comment Share on other sites More sharing options...
MisterBates Posted June 15, 2007 Share Posted June 15, 2007 Ah Thanks for the welcome and the script. =D It works fine, however, is there a way to make the script press "F1" constantly for an amount of time rather then looping for an [#] amount of times (thats what I meant by "F1 for X Minutes", sorry I wasn't clear), then reloop the whole thing? I was thinking of adding a code to press the hotkey to start again, but not sure where to place it.Use your original do/until loop to time it, but change your exit condition to >= rather than =. From the AutoIt help file for Send To hold a key down (generally only useful for games) Send("{a down}") ;Holds the A key down Send("{a up}") ;Releases the A key [u]MisterBates[/u]_____________________________________________________Suspend/Resume Windows ScreensaverWatchWindows - Window watcher/loggerUDF: Click systray menu/submenu itemsUDF: Outlook Express Folder/Message handling (+ example code)HowTo: Multiple icons in one compiled script Link to comment Share on other sites More sharing options...
ofLight Posted June 15, 2007 Share Posted June 15, 2007 (edited) Sleep(5000) While 1 Send("C") Sleep(7500) Send("{F5}") Sleep(1200) Send("{F6}") Sleep(1200) Send("{F7}") Sleep(1200) Send("{F8}") Sleep(1200) $start = TimerInit() $dif = "60000" Do Send("{F1}") sleep(50) Until $dif <= TimerDiff($start) Wend I havent used TimerInit before but I think the $Start needs to be before your loop ? Edited June 15, 2007 by ofLight There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly Link to comment Share on other sites More sharing options...
aznkid Posted June 15, 2007 Author Share Posted June 15, 2007 Well, this is what I managed to come up with everyones help. HotKeySet("{F10}", "_start") HotKeySet("{F11}", "_pause") HotKeySet("+{F11}", "_exit") While 1 sleep(10) WEnd Func _start() while 1 Send("C") Sleep(7500) Send("{F5}") Sleep(1500) Send("{F6}") Sleep(1500) Send("{F7}") Sleep(1500) Send("{F8}") Sleep(1500) Send("{F9}") Sleep(1700) $start = TimerInit() $dif = "300000" Do Send("{F1}") Until $dif <= TimerDiff($start) WEnd EndFunc Func_pause() Sleep(10) EndFunc Func_exit() Exit EndFunc It works fine. Thanks for your help. 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