Things I've learned over the years is how important it is to keep things managed and organised.
I figure AutoIt is for most entry level programmer/scripters, so starting off it would be a good idea to make it a habit. (like ctrl + s)
Regardless I always use AutoIt for quick tasks I am doing all the time.
Why? It keeps things clean for me, and reminds me to keep it clean.
Otherwise code goes on and on and will be all over the place and hard to make changes when your thousands of lines in.
Management and organisation is very important and will make your live easier.
This template is an Over and Over template I use.
For example If I need to keep reading a pixel until it changes.
It is super easy for me to press F1 to pause or ESC to stop. ; Not all games will this work properly with.
That has saved me from SHUTDOWN many times. Were program gets out of control.
The code is notated. READ it.
Code:
; Variables
$runing = False ; Declares the variable as false to prevent the code from starting before your ready.
; Boot Function
InitializeComponent() ; This is were the code navigates to the function InitializeComponent() to start running
; HotKey
HotKeySet("{ESC}", "stop") ; Declares ESC button to the func stop()
HotKeySet("{F1}", "go") ; Declares F1 button to the func go()
; The main function of the script this is repetitively cycled through.
; The code here will be executed over and over unless $runing = False
Func main()
;; Main code here
EndFunc
; The function that the script starts.
Func InitializeComponent()
While 1 ; The first loop established for the script to keep program running
While $runing ; if $runing == true then will execute main function
main()
WEnd
WEnd
EndFunc ;==>InitializeComponent
; The stop() func that exit program
Func stop()
Exit
EndFunc ;==>stop
; This is the go() func, here it checks if already running or not.
Func go()
; When func entered it will flip the Boolean of variable $runing
If $runing == False Then
$runing = True
Else
$runing = False
EndIf
EndFunc ;==>go