Jump to content
Sign in to follow this  
Leprechaun

Loop the program?

Recommended Posts

Leprechaun

Ok so before I made a gui for this it looped fine. But then after I added the gui I dont know how to make it loop. Because after they put in their password and press "Go!" I want it to loop back to "Gamelogin()" and "GoZapIt()"

Script

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("..::Cha0TiC::..", 272, 86, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$n=GUICtrlCreatePic("Backround.bmp", -1, -1, 0, 0)
GuiCtrlSetState(-1, $GUI_DISABLE)
$Group_1 = GuiCtrlCreateGroup("Password", 180, 0, 90, 72)
$Radio_2 = GuiCtrlCreateRadio("Scania", 10, 20, 50, 10)
$Radio_3 = GuiCtrlCreateRadio("Bera", 10, 30, 50, 10)
$Group_4 = GuiCtrlCreateGroup("Server", 0, 0, 70, 50)
$Group_5 = GuiCtrlCreateGroup("Character", 80, 0, 90, 70)
$Input_3 = GuiCtrlCreateInput("", 186, 25, 66, 18,$ES_PASSWORD)
$Button_2 = GuiCtrlCreateButton("Go!", 215, 45, 48, 20)
$Radio_8 = GuiCtrlCreateRadio("Character 1", 87, 19, 76, 12)
$Radio_9 = GuiCtrlCreateRadio("Character 2", 87, 36, 82, 12)
$Radio_11 = GuiCtrlCreateRadio("Character 3", 87, 54, 72, 12)

GUISetState()

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_2
      GameLogin()
      GoZapIt()
      
Case Else
    
   EndSelect
WEnd

;======================================================================================
; Func GameLogin()                                        Hot Key = None
;======================================================================================
 Func GameLogin()
If WinGetState("MapleStory") = 16 Then
   WinSetState("MapleStory", "", @SW_MAXIMIZE)
EndIf
    Sleep(1000)
    MouseClick("left", 419, 334, 1)
    Sleep(1000)
    MouseClick("left", 454, 286, 1)
    Send(GuiCtrlRead($Input_3) & "{Enter}") 
    Sleep(1000)
If GuiCtrlRead($Radio_2) = $GUI_CHECKED Then
    MouseClick("left", 163, 157, 1)
    ElseIf GuiCtrlRead($Radio_3) = $GUI_CHECKED Then
    MouseClick("left", 197, 160, 1)
EndIf
 Sleep(1000)
Dim $channel   
 $channel = Random(0, 19, 1)
If $channel = 0 Then MouseClick("left", 284, 431, 1); Channel 17
If $channel = 1 Then MouseClick("left", 274, 400, 1); Channel 13
If $channel = 2 Then MouseClick("left", 366, 334, 1); Channel 6
If $channel = 3 Then MouseClick("left", 265, 364, 1); Channel 9
If $channel = 4 Then MouseClick("left", 553, 305, 1); Channel 4
If $channel = 5 Then MouseClick("left", 275, 332, 1); Channel 5
If $channel = 6 Then MouseClick("left", 363, 304, 1); Channel 2
If $channel = 7 Then MouseClick("left", 458, 305, 1); Channel 3
If $channel = 8 Then MouseClick("left", 259, 303, 1); Channel 1
If $channel = 9 Then MouseClick("left", 453, 336, 1); Channel 7
If $channel = 10 Then MouseClick("left", 558, 337, 1); Channel 8
If $channel = 11 Then MouseClick("left", 364, 367, 1); Channel 10
If $channel = 12 Then MouseClick("left", 461, 370, 1); Channel 11
If $channel = 13 Then MouseClick("left", 552, 367, 1); Channel 12
If $channel = 14 Then MouseClick("left", 368, 400, 1); Channel 14
If $channel = 15 Then MouseClick("left", 463, 397, 1); Channel 15
If $channel = 16 Then MouseClick("left", 561, 398, 1); Channel 16
If $channel = 17 Then MouseClick("left", 372, 430, 1); Channel 18
If $channel = 18 Then MouseClick("left", 466, 432, 1); Channel 19
If $channel = 19 Then MouseClick("left", 557, 431, 1); Channel 20

    Sleep(1000)
    MouseClick("left", 555, 252, 1)
    Sleep(1000)
If GuiCtrlRead($Radio_8) = $GUI_CHECKED Then 
    MouseClick("left", 252, 343, 1)
Endif
If GuiCtrlRead($Radio_9) = $GUI_CHECKED Then 
    MouseClick("left", 380, 339, 1) 
Endif  
If GuiCtrlRead($Radio_11) = $GUI_CHECKED Then
    MouseClick("left", 508, 329, 1) 
Endif   
    Sleep(700)
    MouseClick("left", 624, 159, 1)
    Sleep(3000)
EndFunc ;==>GameLogin

;======================================================================================
; Func GoZapIt()                                            Hot Key = None
;======================================================================================
Func GoZapIt()

    Local $iMax = 70; Change this if you want to change the number of times it hits
    Local $iCnt  ; This does the counting
    For $iCnt = 1 To $iMax
        Send("a")
        Sleep(200)
If WinGetState("MapleStory") = 16 Then
   WinSetState("MapleStory", "", @SW_MAXIMIZE)
EndIf
    

    Next
     Return
EndFunc ;==>GoZapIt

;======================================================================================
; Func Terminate()                                        Hot Key = Escape
;======================================================================================
Func Terminate()                                          ; Hot Key = Escape
    MsgBox(0, "Terminating Script", "Script Name: " & @ScriptName & @LF & @LF & "Located: " & @ScriptDir & @LF & @LF & "is now Terminated")
    Exit 0
EndFunc ;==>Terminate

;======================================================================================
; Func Begin()                                        Hot Key = F3
;======================================================================================

Share this post


Link to post
Share on other sites
GaryFrost

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

HotKeySet("{ESC}","_StopLoop")
$Loop = 0

GUICreate("..::Cha0TiC::..", 272, 86, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$n = GUICtrlCreatePic("Backround.bmp", -1, -1, 0, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
$Group_1 = GUICtrlCreateGroup("Password", 180, 0, 90, 72)
$Radio_2 = GUICtrlCreateRadio("Scania", 10, 20, 50, 10)
$Radio_3 = GUICtrlCreateRadio("Bera", 10, 30, 50, 10)
$Group_4 = GUICtrlCreateGroup("Server", 0, 0, 70, 50)
$Group_5 = GUICtrlCreateGroup("Character", 80, 0, 90, 70)
$Input_3 = GUICtrlCreateInput("", 186, 25, 66, 18, $ES_PASSWORD)
$Button_2 = GUICtrlCreateButton("Go!", 215, 45, 48, 20)
$Radio_8 = GUICtrlCreateRadio("Character 1", 87, 19, 76, 12)
$Radio_9 = GUICtrlCreateRadio("Character 2", 87, 36, 82, 12)
$Radio_11 = GUICtrlCreateRadio("Character 3", 87, 54, 72, 12)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_2
            $Loop = 1
            While $Loop
                GameLogin()
                GoZapIt()
            WEnd
        Case Else
            
    EndSelect
WEnd

;======================================================================================
; Func GameLogin()                                        Hot Key = None
;======================================================================================
Func GameLogin()
    If WinGetState("MapleStory") = 16 Then
        WinSetState("MapleStory", "", @SW_MAXIMIZE)
    EndIf
    Sleep(1000)
    MouseClick("left", 419, 334, 1)
    Sleep(1000)
    MouseClick("left", 454, 286, 1)
    Send(GUICtrlRead($Input_3) & "{Enter}")
    Sleep(1000)
    If GUICtrlRead($Radio_2) = $GUI_CHECKED Then
        MouseClick("left", 163, 157, 1)
    ElseIf GUICtrlRead($Radio_3) = $GUI_CHECKED Then
        MouseClick("left", 197, 160, 1)
    EndIf
    Sleep(1000)
    Dim $channel
    $channel = Random(0, 19, 1)
    If $channel = 0 Then MouseClick("left", 284, 431, 1); Channel 17
    If $channel = 1 Then MouseClick("left", 274, 400, 1); Channel 13
    If $channel = 2 Then MouseClick("left", 366, 334, 1); Channel 6
    If $channel = 3 Then MouseClick("left", 265, 364, 1); Channel 9
    If $channel = 4 Then MouseClick("left", 553, 305, 1); Channel 4
    If $channel = 5 Then MouseClick("left", 275, 332, 1); Channel 5
    If $channel = 6 Then MouseClick("left", 363, 304, 1); Channel 2
    If $channel = 7 Then MouseClick("left", 458, 305, 1); Channel 3
    If $channel = 8 Then MouseClick("left", 259, 303, 1); Channel 1
    If $channel = 9 Then MouseClick("left", 453, 336, 1); Channel 7
    If $channel = 10 Then MouseClick("left", 558, 337, 1); Channel 8
    If $channel = 11 Then MouseClick("left", 364, 367, 1); Channel 10
    If $channel = 12 Then MouseClick("left", 461, 370, 1); Channel 11
    If $channel = 13 Then MouseClick("left", 552, 367, 1); Channel 12
    If $channel = 14 Then MouseClick("left", 368, 400, 1); Channel 14
    If $channel = 15 Then MouseClick("left", 463, 397, 1); Channel 15
    If $channel = 16 Then MouseClick("left", 561, 398, 1); Channel 16
    If $channel = 17 Then MouseClick("left", 372, 430, 1); Channel 18
    If $channel = 18 Then MouseClick("left", 466, 432, 1); Channel 19
    If $channel = 19 Then MouseClick("left", 557, 431, 1); Channel 20
    
    Sleep(1000)
    MouseClick("left", 555, 252, 1)
    Sleep(1000)
    If GUICtrlRead($Radio_8) = $GUI_CHECKED Then
        MouseClick("left", 252, 343, 1)
    EndIf
    If GUICtrlRead($Radio_9) = $GUI_CHECKED Then
        MouseClick("left", 380, 339, 1)
    EndIf
    If GUICtrlRead($Radio_11) = $GUI_CHECKED Then
        MouseClick("left", 508, 329, 1)
    EndIf
    Sleep(700)
    MouseClick("left", 624, 159, 1)
    Sleep(3000)
EndFunc  ;==>GameLogin

;======================================================================================
; Func GoZapIt()                                            Hot Key = None
;======================================================================================
Func GoZapIt()
    
    Local $iMax = 70; Change this if you want to change the number of times it hits
    Local $iCnt ; This does the counting
    For $iCnt = 1 To $iMax
        Send("a")
        Sleep(200)
        If WinGetState("MapleStory") = 16 Then
            WinSetState("MapleStory", "", @SW_MAXIMIZE)
        EndIf
        
        
    Next
    Return
EndFunc  ;==>GoZapIt

;======================================================================================
; Func Terminate()                                        Hot Key = Escape
;======================================================================================
Func Terminate()                                         ; Hot Key = Escape
    MsgBox(0, "Terminating Script", "Script Name: " & @ScriptName & @LF & @LF & "Located: " & @ScriptDir & @LF & @LF & "is now Terminated")
    Exit 0
EndFunc  ;==>Terminate

;======================================================================================
; Func Begin()                                        Hot Key = F3
;======================================================================================

Func _StopLoop()
    $Loop = 0
EndFunc


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites
Leprechaun

Gafrost. Thanks again..you have no clue how much you've helped. =) Woo! Thanks lots. Truly appreciated.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×