Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Continuous loop problem. Help me if you can. Thanks!

$
0
0
Hi everyone!
I'm pretty much new to the forum and to the programming world of AutoIt 3.
I tried to make a script that will help me do certain functions as I press a hotkey.
I defined a hotkey to start the function and another one to stop it.
Problem is that I can run the script only once and then i have to use the .exe file again :( which is pretty much annoying.
Another issue that it occurred is that when I try to use more functions it won't work at all, only the first one is executed.

Here what I did so far:

[ autoit ]         
 Global $Paused HotKeySet("{1}","Start") ;script started by pressing 1. HotKeySet("{2}", "Stop") ;script stopped by pressing 2. HotKeySet("{3}","superclick") HotKeySet("{4}","superclickstop") HotKeySet("{5}","rumble") HotKeySet("{6}","rumblestop") $Start = False $superclick = False $rumble = False While 1 If $Start Then While 1 Send("{SPACE}") Sleep(100) Send("{SPACE}") Sleep(100) Wend Endif WEnd While 1 If $superclick then While 2 MouseClick("left",148, 585) WEnd EndIf WEnd While 1 If $rumble Then While 1 MouseClick("left",171, 294) Sleep(10) MouseClick("left",233, 293) Sleep(10) MouseClick("left",568, 470) Sleep(10) MouseClick("left",510, 614) Sleep(10) MouseClick("left",505, 664) Sleep(10) WEnd EndIf WEnd Func Stop() Exit EndFunc Func Start() $Start=True EndFunc Func superclick() $superclick=True Endfunc Func superclickstop() Exit EndFunc Func rumble() $rumble=True EndFunc Func rumblestop() Exit EndFunc


What I'm trying to do is:
When I start the script I want to start each function whenever I need. Meaning: when I press key 1 function Start will do its job, when I press key 2 it'll stop. Thing is I want to be able to run it again without starting the script all over again.
Also I wish I could start all the functions in any order I please so that they could work in pairs or even simultaneous.
I know I've to do some loops here. I tried putting the whole block in a For, If, While block... it didn't work. I tried with ContinueLoop, failed as well.

If you people could help me it would mean a lot to me. Thank you very much for reading this post!
I'm looking forward to your answers!

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>