Results 1 to 2 of 2
  1. #1
    sphexion's Avatar
    Join Date
    Apr 2015
    Gender
    female
    Posts
    2
    Reputation
    10
    Thanks
    0

    Post Keep It Clean! Over and Over!

    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

  2. #2
    roflsecurity's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    47
    Reputation
    38
    Thanks
    2
    I do somthing similar as well.

    Code:
    #include <Misc.au3>
    
    
    HotKeySet('{END}', 'Quit')
    HotKeySet('{F10}', 'Pause')
    Global $Paused
    Global $DebugOn = False
    Global $delay = 250
    Pause()
    ;=======CODE HERE=============
    While 1
    
    
    
    
    WEnd
    ;=======CODE HERE=============
    
    
    Func pix()
       Sleep(1000)
       $coord = PixelSearch(0, 0, 100, 200, 0xFF0000)
       If Not @error Then
    	   MouseClick("primary", $coord[0], $coord[1], 1, 0)
       EndIf
    EndFunc
    
    
    Func Quit()
       Exit
    EndFunc
    
    
    Func Pause()
        $Paused = NOT $Paused
        While $Paused
            sleep(100)
            ToolTip('Script is "Paused"',0,0)
        WEnd
        ToolTip("")
    EndFunc
    
    
    Func DEBUG($MESSAGE)
       If $DebugOn Then
          ToolTip($MESSAGE, 0, 0)
       EndIf
    EndFunc      ;==>Debug Info
    Last edited by roflsecurity; 07-01-2015 at 05:50 AM.

Similar Threads

  1. 4000 Over And Over
    By Ryuesi in forum General
    Replies: 43
    Last Post: 09-19-2011, 07:08 PM
  2. [Solved] Doing Thor over and over?
    By xiacross in forum Vindictus Help
    Replies: 4
    Last Post: 09-19-2011, 10:33 AM
  3. Get stabbed over and over or get shot
    By zunaid9211 in forum General
    Replies: 41
    Last Post: 03-27-2011, 07:44 PM
  4. [FIX] Registration Key Error (Over and Over) [/FIX]
    By headsup in forum Battlefield Bad Company 2 (BFBC2) Hacks
    Replies: 7
    Last Post: 06-02-2010, 03:02 AM
  5. CA keeps patching over and over?
    By 123msg123 in forum Combat Arms Help
    Replies: 4
    Last Post: 12-05-2009, 07:51 PM