Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ; #Warn  ; Enable warnings to assist with detecting common errors.
  3. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5.  
  6.  
  7. ;Set to match Windows titles exactly
  8. SetTitleMatchMode, 3
  9.  
  10. ;Loops around and closes continuum and injector process until none exist
  11. While 1{
  12.     Sleep, 200
  13.     Process, Exist, Continuum.exe
  14.     if (!ErrorLevel = 0){
  15.         RunWait, taskkill /f /t /im Continuum.exe
  16.     }
  17.     if (ErrorLevel = 0){
  18.         break
  19.     }
  20. }
  21.  
  22. While 1{
  23.     Sleep, 200
  24.     Process, Exist, Injector.exe
  25.     if (!ErrorLevel = 0){
  26.         Process, Close, Injector.exe
  27.     }
  28.     if (ErrorLevel = 0){
  29.         break
  30.     }
  31. }
  32.  
  33.  
  34.  
  35. ;The main loop that cycles through each bot
  36. While 1{
  37.    
  38. ;BOT 9 ------------------------------------------------------------------------------------------------------------------------------
  39.  
  40.     ;This starts the bot if it isnt running, and restarts it if disconected from server
  41.     FileRead, Read, C:\Program Files (x86)\Continuum\Logs\bot9.log
  42.     Sleep, 5000
  43.     if (RegExMatch(Read, "m)^  WARNING: ") or !WinExist("9")){
  44.        
  45.         WinClose, 9
  46.         WinWait, Continuum 0.40,, 5
  47.         WinClose, Continuum 0.40
  48.         Sleep, 1000
  49.         ;Keep the log file small, and another thing
  50.         FileDelete, C:\Program Files (x86)\Continuum\logs\bot9.log
  51.  
  52.         ;Before starting continuum check and close any continuum menus
  53.         While 1{
  54.             Sleep, 200
  55.             if (WinExist("Continuum 0.40")){
  56.                 WinClose, Continuum 0.40
  57.             }
  58.             if (!WinExist("Continuum 0.40")){
  59.                 break
  60.             }
  61.         }
  62.  
  63.         ;Starts continnum and checks if the window exists
  64.         Run, C:\Users\Jon\Desktop\Marvin Run Folder\multicont
  65.         WinWait, Continuum 0.40,, 5
  66.         While 1{
  67.             Sleep, 200
  68.             if (!WinExist("Continuum 0.40")){
  69.                 Run, C:\Users\Jon\Desktop\Marvin Run Folder\multicont
  70.                 WinWait, Continuum 0.40,, 5
  71.             }
  72.             if (WinExist("Continuum 0.40")){
  73.                 break
  74.             }
  75.         }
  76.         ;give the active window a handle, this handle doesnt need to be unique
  77.         Menu := WinActive()
  78.  
  79.         ;This sends keys to open the profile menu, it loops to make sure the menu opened, this loop is definetly needed
  80.         ControlSend,, ^p, ahk_id %Menu%
  81.         WinWait, Select/Edit Profile,, 1
  82.         While 1{
  83.             Sleep, 200
  84.             if (!WinExist("Select/Edit Profile")){
  85.                 ControlSend,, ^p, ahk_id %Menu%
  86.                 WinWait, Select/Edit Profile,, 1
  87.             }
  88.             if (WinExist("Select/Edit Profile")){
  89.                 break
  90.             }
  91.         }
  92.  
  93.         Profile := WinActive()
  94.  
  95.         ;Send keys to select a profile, loops to make sure the profile menu closed, probably not needed
  96.         ControlSend,, {PGUP}{PGUP}{PGUP}{PGUP}{PGUP}{ENTER}, ahk_id %Profile%
  97.         Sleep, 200
  98.         While 1{
  99.             Sleep, 200
  100.             if (WinExist(%Profile%)){
  101.                 ControlSend,, {ENTER}, ahk_id %Profile%
  102.             }
  103.             if (!WinExist(%Profile%)){
  104.                 break
  105.             }
  106.         }
  107.         ;Login
  108.         ControlSend,, {ENTER}, ahk_id %Menu%
  109.  
  110.         ;Wait 35 Seconds, if there is no connection, the client will timeout
  111.         WinWait, Continuum,,35
  112.  
  113.         ;If the client times out try again, if it connects to the game, the log file previously deleted will be created
  114.         While 1{
  115.             Sleep, 200
  116.             if (WinExist("Information")){
  117.                 WinClose, Information
  118.                 Sleep, 1000
  119.                 ControlSend,, {ENTER}, ahk_id %Menu%
  120.                 WinWait, Continuum,, 35
  121.             }
  122.             if (FileExist("C:\Program Files (x86)\Continuum\Logs\bot9.log")){
  123.                 Bot9 := WinActive()
  124.                 break
  125.             }
  126.         }
  127.  
  128.         ;Press ESC too early and it will exit back to the menu
  129.         Sleep, 3000
  130.         ;Marvin will default to Warbird if the client is not in a ship
  131.         ControlSend,, {ESC}, ahk_id %Bot9%
  132.         Sleep, 1000
  133.         ControlSend,, 1, ahk_id %Bot9%
  134.         ;Without this sleep timer the game will minimize before the player enters the ship
  135.         Sleep, 1000
  136.         WinMinimize, ahk_id %bot9%
  137.         Sleep, 1000
  138.  
  139.  
  140.         ;Before starting marvin check and close any continuum menus and injectors
  141.         While 1{
  142.             Sleep, 200
  143.             if (WinExist("Continuum 0.40")){
  144.                 WinClose, Continuum 0.40
  145.             }
  146.             if (WinExist("Injector")){
  147.                 WinClose, Injector
  148.             }
  149.             if (!WinExist("Continuum 0.40" and !WinExist("Injector"))){
  150.                 break
  151.             }
  152.         }
  153.        
  154.         ;This starts injector and uses a regex to select the first unloaded process
  155.         While 1{
  156.             Sleep, 100
  157.             if (!WinExist("Continuum (enabled)")){
  158.                 Run, C:\Users\Jon\Desktop\Marvin Run Folder\Injector
  159.                 WinWait, Injector,, 5
  160.                 While 1{
  161.                     Sleep, 200
  162.                     if (!WinExist("Injector")){
  163.                         Run, C:\Users\Jon\Desktop\Marvin Run Folder\Injector
  164.                         WinWait, Injector,, 5
  165.                     }
  166.                     if (WinExist("Injector")){
  167.                         break
  168.                     }
  169.                 }
  170.                 Injector := WinActive()
  171.                 Sleep, 200
  172.                
  173.                 ;Check if the text copied correctly
  174.                 Text = 0
  175.                 While 1{
  176.                     Sleep, 200
  177.                     if (!RegExMatch(Text, "^1: ")){
  178.                         ControlSend,, ^a, ahk_id %Injector%
  179.                         Sleep, 200
  180.                         ControlSend,, {ENTER}, ahk_id %Injector%
  181.                         Text := Clipboard
  182.                     }
  183.                     if (RegExMatch(Text, "^1: ")){
  184.                         break
  185.                     }
  186.                 }
  187.                
  188.                 RegExMatch(Text, "m)^(\d+):.+?\)$", Match)
  189.                
  190.                 ControlSend,, %Match1%, ahk_id %Injector%
  191.                 Sleep, 100
  192.                 ControlSend,, {ENTER}, ahk_id %Injector%
  193.                 Sleep, 1000
  194.             }
  195.             if (WinExist("Continuum (enabled)")){
  196.                 WinSetTitle, ahk_id %bot9%,, 9
  197.                 break
  198.             }
  199.         }
  200.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement