Code:
#SingleInstance force ; Replace an existing script
#NoEnv ; Don't check empty variables to see if they are environment variables
SetDefaultMouseSpeed, 0 ; Move mouse instantly
; Changes the tray icon's tooltip (displayed when mouse hovers over it)
Menu, tray, Tip, Apex ReQueue
; Show Tooltip in the tray that the script is active (Quiet)
TrayTip, Apex Tools, running...,,16
; Makes subsequent hotkeys only function if specified window is active
#IfWinActive Apex Legends ahk_class Respawn001
; Reload script to break loop if an error occurs
~F5:: ;F5
reload
return
;To test a mouse position
;+1:: ;Shift + 1
;TestFunc()
;return
;Will click to 'continue' if afk or just launched the client
;Then will queue
;There is a slight hickup with using this queue fresh after opening the client, as
;the white 'check' diamond near the playername seems to take its sweet time
;appearing
~F9 up::
Startclick :=GetAbsolutePixels(0.5, 0.66)
MouseMove, Startclick[1], Startclick[2]
Click,
RandomSleep(20,40)
Click
Loop {
ApexQueue()
}
Tooltip,
return
; Leaves the game and Queues into an Apex Match, then reloads the Script to break the loop
~+Escape up:: ; Shift + Escape / Scipt starts after escape is released
LeaveUI()
Click,
Loop{
ApexQueue()
}
Tooltip,
return
;/////////////////Basic Tools\\\\\\\\\\\\\\\\\
GetAbsolutePixels(RatioX, RatioY) {
WinGetPos,,, Width, Height
AbsoluteX := Round(Width * RatioX)
AbsoluteY := Round(Height * RatioY)
return [AbsoluteX, AbsoluteY]
}
RandomSleep(Between1, Between2) {
Random, RandomizedSleepTime, Between1, Between2
Sleep, RandomizedSleepTime
}
TestFunc(){
asd :=GetAbsolutePixels(0.5 , 0.57)
MouseMove, asd[1], asd[2]
}
; /////////////////Core Functions\\\\\\\\\\\\\\\\\
; Leaves Apex match, and confirms prompt
LeaveUI() {
BlockInput, on
leavebtn := GetAbsolutePixels(0.5 , 0.57) ;Initial Exit Match / Exit Game Btn Location
leaveconf := GetAbsolutePixels(0.44 , 0.67) ;Secondary Confirmatory Btn Location
;Send, {Esc} ;if the button to enable this function IS NOT Escape, then enable this line to open the initial prompt.
Tooltip, Leaving Game, leavebtn[1]-30, leavebtn[2]+40
RandomSleep(450, 600)
MouseMove, leavebtn[1], leavebtn[2]
RandomSleep(35, 50)
Send, {Space}
RandomSleep(250, 350)
MouseMove, leaveconf[1], leaveconf[2]
RandomSleep(250, 350)
Send, {Space}
BlockInput, off
return
}
;Looks for the white area in the player 'NamePlate' in the Lobby of Apex Legends.
;Until it finds the White Pixel it will spam Space, as if to clear the postgame
;screens and stop after the queue button is started.
;Can be used in Majority of screens. even on the Pregame menus if you keep the QueueBTN to be on the 'back' button too.
ApexQueue() {
BlockInput, on
QueueBTN := GetAbsolutePixels(0.05, 0.93)
NamePlate := GetAbsolutePixels(0.425 , 0.115) ; Position on the DIamond Shaped Checkbox that appears when actively in a queue for Apex.
TTPos := GetAbsolutePixels(0.08, 0.85) ;Used for Tooltip Position over the Queue Button.
Tooltip, Enabled waiting for loop, TTPos[1], TTPos[2]
RandomSleep(30,50)
MouseGetPos, StartX, StartY
Loop {
PixelSearch QActiveX, QActiveY, NamePlate[1], NamePlate[2], NamePlate[1], NamePlate[2]+1, 0xFFFFFF, 30, Fast RGB
if !ErrorLevel {
ToolTip, "You're Queued -- now reloading", TTPos[1], TTPos[2]
MouseMove, StartX,StartY
RandomSleep(5000,8000)
BlockInput, off
Reload,
} else {
mousemove, QueueBTN[1], QueueBTN[2]
Send, {Space}
RandomSleep(240,300)
Return,
}
return
}
MouseMove, StartX,StartY
BlockInput, off
return
}