Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;
- ; Creature Control macro
- ;
- AutoItSetOption("WinTitleMatchMode", 4)
- #include <GUIConstantsEx.au3>
- Global $_MacroRunning = False
- Global $_hwnd = 0
- Global $_LoopCnt = 0
- Global $_bShouldMinimizeMO = False
- Global $_nCommandType = -1
- Global $sCommand[5]=["{ENTER}feed{ENTER}", "{ENTER}graze{ENTER}", "{ENTER}follow me{ENTER}", "{ENTER}protect me{ENTER}", "{ENTER}stay{ENTER}"]
- Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
- $mainwindow = GUICreate("McMO", 200, 150)
- GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
- GUICtrlCreateLabel("Key To Send: " & $_KeyToPress, 30, 10)
- $chkMinimize = GUICtrlCreateCheckbox("Minimize Mortal Online?", 30, 30, 120, 20)
- GUICtrlSetOnEvent($chkMinimize, "OnCheck")
- $okbutton = GUICtrlCreateButton("Run/Stop", 135, 120, 60)
- GUICtrlSetOnEvent($okbutton, "OKBut")
- GUISetState(@SW_SHOW)
- Sleep(2000)
- $_LoopCnt = 1
- While 1 = 1
- If (mod( $_LoopCnt, 5 ) = 0) THEN
- IF ($_bShouldMinimizeMO) Then
- WinSetState ( $_hwnd, "", @SW_MINIMIZE )
- Else
- WinSetState ( $_hwnd, "", @SW_RESTORE )
- EndIf
- EndIf
- If ($_MacroRunning == True) and ($_hwnd <> 0) Then
- $_LoopCnt += 1
- $_nCommandType += 1
- ;clamp
- if $_nCommandType = 5 then $_nCommandType = 0
- ControlSend($_hwnd, "", "", $sCommand[$_nCommandType])
- if ($_nCommandType == 0 ) Then
- sleep(2000)
- Else
- Sleep(5000)
- EndIf
- Else
- ;macro paused.
- Sleep( 2000 )
- EndIf
- Wend
- ;End main thread
- ;-------------------------------
- Func OKButton()
- ;Note: at this point @GUI_CTRLID would equal $okbutton,
- ;and @GUI_WINHANDLE would equal $mainwindow
- $_hwnd = WinGetHandle("classname=LaunchUnrealUWindowsClient")
- If @Error Then
- ;~ Title: Mortal Online Beta
- ;~ Class: LaunchUnrealUWindowsClient
- MsgBox(0, "McMortalOnline", "Unable to find Mortal Online window, make sure it's open.")
- $_MacroRunning = False
- Else
- $_MacroRunning = NOT $_MacroRunning
- EndIf
- if ( $_MacroRunning == False) Then
- WinSetState ( $_hwnd, "", @SW_RESTORE )
- EndIf
- EndFunc
- Func CLOSEClicked()
- ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,
- ;and @GUI_WINHANDLE would equal $mainwindow
- Exit
- EndFunc
- Func OnCheck()
- $_bShouldMinimizeMO = NOT $_bShouldMinimizeMO
- EndFunc
Add Comment
Please, Sign In to add comment