Ixen Posted October 29, 2005 Share Posted October 29, 2005 Hello, I'm currently working on an AutoIt script to do something in a game for me and I can't seem to figure out how to loop my script (I'm going for infinite loops). The directory to the .exe is: C:\Documents and Settings\Greg\Desktop\Coding\MAcros\SWG.exe I have tried Run, RunWait, and some of the Do and whiles and others, but all to no avail. Thanks, Ixen Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 29, 2005 Moderators Share Posted October 29, 2005 well Do / Until and While / Wend and For / Next are all loops, but if you don't post any code we can't tell you what you did wrong not to make it infinite. 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...
Ixen Posted October 29, 2005 Author Share Posted October 29, 2005 The problem is that I didn't save my mistakes to be able to come back and correct them later and continued to modify the same script over and over. I couldn't get my script to loop at all, but the one thing I didn't try was including the message box (mostly because it will minimize my game when it comes up). What code would you suggest using for it? Link to comment Share on other sites More sharing options...
Nuffilein805 Posted October 29, 2005 Share Posted October 29, 2005 in general you can do: while 1 ;here is your code wend thats it my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
Ixen Posted October 29, 2005 Author Share Posted October 29, 2005 However, for RunWAit I used: RunWait("SWG.exe","C:\Documents and Settings\Greg\Desktop\Coding\MAcros\SWG") Link to comment Share on other sites More sharing options...
Ixen Posted October 29, 2005 Author Share Posted October 29, 2005 in general you can do:while 1 ;here is your code wendthats itIt's that easy? Link to comment Share on other sites More sharing options...
Nuffilein805 Posted October 29, 2005 Share Posted October 29, 2005 (edited) yup it is this is not the point just post your script here and we will see what we can do Edited October 29, 2005 by Nuffilein805 my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
Ixen Posted October 29, 2005 Author Share Posted October 29, 2005 (edited) Okay, Thank you. Here's my script: expandcollapse popupwhile 1 HotKeySet("{ESC}", "Stop") Sleep ( 5000 ) Sleep ( 2000 ) MouseMove ( 166, 120 ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseMove ( 213, 127 ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) Sleep ( 5300 ) *Repeat the last sixteen lines 10 more times* MouseMove ( 166, 120 ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseMove ( 213, 127 ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) Sleep ( 2000 ) Func Stop() Exit 0 EndFunc wend Edited October 29, 2005 by Ixen Link to comment Share on other sites More sharing options...
Nuffilein805 Posted October 29, 2005 Share Posted October 29, 2005 (edited) Okay, Thank you.Here's my script:expandcollapse popupwhile 1 HotKeySet("{ESC}", "Stop") Sleep ( 5000 ) Sleep ( 2000 ) MouseMove ( 166, 120 ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseMove ( 213, 127 ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) Sleep ( 5300 ) *Repeat the last sixteen lines 10 more times* MouseMove ( 166, 120 ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseMove ( 213, 127 ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) Sleep ( 2000 ) Func Stop() Exit 0 EndFunc wendthe hotkeyset is better if it's outside the loopwhy do you use 2 sleeps after another?you just have to put down your code oncethe function needs to be outside the loop as wellHotKeySet("{ESC}", "Stop") while 1 Sleep ( 7000 ) MouseMove ( 166, 120 ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseMove ( 213, 127 ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) MouseClick ( "left" ) wend Func Stop() Exit 0 EndFuncthis 1 is betterfor which game do you need it? Edited October 29, 2005 by Nuffilein805 my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
Nuffilein805 Posted October 29, 2005 Share Posted October 29, 2005 if you just want your script to sleep once do the sleep in front of your loop my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
Ixen Posted October 29, 2005 Author Share Posted October 29, 2005 I did the two sleeps because it was easier for me to figure out what i need to for time. I'm running this for the game Star Wars Galaxies and using a crafting macro along with it, and this script's success relies totally on my timing and symmetry with the in-game macro. Link to comment Share on other sites More sharing options...
Nuffilein805 Posted October 29, 2005 Share Posted October 29, 2005 ah, i see well, have you tried out your upgraded script? my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
Ixen Posted October 29, 2005 Author Share Posted October 29, 2005 Right now I'm adding an extra command to make it maximize the game and press F1 once it's activated, so that I won't have to worry about maximizing the game and pressing F1 in time for it to work correctly. Once I get that in I'll post back here Link to comment Share on other sites More sharing options...
Nuffilein805 Posted October 29, 2005 Share Posted October 29, 2005 ok, good luck automating your game i'm awaiting great programs from you my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
Ixen Posted October 29, 2005 Author Share Posted October 29, 2005 Thank you very much for helping this little coding noob Link to comment Share on other sites More sharing options...
Ixen Posted October 29, 2005 Author Share Posted October 29, 2005 Okay, well I finished up my script and the macro along with it but now i have a little problem: it says that my send command for F1 is invalid I followed what it said in the help file to include as, and here is what I put: Send ( "{F1}" [, 0] ) Link to comment Share on other sites More sharing options...
Developers Jos Posted October 29, 2005 Developers Share Posted October 29, 2005 Okay, well I finished up my script and the macro along with it but now i have a little problem: it says that my send command for F1 is invalid I followed what it said in the help file to include as, and here is what I put:Send ( "{F1}" [, 0] )[, 0] means that ,0 is optional:So it could be:Send ( "{F1}" )orSend ( "{F1}", 0 )orSend ( "{F1}", 1 ) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Ixen Posted October 29, 2005 Author Share Posted October 29, 2005 Yeah, I reread the help file again and was testing it out and it works perfectly now. Thanks again guys. BTW, I used: Send ( "{F1}" ) 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