ciraco Posted August 17, 2007 Share Posted August 17, 2007 Hello, I am new to autoit and scripting in autoit.To start I created a simple browser based click bot, and I would like to extend it further.What I would like to do: - Add a pause and terminate hotkeys (that actually work). - Loop the "14 kill attacks" 10 times before repeating the entire script.If anyone could give me some tips or show me how to do this, it would be appreciated. Keep in mind I am new to this, so try not to get to technical.The following is my code:expandcollapse popupOpt("MouseClickDelay", 10); add this to very beggining of script, change 10 to whatever $shortsleep is and subtract this from $midsleep. While 1 Sleep(2000); script start delay ; healing MouseClick("left", 415, 104, 2); view city Sleep(1000) MouseClick("left", 434, 351, 2); tavern Sleep(1000) MouseClick("left", 415, 191, 2); rest Sleep(1500) ; select monster levels MouseClick("left", 71, 410, 2); battle Sleep(1000) MouseClick("left", 696, 201, 2); monster Sleep(1000) MouseClick("left", 640, 156, 1); dropdown Sleep(1000) Send("{DOWN DOWN}") Sleep(10) Send("{Enter}") Sleep(100) MouseClick("left", 510, 180, 2); hunt Sleep(1500) ; atack monsters (1-3) MouseClick("left", 422, 191, 2); attack (one) Sleep(1000) MouseClick("left", 422, 224, 2); attack (two) Sleep(1000) MouseClick("left", 422, 255, 2); attack (three) Sleep(1500) ; kill (14 atacks) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(3500) WEnd Link to comment Share on other sites More sharing options...
unform25 Posted August 17, 2007 Share Posted August 17, 2007 I think this might do it, not certain though expandcollapse popupDo Func Bot() While 1 Sleep(2000); script start delay ; healing MouseClick("left", 415, 104, 2); view city Sleep(1000) MouseClick("left", 434, 351, 2); tavern Sleep(1000) MouseClick("left", 415, 191, 2); rest Sleep(1500) ; select monster levels MouseClick("left", 71, 410, 2); battle Sleep(1000) MouseClick("left", 696, 201, 2); monster Sleep(1000) MouseClick("left", 640, 156, 1); dropdown Sleep(1000) Send("{DOWN DOWN}") Sleep(10) Send("{Enter}") Sleep(100) MouseClick("left", 510, 180, 2); hunt Sleep(1500) ; atack monsters (1-3) MouseClick("left", 422, 191, 2); attack (one) Sleep(1000) MouseClick("left", 422, 224, 2); attack (two) Sleep(1000) MouseClick("left", 422, 255, 2); attack (three) Sleep(1500) ; kill (14 atacks) For $Attacks = 1 To 14 MouseClick("left", 594, 175, 2) Sleep(1000) Next EndFunc Sleep(3500) WEnd EndFunc Until True = False Link to comment Share on other sites More sharing options...
ciraco Posted August 17, 2007 Author Share Posted August 17, 2007 (edited) well basicly what i am trying to do is repeat the bolded section of code 10 times within the while 1 for example, the script starts, ite goes through until the attack 14 times part, then it repeats the 14 attacks 10 times before continuing.Opt("MouseClickDelay", 10); add this to very beggining of script, change 10 to whatever $shortsleep is and subtract this from $midsleep.While 1Sleep(2000); script start delay; healingMouseClick("left", 415, 104, 2); view citySleep(1000)MouseClick("left", 434, 351, 2); tavernSleep(1000)MouseClick("left", 415, 191, 2); restSleep(1500); select monster levelsMouseClick("left", 71, 410, 2); battleSleep(1000)MouseClick("left", 696, 201, 2); monsterSleep(1000)MouseClick("left", 640, 156, 1); dropdownSleep(1000)Send("{DOWN DOWN}")Sleep(10)Send("{Enter}")Sleep(100)MouseClick("left", 510, 180, 2); huntSleep(1500); atack monsters (1-3)MouseClick("left", 422, 191, 2); attack (one)Sleep(1000)MouseClick("left", 422, 224, 2); attack (two)Sleep(1000)MouseClick("left", 422, 255, 2); attack (three)Sleep(1500); kill (14 atacks)MouseClick("left", 594, 175, 2)Sleep(1000)MouseClick("left", 594, 175, 2)Sleep(1000)MouseClick("left", 594, 175, 2)Sleep(1000)MouseClick("left", 594, 175, 2)Sleep(1000)MouseClick("left", 594, 175, 2)Sleep(1000)MouseClick("left", 594, 175, 2)Sleep(1000)MouseClick("left", 594, 175, 2)Sleep(1000)MouseClick("left", 594, 175, 2)Sleep(1000)MouseClick("left", 594, 175, 2)Sleep(1000)MouseClick("left", 594, 175, 2)Sleep(1000)MouseClick("left", 594, 175, 2)Sleep(1000)MouseClick("left", 594, 175, 2)Sleep(1000)MouseClick("left", 594, 175, 2)Sleep(1000)MouseClick("left", 594, 175, 2)Sleep(3500)WEnd Edited August 17, 2007 by ciraco Link to comment Share on other sites More sharing options...
unform25 Posted August 17, 2007 Share Posted August 17, 2007 ok, first. to repeat the attack 14 times, it is easier to put it in a FOR/NEXT statement. [b]; kill (14 atacks) For $Attack = 1 To 13 MouseClick("left", 594, 175, 2) Sleep(1000) Next MouseClick("left", 594, 175, 2) Sleep(3500)[/b] This will tell it to repeat the attack 13 times and then one last time with the extra 3.5 second delay. To repeat that whole thing 10 times you simply put the whole thing into another for statement like so: [b] For $attacks = 1 To 10 For $Attack = 1 To 13 MouseClick("left", 594, 175, 2) Sleep(1000) Next MouseClick("left", 594, 175, 2) Sleep(3500) Next[/b] Then to repeat the whole thing put it in a Do/Until statement with the whole thing as a Function with a Until True = False statement so that it doesn't stop. I think this will work, but since I don't play that game nor do I even have the ability to run AutoIt scripts on my work computer, I can't actualy test it. hope this helps Link to comment Share on other sites More sharing options...
ciraco Posted August 17, 2007 Author Share Posted August 17, 2007 Ok so this is my code: expandcollapse popupDo Func Bot() While 1 Sleep(2000); script start delay ; healing MouseClick("left", 415, 104, 2); view city Sleep(1000) MouseClick("left", 434, 351, 2); tavern Sleep(1000) MouseClick("left", 415, 191, 2); rest Sleep(1500) ; select monster levels MouseClick("left", 71, 410, 2); battle Sleep(1000) MouseClick("left", 696, 201, 2); monster Sleep(1000) MouseClick("left", 640, 156, 1); dropdown Sleep(1000) Send("{DOWN DOWN}") Sleep(10) Send("{Enter}") Sleep(100) MouseClick("left", 510, 180, 2); hunt Sleep(1500) For $Attacks = 1 To 10 ; atack monsters (1-3) MouseClick("left", 422, 191, 2); attack (one) Sleep(1000) MouseClick("left", 422, 224, 2); attack (two) Sleep(1000) MouseClick("left", 422, 255, 2); attack (three) Sleep(1500) ; kill (14 atacks) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1500) ; hunt more MouseClick("left", 538, 275, 2); no item Sleep(1000) MouseClick("left", 538, 312, 2); 1 item Sleep(1000) MouseClick("left", 538, 338, 2); 2 items Sleep(1000) MouseClick("left", 538, 370, 2); 3 items Sleep(2000) Next EndFunc Sleep(9000) WEnd EndFunc Until True = False I currently get the error: Line 2 (File "C:\..\Desktop\autoit-stuff\rfate_new.au3"); Func Bot() Error: "Do" statement has no matching "Until" statement. Link to comment Share on other sites More sharing options...
unform25 Posted August 17, 2007 Share Posted August 17, 2007 hmmm, I don't know why it's doing that. i just transfered to mine and get the same error. Maybe somebody can enlighten us both Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 17, 2007 Moderators Share Posted August 17, 2007 You should run Tidy on it in SciTE editor.... you'll see multiple EndFunc for 1 Func, and you'll see you put a function inside a loop (a no no) 1. You don't even need the Do loop because when you call the function, you have a never ending loop inside of the function that has no escape. 2. If you took that loop out (the While/WEnd) then you had better use a Return statement before you get a recursion error. Corrected, but still not logically correctexpandcollapse popupDo Bot() Until True = False Func Bot() While 1 Sleep(2000); script start delay ; healing MouseClick("left", 415, 104, 2); view city Sleep(1000) MouseClick("left", 434, 351, 2); tavern Sleep(1000) MouseClick("left", 415, 191, 2); rest Sleep(1500) ; select monster levels MouseClick("left", 71, 410, 2); battle Sleep(1000) MouseClick("left", 696, 201, 2); monster Sleep(1000) MouseClick("left", 640, 156, 1); dropdown Sleep(1000) Send("{DOWN DOWN}") Sleep(10) Send("{Enter}") Sleep(100) MouseClick("left", 510, 180, 2); hunt Sleep(1500) For $Attacks = 1 To 10 ; atack monsters (1-3) MouseClick("left", 422, 191, 2); attack (one) Sleep(1000) MouseClick("left", 422, 224, 2); attack (two) Sleep(1000) MouseClick("left", 422, 255, 2); attack (three) Sleep(1500) ; kill (14 atacks) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1000) MouseClick("left", 594, 175, 2) Sleep(1500) ; hunt more MouseClick("left", 538, 275, 2); no item Sleep(1000) MouseClick("left", 538, 312, 2); 1 item Sleep(1000) MouseClick("left", 538, 338, 2); 2 items Sleep(1000) MouseClick("left", 538, 370, 2); 3 items Sleep(2000) Next Sleep(9000) WEnd Return 1 EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
unform25 Posted August 18, 2007 Share Posted August 18, 2007 and i wasn't disappointed 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