Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GUIConstants.au3>
- #include <Misc.au3>
- HotKeySet("{F1}", "BR_Hotkey")
- HotKeySet("{F2}", "BR_Start")
- Global $hotkey = False
- GUICreate("AutoBR v0.2", 200, 150)
- Local $button_learn = GUICtrlCreateButton("Learn", 10, 10, 180, 30)
- Local $button_start = GUICtrlCreateButton("Start (F2)", 10, 50, 180, 30)
- Local $button_help = GUICtrlCreateButton("?", 160, 110, 30, 30)
- GUISetState()
- While True
- Local $msg = GUIGetMsg()
- Switch ($msg)
- Case $button_learn
- BR_Learn()
- Case $button_start
- BR_Start()
- Case $button_help
- ShellExecute("http://www.reddit.com/r/h1z1/comments/2wtp5u/script_battle_royale_autoconnector/")
- Case $GUI_EVENT_CLOSE
- Exit
- EndSwitch
- WEnd
- Func BR_Hotkey()
- $hotkey = True
- EndFunc
- Func BR_Learn()
- While True
- Sleep(1)
- ToolTip("Make sure the 'Play Battle Royale' button is greyed out." & @CRLF & "Move your mouse over the button and press F1.")
- If ($hotkey) Then
- Local $pos = MouseGetPos()
- MouseMove(0, 0, 0)
- Local $checksum = PixelChecksum($pos[0] - 25, $pos[1] - 5, $pos[0] + 25, $pos[1] + 5)
- IniWrite("config.ini", "config", "br_a_x", $pos[0])
- IniWrite("config.ini", "config", "br_a_y", $pos[1])
- IniWrite("config.ini", "config", "br_a_c", $checksum)
- $hotkey = False
- ExitLoop
- EndIf
- WEnd
- While True
- Sleep(1)
- ToolTip("Do not move your mouse now." & @CRLF & "Waiting for button to change it's color.")
- Local $newcheck = PixelChecksum($pos[0] - 25, $pos[1] - 5, $pos[0] + 25, $pos[1] + 5)
- If ($checksum <> $newcheck) Then
- Click($pos[0], $pos[1])
- ExitLoop
- EndIf
- WEnd
- While True
- Sleep(1)
- ToolTip("Now point at your characters name and press F1.")
- If ($hotkey) Then
- Local $pos = MouseGetPos()
- IniWrite("config.ini", "config", "br_b_x", $pos[0])
- IniWrite("config.ini", "config", "br_b_y", $pos[1])
- $hotkey = False
- ExitLoop
- EndIf
- WEnd
- While True
- Sleep(1)
- ToolTip("Now point at the 'Play' button and press F1.")
- If ($hotkey) Then
- Local $pos = MouseGetPos()
- IniWrite("config.ini", "config", "br_c_x", $pos[0])
- IniWrite("config.ini", "config", "br_c_y", $pos[1])
- $hotkey = False
- ExitLoop
- EndIf
- WEnd
- MsgBox(0, "Done!", "Go back to H1Z1 main menu and start the program by pressing F2.")
- EndFunc
- Func BR_Start()
- If (FileExists("config.ini")) Then
- Local $x = IniRead("config.ini", "config", "br_a_x", "")
- Local $y = IniRead("config.ini", "config", "br_a_y", "")
- Local $checksum = IniRead("config.ini", "config", "br_a_c", "")
- MouseMove(0, 0, 0)
- While True
- If (PixelChecksum($x - 25, $y - 5, $x + 25, $y + 5) <> $checksum) Then
- ExitLoop
- EndIf
- WEnd
- Sleep(100)
- Click(IniRead("config.ini", "config", "br_a_x", ""), IniRead("config.ini", "config", "br_a_y", ""))
- Click(IniRead("config.ini", "config", "br_b_x", ""), IniRead("config.ini", "config", "br_b_y", ""))
- Click(IniRead("config.ini", "config", "br_c_x", ""), IniRead("config.ini", "config", "br_c_y", ""))
- Else
- MsgBox(0, "Error", "Config not found. Please start with 'Learn'.")
- EndIf
- EndFunc
- Func Click($x, $y)
- For $i = 0 To 3
- MouseMove($x, $y, 3)
- Sleep(5)
- MouseClick("left")
- Sleep(5)
- Next
- Sleep(10)
- EndFunc
Add Comment
Please, Sign In to add comment